edcdc68e062802618e32ebb6efa86e22180b2762
1 /***************************************************************************
2  * This file is a part of CADS/UVS fits2jpeg conversion software           *
3  *   Copyright (C) 2012 by CADS/UV Software Team,                          *
4  *                         Indian Institute of Astrophysics                *
5  *                         Bangalore 560034                                *
6  *                         cads_AT_iiap.res.in                             *
7  *                                                                         *
8  *   This program is free software; you can redistribute it and/or modify  *
9  *   it under the terms of the GNU General Public License as published by  *
10  *   the Free Software Foundation; either version 2 of the License, or     *
11  *   (at your option) any later version.                                   *
12  *                                                                         *
13  *   This program is distributed in the hope that it will be useful,       *
14  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
15  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
16  *   GNU General Public License for more details.                          *
17  *                                                                         *
18  *   You should have received a copy of the GNU General Public License     *
19  *   along with this program; if not, write to the                         *
20  *   Free Software Foundation, Inc.,                                       *
21  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
22  ***************************************************************************/
24 /*Header Definitions*/
25 #include "fits2jpeg.h"
27 /*---------------------------------------------------------------------------*/
28 void PRINT_BANNER()
29 {
30     printf("\n");
31     printf(" %s %s\n", PROGRAM, VERSION);
32     printf(" Converts fits image files to jpeg\n");
33     printf("-----------------------------------------------------------\n");
34 }
35 /*---------------------------------------------------------------------------*/
36 void usage()
37 {
38     printf ("\n Usage: fits2jpeg [options] <fits_file>\n");
39     printf ("  Options are:                                             \n");
40     printf ("    -h help                                                \n");
41     printf ("    -s <scale_type>                                        \n");
42     printf ("       scale for output image, where <scale_type> can be:  \n");
43     printf ("         linear         Linear scale, default              \n");
44     printf ("         sqroot         for square root scale              \n");
45     printf ("         square         for quadratic scale                \n");
46     printf ("         cubic          for cubic scale                    \n");
47     printf ("         log            for log scale                      \n");
48     printf ("         normalize      for linear histogram stretch       \n");
49     printf ("         equalize       for histogram equalization         \n");
50     printf ("    -r <min>:<max>                                         \n");
51     printf ("       Clip output image to min-max range. Eg:             \n");
52     printf ("         0:100          Use only values in the range 0-100 \n");
53     printf ("         100:0          Same as above, but negative image  \n");
54     printf ("           :10          Clip everything above 10           \n");
55     printf ("         10:            Clip everything below 10           \n");
56     printf ("    -n                                                     \n");
57     printf ("       Negate the image                                    \n");
58     printf ("    -q <value>                                             \n");
59     printf ("       quality factor. Defines the jpeg encoding quality   \n");
60     printf ("       Valid range: 0-100, default value: 100 (max.quality)\n");
61     printf ("    -z <zoomfactor>                                        \n");
62     printf ("       Resize/Scale output image by <zoomfactor>. Eg:      \n");
63     printf ("         0.5            Shrink output to half of input     \n");
64     printf ("         2.0            Magnify output to double the size  \n");
65     printf ("  Output will be written to <fits_file_root>.jpg. Wild card\n");
66     printf ("  entries allowed in <fits_file>; For eg: *.fits, m31*.fits\n");
67     printf ("  ngc???.fits etc.                                         \n");
68     printf ("-----------------------------------------------------------\n");
69     printf ("Copyright (c) 2012 The CADS Team, IIAp. [GPL v3.0 or later]\n");
70     printf ("Report Bugs to: http://cads.iiap.res.in/bugzilla           \n");
71     printf ("Documentation : http://cads.iiap.res.in/software         \n\n");
72     exit(1);
73 }
75 void printinfo(const char * msg)
76 {
77     fprintf(stdout, "INFO   : %s\n", msg);
78 }
80 void printwarn(const char * msg)
81 {
82     fprintf(stdout, "WARNING: %s\n", msg);
83 }
85 void printerro(const char * msg)
86 {
87     fprintf(stderr, "ERROR  : %s\n", msg);
88     exit(EXIT_FAILURE);
89 }