Method Image.JPEG.encode()
- Method encode
stringencode(objectimage)
stringencode(string|objectimage,mappingoptions)- Description
Encodes an
imageobject with JPEG compression. The image may also be a string containing a raw JPEG image. In the Theoptionsargument may be a mapping containing zero or more encoding options:"quality":int(0..100)Set quality of result. Default is 75.
"optimize":boolOptimize Huffman table. Default is on (1) for images smaller than 50kpixels.
"progressive":boolMake a progressive JPEG. Default is off (0).
"grayscale":boolMake a grayscale JPEG instead of color (YCbCr).
"smooth":int(1..100)Smooth input. Value is strength.
"method":intDCT method to use. Any of IFAST, ISLOW, FLOAT, DEFAULT or FASTEST. DEFAULT and FASTEST is from the jpeg library, probably ISLOW and IFAST respectively.
"density_unit":int(0..2)The unit used for x_density and y_density.
0No unit
1dpi
2dpcm
"x_density":intDensity of image.
"y_density":int"comment":stringComment to be written in the JPEG file. Must not be a wide string.
"baseline":boolForce baseline output. Useful for quality<25. Default is off for quality<25.
"quant_tables":mapping(int:array(array(int)))Tune quantisation tables manually.
"marker":mapping(int:string(8bit)|array(string(8bit)))Application and comment markers; the integer should be one of Marker.COM, Marker.APP0, Marker.APP1, ..., Marker.APP15. The string is up to the application; most notable are Adobe and Photoshop markers.
"transform":intLossless image transformation. Has only effect when supplying a JPEG file as indata.
FLIP_HFlip image horizontally
FLIP_VFlip image vertically
ROT_90Rotate image 90 degrees clockwise
ROT_180Rotate image 180 degrees clockwise
ROT_270Rotate image 270 degrees clockwise
TRANSPOSETranspose image
TRANSVERSETransverse image
- Note
Please read some about JPEG files. A quality setting of 100 does not mean the result is lossless.