Pike v8.1 release 6

Method Image.JPEG.decode_header()


Method decode_header

object decode(string data)
object decode(string data, mapping options)
mapping _decode(string data)
mapping _decode(string data, mapping options)
mapping decode_header(string data)

Description

Decodes a JPEG image. The simple decode function simply gives the image object, the other functions gives a mapping of information (see below).

The options argument may be a mapping containing zero or more decoding options:

"block_smoothing" : bool

Do interblock smoothing. Default is on (1).

"fancy_upsampling" : bool

Do fancy upsampling of chroma components. Default is on (1).

"method" : int

DCT method to use. Any of IFAST, ISLOW, FLOAT, DEFAULT or FASTEST. DEFAULT and FASTEST is from the jpeg library, probably ISLOW and IFAST respective.

"scale_num" : int(1..)

Rescale the image when read from JPEG data. My (Mirar) version (6a) of jpeglib can only handle 1/1, 1/2, 1/4 and 1/8.

"scale_denom" : int(1..)

_decode and decode_header gives a mapping as result, with this content:

"comment" : string

Comment marker of JPEG file, if present.

"xsize" : int

Size of image

"ysize" : int
"xdpi" : float

Image dpi, if known.

"ydpi" : float
"type" : string

File type information as MIME type. Always "image/jpeg".

"num_compontents" : int

Number of channels in JPEG image.

"color_space" : string

Color space of JPEG image. Any of "GRAYSCALE", "RGB", "YUV", "CMYK", "YCCK" or "UNKNOWN".

"density_unit" : int(0..2)

The unit used for x_density and y_density.

0

No unit

1

dpi

2

dpcm

"x_density" : int

Density of image.

"y_density" : int
"adobe_marker" : bool

If the file has an Adobe marker.

"quant_tables" : mapping(int:array(array(int)))

JPEG quant tables.

"quality" : int(0..100)

JPEG quality guess.

"marker" : mapping(int(8bit):string(8bit)|array(string(8bit)))

Mapping from application and comment markers to their values.