Fred's ImageMagick Scripts
|
Downsizes (reduces) an image to a specified file size. |
last modified: December 24, 2009
|
USAGE: downsize [-s size] [-t toler] [-c copy] infile outfile
-s .... size ........ desired output file size in kilobytes; float>0; PURPOSE: To downsize (reduce) an image to a specified file size. DESCRIPTION: DOWNSIZE reduces an image's dimensions to achieve a specified file size. Typically the process results in a file size that is slightly larger than desired. So the process is iterated until some tolerance is achieved. From limited experience, the first pass will usually be within 10% of the desired size and the second pass will get to within 1%. If the input image is smaller than the desired filesize, then the user may choose to copy the input to the output or just skip processing the input image. ARGUMENTS: -s size ... SIZE is the desired output image size in kilobytes. Values are floats>0. The default=200 -t toler ... TOLER is allowed size of the result greater than the desire size expressed as a percent of the desired size. Values are floats>=0. The default=1. Processing will iterate until the resulting image size is less than the desired size plus the tolerance. If the tolerance is 0, then iteration continues until the output size is actually less the desired size, but this may take many iterations and thus longer processing times. From limited experience, the first pass will usually be within 10% of the desired size and the second pass will usually be within 1%. -c copy ... COPY will copy the input to the output when the desired size is not less than the input size for input and output have the same file format; Values are either: yes (y) or no (n); default=yes CAVEAT: No guarantee that this script will work on all platforms, nor that trapping of inconsistent parameters is complete and foolproof. Use At Your Own Risk. |
|
Original: |
|
|
Arguments: |
|
|
|
What the script does is as follows:
This is equivalent to the following IM commands for the default case
|