Create an Image and populate it with image data decoded either from a pixmap, a data buffer, or a file.
var image1 = new mupdf.Image(pixmap, imagemask)
var image2 = new mupdf.Image(buffer, imagemask)
var image3 = new mupdf.Image("logo.png", imagemask)Get the image width in pixels.
var width = image.getWidth()Get the image height in pixels.
var height = image.getHeight()Returns the x resolution for the Image in dots per inch.
var xRes = image.getXResolution()Returns the y resolution for the Image in dots per inch.
var yRes = image.getYResolution()Returns the ColorSpace for the Image. Returns null if the image has no colors (for example if it is an opacity mask with only an alpha channel).
var cs = image.getColorSpace()Number of colors; plus one if an alpha channel is present.
var num = image.getNumberOfComponents()Returns the number of bits per component.
var bits = image.getBitsPerComponent()Returns true if this image is an image mask.
var hasMask = image.getImageMask()Get another Image used as a mask for this one.
var mask = image.getMask()only mutool run
Returns whether interpolation was used during decoding.
var interpolate = image.getInterpolate()only mutool run
Returns an array with 2 * getNumberOfComponents()
integers for an image with color key masking, or null if
masking is not used. Each pair of integers define an interval, and
component values within those intervals are not painted.
var result = image.getColorKey()only mutool run
Returns an array with 2 * getNumberOfComponents()
numbers for an image with color mapping, or null if mapping
is not used. Each pair of numbers define the lower and upper values to
which the component values are mapped linearly.
var arr = image.getDecode()only mutool run
Returns the orientation of the image.
var orientation = image.getOrientation()only mutool run
Set the image orientation to the given orientation.
orientation (number) –
Orientation value described in this table:
| Value | Description |
|---|---|
| 0 | Undefined |
| 1 | 0 degree ccw rotation. (Exif = 1) |
| 2 | 90 degree ccw rotation. (Exit = 8) |
| 3 | 180 degree ccw rotation. (Exif = 3) |
| 4 | 270 degree ccw rotation. (Exif = 6) |
| 5 | flip on X. (Exif = 2) |
| 6 | flip on X, then rotate ccw by 90 degrees. (Exif = 5) |
| 7 | flip on X, then rotate ccw by 180 degrees. (Exif = 4) |
| 4 | flip on X, then rotate ccw by 270 degrees. (Exif = 7) |
Create a Pixmap from this image. The
scaledWidth and scaledHeight arguments are
optional, but may be used to decode a down-scaled Pixmap.
number)number)var pixmap = image.toPixmap()
var scaledPixmap = image.toPixmap(100, 100)