00001
00002
00003
00004
00005 import globals
00006
00007 def command_line_help():
00008 """Prints command line help, invoked by --help command or wrong input.
00009 """
00010 print "IMGCrush", globals.VERSION
00011 print "Copyright (C) 2009 Ferdinand Majerech"
00012 print "Usage: imgcrush [OPTION...] [FILE/DIR...]"
00013 print "Optimizes images for size"
00014 print " -h --help display this help and exit"
00015 print " -o --out-dir val directory to save optimized images to"
00016 print " default: ./optimized/"
00017 print " -t --temp-dir val directory to save temp files to"
00018 print " default: ./temp/"
00019 print " -q --quiet less verbose output -it's possible to use"
00020 print " this multiple times, like -qq , for even less"
00021 print " verbosity. -q will only output warnings and"
00022 print " errors, -qq will only output errors,"
00023 print " -qqq will output nothing"
00024 print " -v --verbose more verbose output -works like -q"
00025 print " -m --prc-mult val Process multiplier. Number of processes"
00026 print " used is by default --prc-mult x 3, although"
00027 print " only one process is used when --prc-mult is 0."
00028 print " For example:"
00029 print " --prc-mult 0 : 1 process is used"
00030 print " --prc-mult 1 : 3 processes are used"
00031 print " --prc-mult 2 : 6 processes are used"
00032 print " --prc-mult 5 : 15 processes are used"
00033 print " It is recommended to set --prc-mult to number"
00034 print " of cores in your CPU."
00035 print " Default: number of CPUs on user's machine"
00036 print " or 2 if it could not be detected."
00037 print " -r --recur Process directories recursively."
00038 print " If a directory is given to optimize, files"
00039 print " in its subdirectories will be optimized as well."
00040 print "\nFormat options:"
00041 print " -j --jpg use JPG format"
00042 print " default: false"
00043 print " -p --png use PNG format"
00044 print " default: false"
00045 print " -g --gif use GIF format"
00046 print " default: false"
00047 print "\nJPG specific options:"
00048 print " -J --j-set val profile of jpg optimization."
00049 print " --j-set sets all jpg settings so other jpg"
00050 print " commands are not needed, although they can"
00051 print " be used to override profile's settings."
00052 print " possible values:"
00053 print " extreme -best results,no speed optimizations,"
00054 print " extremely slow"
00055 print " heavy -same results as extreme, some speed"
00056 print " optimizations, very slow"
00057 print " medium -almost as good as heavy, more speed"
00058 print " optimizations, slow"
00059 print " light -almost as good as medium, faster"
00060 print " fastest -worse results than light, fastest"
00061 print " default: light"
00062 print " -U --j-qual val minimum quality used (1-100)"
00063 print " default: 1"
00064 print " -T --j-step val step to increment quality by, i.e."
00065 print " quality 50 with step 10 means quality"
00066 print " 50,60...100 will be used (1-99)"
00067 print " default: 6"
00068 print " -D --j-inter use interlacing (progressive files)"
00069 print " this usually improves size. Enabled by default."
00070 print " -O --j-optim use jpg compression optimization -this"
00071 print " usually improves size. Enabled by default."
00072 print " -K --j-gray use grayscale images"
00073 print " -Z --j-s-fact val subsampling factors to use for jpg"
00074 print " possible values:"
00075 print " standard -use most common factors:"
00076 print " 1x1,2x1 and 2x2"
00077 print " all -use all available factors."
00078 print " fac1,fac2,fac3 -comma separated list of"
00079 print " factors, e.g:"
00080 print " --j-s-fact 1x1,1x2,1x4"
00081 print " available factors:"
00082 print " 1x1,1x2,1x4,2x1,2x2,2x4,4x1,4x2"
00083 print " default: standard"
00084 print " -A --j-opt-lv val level of speed optimizations to use."
00085 print " 0 -no optimizations"
00086 print " 1 -lossless optimizations (results same as 0)"
00087 print " 2 -more optimizations with minimally worse "
00088 print " result"
00089 print " 3 -even more optimizations, somewhat worse"
00090 print " 4 -all optimizations (much faster, but worse)"
00091 print " default: 3"
00092 print "\nPNG specific options:"
00093 print " -P --p-set val profile of png optimization."
00094 print " pngall sets all png settings so other png"
00095 print " commands are not needed, although they can"
00096 print " be used to override profile's settings."
00097 print " possible values:"
00098 print " extreme -best results,no speed optimizations,"
00099 print " extremely slow"
00100 print " heavy -same results as extreme, some speed"
00101 print " optimizations, very slow"
00102 print " medium -not as good results, more speed"
00103 print " optimizations, slow"
00104 print " light -worse results, faster"
00105 print " fastest -worst results, fastest"
00106 print " default: light"
00107 print " -L --p-lev val minimum compression level used (0-9)"
00108 print " default: 3"
00109 print " -H --p-filt val string of filters used, i.e. to use"
00110 print " filters 0, 1 and 3 write --pngfilt 013"
00111 print " possible values:"
00112 print " 0 -no filter -best for indexed images"
00113 print " 1 -sub"
00114 print " 2 -up"
00115 print " 3 -average"
00116 print " 4 -paeth -good for truecolor images"
00117 print " 5 -adaptive when level>5 and indexed"
00118 print " 6 -adaptive -best for truecolor"
00119 print " default: 046"
00120 print " -X --p-no-tru do not generate truecolor images"
00121 print " -Y --p-pal val minimum bit depth to use for indexed"
00122 print " images -if 0, don't use indexed images"
00123 print " possible values: 1,2,4,8"
00124 print " default: 4"
00125 print " -R --p-gray val minimum bit depth to use for grayscale"
00126 print " images -if 0, don't use grayscale "
00127 print " possible values: 2,4,8"
00128 print " default: 4"
00129 print " -E --p-inter use interlacing -allows images to be"
00130 print " loaded progressively, usually worsens"
00131 print " size, so it's unlikely that the optimization"
00132 print " output will be interlaced"
00133 print " -B --p-opt-lv val level of speed optimizations to use."
00134 print " 0 -no optimizations"
00135 print " 1 -lossless optimizations (results same as 0)"
00136 print " 2 -more optimizations with minimally worse "
00137 print " result"
00138 print " 3 -even more optimizations, somewhat worse"
00139 print " 4 -all optimizations (much faster, but worse)"
00140 print " default: 3"
00141 print "\nGIF specific options:"
00142 print " -G --g-set val profile of gif optimization."
00143 print " gifall sets all gif settings so other gif"
00144 print " commands are not needed, although they can"
00145 print " be used to override profile's settings."
00146 print " possible values:"
00147 print " extreme -best results,no speed optimizations,"
00148 print " extremely slow"
00149 print " heavy -same results as extreme, some speed"
00150 print " optimizations, very slow"
00151 print " medium -not as good results, more speed"
00152 print " optimizations, slow"
00153 print " light -worse results, faster"
00154 print " fastest -worst results, fastest"
00155 print " default: light"
00156 print " -F --g-inter use interlaced files (progressive) -usually"
00157 print " increases file size so it's unlikely that"
00158 print " optimization output will be interlaced."
00159 print " -I --g-depth val minimum bit depth to use for GIF"
00160 print " possible values: 1,2,3,4,5,6,7,8"
00161 print " default: 5"
00162 print " -C --g-opt-lv val level of speed optimizations to use."
00163 print " 0 -no optimizations"
00164 print " 1 -lossless optimizations (results same as 0)"
00165 print " 2 -more optimizations with minimally worse "
00166 print " result"
00167 print " 3 -even more optimizations, somewhat worse"
00168 print " 4 -all optimizations (much faster, but worse)"
00169 print " default: 3"
00170 print "\nOptimization related options:"
00171 print " -N --no-strip do not strip metadata (author, comments etc.)"
00172 print " -M --mode val mode of optimization,possible values:"
00173 print " q -optimize to quality, i.e. output "
00174 print " will be the smallest file with at"
00175 print " least the given quality"
00176 print " s -optimize to size,i.e. output'll be"
00177 print " best image with at most given size"
00178 print " -Q --min-qual val only applies in q mode: minimum quality"
00179 print " the output can have set in %, e.g."
00180 print " --min-qual 100.0% -100% means lossless"
00181 print " quali level of speed optimizations to use."
00182 print " 0 -no optimizations"
00183 print " 1 -lossless optimizations (results same as 0)"
00184 print " ty can also be given subjectively in "
00185 print " range from 0 to 100 without the % sign, e.g."
00186 print " --min-qual 99.2 ,in this case it's much"
00187 print " closer to jpg quality."
00188 print " default:100%"
00189 print " -S --max-size val only applies in s mode: maximum size the"
00190 print " output can have set in kiB,MiB,GiB,bytes,"
00191 print " % or average bits per pixel."
00192 print " e.g. --max-size 50.1kiB ,or --max-size 51303"
00193 print " when in %, e.g. --max-size 50.5%, the size is"
00194 print " computed as percentage f size of input file,"
00195 print " when % is prefixed by r,e.g. --max-size 50.5r%"
00196 print " size of computed as percentage of size of "
00197 print " reference file, a png file generated during"
00198 print " optimization. When using bits "
00199 print " per pixel,e.g. --max-size 2.4bpp"
00200 print " ,the maximum filesize of the image will be "
00201 print " image area * given value in bits, i.e. a"
00202 print " 1024x1024 image with --max-size 2bpp will"
00203 print " take up at most 2Mb or 256kiB ."
00204 print " default:50%"
00205 print "\nResizing related options: (DEPRECATED)"
00206 print " Note that by default, resizing preserves"
00207 print " aspect ratio, so width and height are"
00208 print " maximum bounds of the resized image. This can"
00209 print " be changed by the --stretch option."
00210 print " If only one of width and height will be"
00211 print " specified, image will be resized to that width"
00212 print " or height, changing the other dimension to"
00213 print " preserve aspect ratio"
00214 print " -W --width val width of output images in px or %, e.g.:"
00215 print " -w 20 or -w 20%. 0 means no resizing"
00216 print " default:0"
00217 print " -H --height val height of output images in px or %, e.g.:"
00218 print " -h 20 or -h 20%. 0 means no resizing"
00219 print " default:0"
00220 print " -s --stretch if resized image doesn't fit given width"
00221 print " and height (has a different aspect ratio),"
00222 print " stretch the image to fill given width/height."