From: Rekhesh Mohan Date: Thu, 8 Nov 2012 08:10:53 +0000 (+0530) Subject: Merge branch 'testing' now v2.1 X-Git-Url: https://cads.iiap.res.in/gitview/?p=fits2jpeg.git;a=commitdiff_plain;h=ca5520b0c818f4ad57e2e57d557fc999f9dfe3c7;hp=bac717c6c0665b5754079fdcf79a79c797e6b62e Merge branch 'testing' now v2.1 Conflicts: ChangeLog.txt configure.ac src/filesys.c src/fits2jpeg.c src/image.c --- diff --git a/ChangeLog.txt b/ChangeLog.txt index af372c5..353882a 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -29,9 +29,13 @@ version fits2jpeg-1.0 A negative image can be generated using "-n" flag. 4. New option to resize image - zoom or shrink output image using "-z ". + zoom or shrink output image by "-z ". 5. New option to choose jpeg quality factor - You can choose the jpeg quality factor using "-q " + You can choose the jpeg quality factor by "-q " Quality factor was fixed at 100 in previous release. + 6. New option to specify output directory for saving jpeg images + Output location can be specified by "-d " + If the target directory does not exist, the whole tree will be + created. diff --git a/src/filesys.c b/src/filesys.c index 873f891..8e40c52 100644 --- a/src/filesys.c +++ b/src/filesys.c @@ -24,7 +24,9 @@ /*Header Definitions*/ #include "fits2jpeg.h" -/*---------------------------------------------------------------------------*/ +/*---------------------------------------------------------------------------* + * MAKE_DIR: Wrapper to mkdir() with some basic error checks + *---------------------------------------------------------------------------*/ int make_dir(char * folder, mode_t mode) { struct stat st; @@ -41,6 +43,10 @@ int make_dir(char * folder, mode_t mode) return status; } +/*---------------------------------------------------------------------------* + * MAKE_TREE: moves through a directory path and creates directories and + * subdirectories using make_dir(), top-down. + *---------------------------------------------------------------------------*/ int make_tree(char * folder, mode_t mode) { char *pp; @@ -65,6 +71,9 @@ int make_tree(char * folder, mode_t mode) return status; } +/*---------------------------------------------------------------------------* + * STRDUP: This one is not a part of ANSI-strict, so we had to write one + *---------------------------------------------------------------------------*/ char *strdup(const char *str) { int n = strlen(str) + 1; diff --git a/src/image.c b/src/image.c index 7f7a8e8..819158b 100644 --- a/src/image.c +++ b/src/image.c @@ -24,6 +24,9 @@ /*Header Definitions*/ #include "fits2jpeg.h" +/*---------------------------------------------------------------------------* + * READ_FITS: To reads data from a fits image file.. (isn't that obvious?) + *---------------------------------------------------------------------------*/ void read_fits(char * fits_file_name, long * xdim, long * ydim, float ** data) { fitsfile *fptr; @@ -80,7 +83,7 @@ void scale_pixels(int scale, unsigned int npixels, float *data, scl_data = (datamax - datamin)/(float)JMAXVAL; /* we will end up with segfaults if scl_data = 0 */ - if (scl_data = 0) scl_data = 1; + if (scl_data == 0) scl_data = 1; for (i = 0; i < npixels; ++i) data[i] = (data[i] - datamin)/scl_data;