Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

jpegtran(1) [php man page]

jpegtran(1)							   User Commands						       jpegtran(1)

NAME
jpegtran - lossless transformation of JPEG files SYNOPSIS
jpegtran [options] [filename] DESCRIPTION
jpegtran performs various useful transformations of JPEG files. jpegtran can translate the coded representation from one variant of JPEG to another, for example from baseline JPEG to progressive JPEG or vice versa. jpegtran 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, jpegtran transfor- mations 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. However, 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 options may be abbreviated. For example, -optimize may be written -opt or -o. Upper and lower case are equivalent. British spellings are also accepted. For example, -optimise. The following options are supported: -copy all Copy all extra markers. This option preserves miscellaneous markers found in the source file, such as JFIF thumbnails and source-application settings. In some files, these extra markers can be sizable. -copy comments Copy only comment markers. This option copies comments from the source file, but discards any other inessential data. This is the default. -copy none Copy no extra markers from the source file. This option suppresses all comments and other excess information present in the source file. -flip horizontalCreate a mirror image horizontally, that is, from left to right. This is a lossless transformation. -flip vertical Create a mirror image vertically, that is, from top to bottom. This is a lossless transformation. -grayscale Force grayscale output. This is not a lossless transformation. For more information about the -grayscale option, see the Extended Description section. -maxmemory N Set the limit for the amount of memory to use in processing large images. N is specified in thousands of bytes, or in mil- lions of bytes if "M" is specified with the number. For example, -max 4m selects 4000000 bytes. If more space is needed, temporary files are used. -optimize Optimize the entropy encoding parameters. For more information about the -optimize option, see cjpeg(1). -outfile name Send the output image to the named file, instead of to the standard output. -progressive Create a progressive JPEG file. For more information about the -progressive option, see cjpeg(1). -restart N Emit a JPEG restart marker every N MCU rows, or every N MCU blocks if "B" is specified with the number. For more informa- tion about the -restart option, see cjpeg(1). -rotate 90 Rotate the image 90 degrees clockwise. This is a lossless transformation. -rotate 180 Rotate the image 180 degrees clockwise. This is a lossless transformation. -rotate 270 Rotate the image 270 degrees clockwise, or 90 degrees anticlockwise. This is a lossless transformation. -scans file Use the scan script provided in the specified text file. -transpose Transpose the image, that is, across the UL-to-LR axis. This is a lossless transformation. For more information about the -transpose option, see the Extended Description section. -transverse Transverse transpose the image, that is, across the UR-to-LL axis. This is a lossless transformation. -trim Drop non-transformable edge blocks. This is not a lossless transformation. For more information about the -trim option, see the Extended Description section. -verbose Display version information at startup, and enable debug printout. The -vv option displays more verbose output than the -v option. The -vvv option displays the most verbose output. You can also use -debug to specify this option. OPERANDS
The following operands are supported: filename The name of the JPEG file to be transformed. EXTENDED DESCRIPTION
If you do not specify one of the following options, you get a plain baseline-JPEG output file: -optimize, -progressive, -restart N, -scans file. In such cases, the quality setting and other settings are determined by the input file. Lossless Transformations The transpose transformation has no restrictions as regards image dimensions. The other transformations operate rather oddly if the image dimensions are not a multiple of the iMCU siz, usually 8 or 16 pixels, because they can only transform complete blocks of DCT coefficient data in the desired way. The default behavior when transforming an odd-size image is designed to preserve exact reversibility and mathemat- ical consistency of the transformation set. As stated, transpose can 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. Not-Lossless Transformations You may prefer to discard any untransformable edge pixels rather than have a strange-looking strip along the right or bottom edges of a transformed image. To do this, use the -trim option. Obviously, a transformation with -trim is not reversible, so strictly speaking jpeg- tran with this option is not lossless. Also, the expected mathematical equivalences between the transformations no longer hold. For exam- ple, -rot 270 -trim trims only the bottom edge, but -rot 90 -trim followed by -rot 180 -trim trims both edges. Another not-strictly-lossless transformation option is -grayscale. This option discards the chrominance channels if the input image is YCbCr (that is, a standard color JPEG), which results 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. The -grayscale option is particularly useful for fixing a monochrome picture that was mistakenly encoded as a color JPEG. In such a case, the space saved by discarding the near-empty chrominance channels is not large, but the decoding time for a grayscale JPEG is substantially less than that for a color JPEG. EXAMPLES
Example 1: Converting a Baseline JPEG File to Progressive Form example% jpegtran -progressive test.jpg > testprog.jpg Example 2: Rotating an Image 90 Degrees Clockwise, Discarding Any Unrotatable Edge Pixels example% jpegtran rot 90 -trim test.jpg > test90.jpg ENVIRONMENT VARIABLES
jpegtran uses the following environment variables: JPEGMEM The value of this environment variable, if set, is the default memory limit. The value is specified as described for the -maxmemory option. JPEGMEM overrides the default value specified when the program was compiled, and is in turn overridden by an explicit -maxmemory option. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWjpg | +-----------------------------+-----------------------------+ |Interface stability |External | +-----------------------------+-----------------------------+ SEE ALSO
Wallace, Gregory K., The JPEG Still Picture Compression Standard Communications of the ACM, April 1991 (vol. 34, no. 4), pp. 30-44. cjpeg(1), djpeg(1), rdjpgcom(1), wrjpgcom(1) NOTES
Arithmetic coding is not supported. The entire image is read into memory and then written out again, even in cases where this is not really necessary. Expect swapping on large images, especially when using the more complex transform options. This man page was originally written by the Independent JPEG Group. Updated by Breda McColgan, Sun Microsystems Inc., 2004. SunOS 5.10 26 Mar 2004 jpegtran(1)
Man Page