Pike v8.0 release 1738

Method Image.Dims.get()


Method get

array(int) get(string|Stdio.File file, bool|void exif)

Description

Read dimensions from a JPEG, GIF, PNG, TIFF or PSD file and return an array with width and height, or if the file isn't a valid image, 0. The argument file should be file object or the data from a file. The offset pointer will be assumed to be at the start of the file data and will be modified by the function.

As a compatibility measure, if the file is a path to an image file, it will be loaded and processed once the processing of the path as data has failed.

Returns
Array
int 0

Image width.

int 1

Image height.

string 2

Image type. Any of "gif", "png", "tiff", "jpeg" and "psd".