Home
Main website
Display Sidebar
Hide Ads
Recent Changes
View Source:
jpegtran(1)
Edit
PageHistory
Diff
Info
LikePages
JPEGTRAN !!!JPEGTRAN NAME SYNOPSIS DESCRIPTION OPTIONS EXAMPLES ENVIRONMENT SEE ALSO AUTHOR BUGS ---- !!NAME jpegtran - lossless transformation of JPEG files !!SYNOPSIS __jpegtran__ [[ ''options'' ] [[ ''filename'' ] !!DESCRIPTION __jpegtran__ performs various useful transformations of JPEG files. It can translate the coded representation from one variant of JPEG to another, for example from baseline JPEG to progressive JPEG or vice versa. It can also perform some rearrangements of the image data, for example turning an image from landscape to portrait format by rotation. __jpegtran__ works by rearranging the compressed data (DCT coefficients), without ever fully decoding the image. Therefore, its transformations are lossless: there is no image degradation at all, which would not be true if you used __djpeg__ followed by __cjpeg__ to accomplish the same conversion. But by the same token, __jpegtran__ cannot perform lossy operations such as changing the image quality. __jpegtran__ reads the named JPEG/JFIF file, or the standard input if no file is named, and produces a JPEG/JFIF file on the standard output. !!OPTIONS All switch names may be abbreviated; for example, __-optimize__ may be written __-opt__ or __-o__. Upper and lower case are equivalent. British spellings are also accepted (e.g., __-optimise__), though for brevity these are not mentioned below. To specify the coded JPEG representation used in the output file, __jpegtran__ accepts a subset of the switches recognized by __cjpeg__: __-optimize__ Perform optimization of entropy encoding parameters. __-progressive__ Create progressive JPEG file. __-restart__ ''N'' Emit a JPEG restart marker every N MCU rows, or every N MCU blocks if __-scans__ ''file'' Use the scan script given in the specified text file. See cjpeg(1) for more details about these switches. If you specify none of these switches, you get a plain baseline-JPEG output file. The quality setting and so forth are determined by the input file. The image can be losslessly transformed by giving one of these switches: __-flip horizontal__ Mirror image horizontally (left-right). __-flip vertical__ Mirror image vertically (top-bottom). __-rotate 90__ Rotate image 90 degrees clockwise. __-rotate 180__ Rotate image 180 degrees. __-rotate 270__ Rotate image 270 degrees clockwise (or 90 ccw). __-transpose__ Transpose image (across UL-to-LR axis). __-transverse__ Transverse transpose (across UR-to-LL axis). The transpose transformation has no restrictions regarding image dimensions. The other transformations operate rather oddly if the image dimensions are not a multiple of the iMCU size (usually 8 or 16 pixels), because they can only transform complete blocks of DCT coefficient data in the desired way. __jpegtran__'s default behavior when transforming an odd-size image is designed to preserve exact reversibility and mathematical consistency of the transformation set. As stated, transpose is able to flip the entire image area. Horizontal mirroring leaves any partial iMCU column at the right edge untouched, but is able to flip all rows of the image. Similarly, vertical mirroring leaves any partial iMCU row at the bottom edge untouched, but is able to flip all columns. The other transforms can be built up as sequences of transpose and flip operations; for consistency, their actions on edge pixels are defined to be the same as the end result of the corresponding transpose-and-flip sequence. For practical use, you may prefer to discard any untransformable edge pixels rather than having a strange-looking strip along the right and/or bottom edges of a transformed image. To do this, add the __-trim__ switch: __-trim__ Drop non-transformable edge blocks. Obviously, a transformation with __-trim__ is not reversible, so strictly speaking __jpegtran__ with this switch is not lossless. Also, the expected mathematical equivalences between the transformations no longer hold. For example, __-rot 270 -trim__ trims only the bottom edge, but __-rot 90 -trim__ followed by __-rot 180 -trim__ trims both edges. We also offer a lossless-crop option, which discards data outside a given image region but losslessly preserves what is inside. Like the rotate and flip transforms, lossless crop is restricted by the JPEG format: the upper left corner of the selected region must fall on an iMCU boundary. If this does not hold for the given crop parameters, we silently move the upper left corner up and/or left to make it so, simultaneously increasing the region dimensions to keep the lower right crop corner unchanged. (Thus, the output image covers at least the requested region, but may cover more.) Note: lossless-crop is an enhancement from http://sylvana.net/jpegcrop/ that may not be available on non-Debian systems. The image can be losslessly cropped by giving the switch: __-crop WxH+X+Y__ Crop to a rectangular subarea of width W, height H starting at point X,Y. Another not-strictly-lossless transformation switch is: __-grayscale__ Force grayscale output. This option discards the chrominance channels if the input image is YCbCr (ie, a standard color JPEG), resulting in a grayscale JPEG file. The luminance channel is preserved exactly, so this is a better method of reducing to grayscale than decompression, conversion, and recompression. This switch is particularly handy for fixing a monochrome picture that was mistakenly encoded as a color JPEG. (In such a case, the space savings from getting rid of the near-empty chroma channels won't be large; but the decoding time for a grayscale JPEG is substantially less than that for a color JPEG.) __jpegtran__ also recognizes these switches that control what to do with __ __-copy none__ Copy no extra markers from source file. This setting suppresses all comments and other excess baggage present in the source file. __-copy comments__ Copy only comment markers. This setting copies comments from the source file, but discards any other inessential data. __-copy all__ Copy all extra markers. This setting preserves miscellaneous markers found in the source file, such as JFIF thumbnails and Photoshop settings. In some files these extra markers can be sizable. The default behavior is __-copy comments__. (Note: in IJG releases v6 and v6a, __jpegtran__ always did the equivalent of __-copy none__.) Additional switches recognized by jpegtran are: __-maxmemory__ ''N'' Set limit for amount of memory to use in processing large images. Value is in thousands of bytes, or millions of bytes if -max 4m__ selects 4000000 bytes. If more space is needed, temporary files will be used. __-outfile__ ''name'' Send output image to the named file, not to standard output. __-verbose__ Enable debug printout. More __-v__'s give more output. Also, version information is printed at startup. __-debug__ Same as __-verbose__. !!EXAMPLES This example converts a baseline JPEG file to progressive form: __jpegtran -progressive__ ''foo.jpg'' ____ ''fooprog.jpg'' This example rotates an image 90 degrees clockwise, discarding any unrotatable edge pixels: __jpegtran -rot 90 -trim__ ''foo.jpg'' ____ ''foo90.jpg'' !!ENVIRONMENT __JPEGMEM__ If this environment variable is set, its value is the default memory limit. The value is specified as described for the __-maxmemory__ switch. __JPEGMEM__ overrides the default value specified when the program was compiled, and itself is overridden by an explicit __-maxmemory__. !!SEE ALSO cjpeg(1), djpeg(1), rdjpgcom(1), wrjpgcom(1) Wallace, Gregory K. !!AUTHOR Independent JPEG Group !!BUGS Arithmetic coding is not supported for legal reasons. The transform options can't transform odd-size images perfectly. Use __-trim__ if you don't like the results without it. The entire image is read into memory and then written out again, even in cases where this isn't really necessary. Expect swapping on large images, especially when using the more complex transform options. ----
8 pages link to
jpegtran(1)
:
Man1j
cjpeg(1)
djpeg(1)
jpegtopnm(1)
pnmtojpeg(1)
ppmtojpeg(1)
rdjpgcom(1)
wrjpgcom(1)
This page is a man page (or other imported legacy content). We are unable to automatically determine the license status of this page.