infinity.image¶
Offers various image creation and manipulation possibilities. Lets you load image data from files or create your own. Supports different formats, quantizing, dithering, tone mapping algorithms as well as manipulation of basic image properties. Offers comfort functions for thumbnail creation, resizing, cropping, rotating, flipping and combining images as well as inverting, extracting or combining colors.
Module: infinity.image
Example:
infinity.loadModule('infinity.image');
const WIDTH = 320;
const HEIGHT = 240;
let myImage = new infinity.image(infinity.image.type.bitmap, WIDTH, HEIGHT, 24);
myImage.fill(0x0000DDAA);
let color = 0x00CC0000;
const HWRATIO = HEIGHT / WIDTH;
for (let i = 0; i < WIDTH; i++){
//Diagonals
myImage.setPixel(i, i*HWRATIO, color);
myImage.setPixel(WIDTH-i, i*HWRATIO, color);
//Horizontal line
myImage.setPixel(i, HEIGHT/2, color);
//Vertical line
if( i <= HEIGHT ){
myImage.setPixel(WIDTH/2, i, color);
}
}
let myImage2 = new infinity.image();
myImage.copySubImage(140, 100, 180, 140, myImage2);
myImage.adjustGamma(1.5);
myImage.pasteSubImage(myImage2, 20, 20);
myImage.rotateEx(127, 0, -80, 160, 120, true);
myImage.saveToFile('image.bmp');
image¶
The class for working with images.
Properties:
Methods:
- constructor()
- constructor()
- adaptiveThreshold()
- adjustBrightness()
- adjustContrast()
- adjustGamma()
- assign()
- clear()
- colorQuantize()
- combineChannels()
- convertTo16Bits555()
- convertTo16Bits565()
- convertTo24Bits()
- convertTo32Bits()
- convertTo4Bits()
- convertTo8Bits()
- convertToGrayscale()
- convertToRgbf()
- convertToStandardType()
- convertToType()
- copySubImage()
- deskew()
- dither()
- fill()
- flipHorizontal()
- flipVertical()
- free()
- getChannel()
- getData()
- getMetaData()
- getPixel()
- getThumbnail()
- invert()
- isGrayscale()
- isTransparent()
- isValid()
- loadFromFile()
- loadFromStream()
- pasteSubImage()
- rescale()
- rotate()
- rotateEx()
- saveToFile()
- saveToStream()
- setChannel()
- setData()
- setPixel()
- setSize()
- setThumbnail()
- splitChannels()
- threshold()
- thumbnail()
- toneMapping()
Example:
infinity.loadModule('infinity.image');
let myImage = new infinity.image();
Properties
horzResolution¶
Type: number
Gets or sets the horizontal pixels per unit property.
vertResolution¶
Type: number
Gets or sets the vertical pixels per unit property.
bpp¶
Type: number
Gets the bits per pixel property.
color¶
Type: infinity.image.color
Gets the color model in use corresponding to the infinity.image.color
enum.
colorsUsed¶
Type: number
Gets the number of possible colors (0 for true-color).
height¶
Type: number
Gets the height of the picture in pixels.
scanWidth¶
Type: number
Gets the width in bytes of each scan line (row) of pixel data.
size¶
Type: number
Gets the file size in bytes.
type¶
Type: infinity.image.type
Gets the image type according to infinity.image.type
width¶
Type: number
Gets the image width in pixels.
Methods
constructor()¶
Lets you create an INFINITY.JS image file object instance with several parameters.
Signature:
constructor( type?: infinity.image.type, width?: number, height?: number, bpp?: number )
Parameters:
-
type:
infinity.image.type
, optionalImage type according to infinity.image.type.
-
width:
number
, optionalImage width in pixels.
-
height:
number
, optionalImage height in pixels.
-
bpp:
number
, optionalBits per pixel.
constructor()¶
Lets you create an INFINITY.JS image file object instance without parameters.
Signature:
constructor()
Example:
infinity.loadModule('infinity.image');
let myImage = new infinity.image();
myImage.loadFromFile('image.bmp');
myImage.convertToGrayscale();
myImage.dither(infinity.image.dither.fs);
myImage.saveToFile('image2.bmp');
adaptiveThreshold()¶
Converts an RGB 8-bit-color image to black and white using the adaptive threshold algorithm.
Signature:
adaptiveThreshold( s: number, t: number ): boolean
Parameters:
-
s:
number
Window size.
-
t:
number
Threshold value for black and white.
Return type: boolean
Example:
myImage.adaptiveThreshold(64, 128);
adjustBrightness()¶
Adjusts image brightness.
Signature:
adjustBrightness( percentage: number ): boolean
Parameters:
- percentage:
number
Adjustment extent in percent.
Return type: boolean
Example:
myImage.adjustBrightness(70);
adjustContrast()¶
Adjusts image contrast.
Signature:
adjustContrast( percentage: number ): boolean
Parameters:
- percentage:
number
Adjustment extent in percent.
Return type: boolean
Example:
myImage.adjustContrast(50);
adjustGamma()¶
Adjusts image gamma.
Signature:
adjustGamma( gamma: number ): boolean
Parameters:
- gamma:
number
The new gamma value.
Return type: boolean
Example:
myImage.adjustGamma(1.5);
assign()¶
Assigns the contents of another infinity.image object instance to the current object instance.
Signature:
assign( src: infinity.image ): void
Parameters:
- src:
infinity.image
The
infinity.image
object instance to assign the contents from.
Example:
let myImage = new infinity.image();
myImage.loadFromFile('image.bmp');
let myImage2 = new infinity.image();
myImage2.assign(myImage);
myImage2.saveToFile('image2.bmp');
clear()¶
Clears image data from the current object instance.
Signature:
clear(): void
Example:
myImage.clear();
colorQuantize()¶
Quantizates colors of the image data.
Signature:
colorQuantize( algorithm: infinity.image.quantize ): boolean
Parameters:
- algorithm:
infinity.image.quantize
The quantization algorithm to apply according to
infinity.image.quantize
.
Return type: boolean
Example:
myImage.colorQuantize(infinity.image.quantize.lfpQuant);
combineChannels()¶
Combines red, green, blue and alpha channels from other picture instances into one image.
Signature:
combineChannels( red: infinity.image, green: infinity.image, blue: infinity.image ): boolean
Parameters:
-
red:
infinity.image
Red channel.
-
green:
infinity.image
Green channel.
-
blue:
infinity.image
Blue channel.
Return type: boolean
Example:
myImage.combineChannels(myImage2Red, myImage2Green, myImage2Blue);
convertTo16Bits555()¶
Converts a bitmap to 16 bits, where each pixel has a color pattern of 5 bits red, 5 bits green and 5 bits blue. One bit in each pixel is unused.
Signature:
convertTo16Bits555(): boolean
Return type: boolean
Example:
myImage.convertTo16Bits555();
convertTo16Bits565()¶
Converts a bitmap to 16 bits, where each pixel has a color pattern of 5 bits red, 6 bits green and 5 bits blue.
Signature:
convertTo16Bits565(): boolean
Return type: boolean
Example:
myImage.convertTo16Bits565();
convertTo24Bits()¶
Converts a bitmap to 24 bits.
Signature:
convertTo24Bits(): boolean
Return type: boolean
Example:
myImage.convertTo24Bits();
convertTo32Bits()¶
Converts a bitmap to 32 bits.
Signature:
convertTo32Bits(): boolean
Return type: boolean
Example:
myImage.convertTo32Bits();
convertTo4Bits()¶
Converts a bitmap to 4 bits.
Signature:
convertTo4Bits(): boolean
Return type: boolean
Example:
myImage.convertTo4Bits();
convertTo8Bits()¶
Converts a bitmap to 8 bits.
Signature:
convertTo8Bits(): boolean
Return type: boolean
Example:
myImage.convertTo8Bits();
convertToGrayscale()¶
Converts a bitmap to 8-bit greyscale.
Signature:
convertToGrayscale(): boolean
Return type: boolean
Example:
myImage.convertToGrayscale();
convertToRgbf()¶
Converts the bitmap to a 96-bit RGBF image.
Signature:
convertToRgbf(): boolean
Return type: boolean
Example:
myImage.convertToRgbf();
convertToStandardType()¶
Converts an image with a color type other than 8-bit (e.g. floating point color formats) to 8-bit grey scale.
Signature:
convertToStandardType( scaleLinear: boolean ): boolean
Parameters:
- scaleLinear:
boolean
If
true
, then color values will be scaled linearly to values0
-255
. Iffalse
each value will be rounded to values0
-255
.
Return type: boolean
Example:
myImage.convertToStandardType(true);
convertToType()¶
Converts an image to the given color type.
Signature:
convertToType( type: infinity.image.type, scaleLinear: boolean ): boolean
Parameters:
-
type:
infinity.image.type
The image type according to
infinity.image.type
. -
scaleLinear:
boolean
If
true
, then color values will be scaled linearly to values0
-255
. Iffalse
each value will be rounded to values0
-255
.
Return type: boolean
Example:
myImage.convertToType(infinity.image.type.rgba16, false);
copySubImage()¶
Copies a sub part of the current image.
Signature:
copySubImage( left: number, top: number, right: number, bottom: number, dest: infinity.image ): boolean
Parameters:
-
left:
number
Specifies the left position of the cropped rectangle.
-
top:
number
Specifies the top position of the cropped rectangle.
-
right:
number
Specifies the right position of the cropped rectangle.
-
bottom:
number
Specifies the bottom position of the cropped rectangle.
-
dest:
infinity.image
An
infinity.image
object instance to hold the copied image.
Return type: boolean
Example:
myImage.copySubImage(140, 100, 180, 140, myImage2);
deskew()¶
Deskews an image automatically.
Signature:
deskew( s: number, t: number ): boolean
Parameters:
-
s:
number
The maximum deskew angle.
-
t:
number
Line detection threshold for the Hough lines algorithm.
Return type: boolean
Example:
myImage.deskew(10, 128);
dither()¶
Converts a bitmap to 1-bit monochrome bitmap using a dithering algorithm.
Signature:
dither( algorithm: infinity.image.dither ): boolean
Parameters:
- algorithm:
infinity.image.dither
The dithering algorithm according to
infinity.image.dither
.
Return type: boolean
Example:
myImage.dither(infinity.image.dither.fs);
fill()¶
Fills the area with the specified color.
Signature:
fill( color: number ): void
Parameters:
- color:
number
The color to be filled in.
Example:
myImage.fill(190904);
flipHorizontal()¶
Flips the image horizontally along the vertical axis.
Signature:
flipHorizontal(): boolean
Return type: boolean
Example:
myImage.flipHorizontal();
flipVertical()¶
Flips the image vertically along the horizontal axis.
Signature:
flipVertical(): boolean
Return type: boolean
Example:
myImage.flipVertical();
free()¶
Frees the memory previously occupied by the image object instance.
Signature:
free(): void
Example:
myImage.free();
getChannel()¶
Retrieves the specified channel of the image.
Signature:
getChannel( dest: infinity.image, channel: infinity.image.channel ): boolean
Parameters:
-
dest:
infinity.image
An
infinity.image
object instance to hold the output. -
channel:
infinity.image.channel
The color channel to extract according to
infinity.image.channel
.
Return type: boolean
Example:
myImage.getChannel(myImage2, infinity.image.channel.green);
getData()¶
Returns a pixel array out of the image.
Signature:
getData(): infinity.image.pixelArray
Return type: infinity.image.pixelArray
Example:
let pixelArray = myImage.getData();
pixelArray.forEach(element =>{
//...
});
getMetaData()¶
Returns metadata of the image.
Signature:
getMetaData(): any
Return type: any
Example:
let metaData = myImage.getMetaData();
console.debug(metaData);
getPixel()¶
Gets the Color of the specified pixel.
Signature:
getPixel( x: number, y: number ): number
Parameters:
-
x:
number
The horizontal coordinate in pixels.
-
y:
number
The vertical coordinate in pixels.
Return type: number
Example:
let color = myImage.getPixel(160, 120);
getThumbnail()¶
Retrieves a copy the thumbnail possibly attached to the image.
Signature:
getThumbnail( dest: infinity.image ): boolean
Parameters:
- dest:
infinity.image
An
infinity.image
object instance to hold the output.
Return type: boolean
Example:
myImage.getThumbnail(myThumbObj);
invert()¶
Inverts the colors of the given image.
Signature:
invert(): boolean
Return type: boolean
Example:
myImage.invert();
isGrayscale()¶
Returns TRUE if the image is a 8-bit bitmap with a greyscale palette, FALSE otherwise.
Signature:
isGrayscale(): boolean
Return type: boolean
Example:
if(myImage.isGrayscale()){
//...
}
isTransparent()¶
Returns whether transparency is enabled.
Signature:
isTransparent(): boolean
Return type: boolean
Example:
if(myImage.isTransparent()){
//...
}
isValid()¶
Returns TRUE if the image is allocated, FALSE otherwise.
Signature:
isValid(): boolean
Return type: boolean
Example:
if(myImage.isValid()){
//...
}
loadFromFile()¶
Loads the image from the specified file into the object instance.
Signature:
loadFromFile( fileName: string, flag?: number ): boolean
Parameters:
-
fileName:
string
Filename, relative path (location relative to the folder with the used INFINITY.JS executable file) or absolute path to the file which has to be loaded.
-
flag:
infinity.image.flag
, optionalOne of the
infinity.image.flag
enums.
Return type: boolean
Example:
myImage.loadFromFile('image.bmp');
loadFromStream()¶
Loads the image from the specified stream into the object instance.
Signature:
loadFromStream( stream: infinity.stream, flag?: number ): boolean
Parameters:
-
stream:
infinity.stream
Stream object to load from. See infinity.stream.
-
flag:
infinity.image.flag
, optionalOne of the
infinity.image.flag
enums.
Return type: boolean
Example:
myImage.loadFromStream(stream);
pasteSubImage()¶
Alpha blends or combines a sub part image with the current image.
Signature:
pasteSubImage( src: infinity.image, left: number, top: number, alpha?: number ): boolean
Parameters:
-
src:
infinity.image
Source subimage.
-
left:
number
Specifies the left position of the sub image.
-
top:
number
Specifies the top position of the sub image.
-
alpha:
number
, optionalAlpha blend factor. The source and destination images are alpha blended if alpha = 0..255. If alpha > 255, then the source image is combined to the destination image.
Return type: boolean
Example:
myImage.pasteSubImage(myImage2, 20, 20);
rescale()¶
Rescales the image to a new width / height.
Signature:
rescale( width: number, height: number, filter: infinity.image.filter, dest?: infinity.image ): boolean
Parameters:
-
width:
number
New image width.
-
height:
number
New image height.
-
filter:
infinity.image.filter
The filter parameter specifies which resampling filter should be used according to
infinity.image.filter
. -
dest:
infinity.image
, optionalAn
infinity.image
object instance to hold the output.
Return type: boolean
Example:
myImage.rescale(160, 120, infinity.image.filter.lanczos3);
rotate()¶
Rotates the image.
Signature:
rotate( angle: number ): boolean
Parameters:
- angle:
number
Image rotation angle, in degree.
Return type: boolean
Example:
myImage.rotate(90);
rotateEx()¶
Image translation and rotation using B-Splines.
Signature:
rotateEx( angle: number, xShift: number, yShift: number, xOrigin: number, yOrigin: number, useMask: boolean ): boolean
Parameters:
-
angle:
number
Image rotation angle, in degree.
-
xShift:
number
Image horizontal shift.
-
yShift:
number
Image vertical shift.
-
xOrigin:
number
Origin of the x-axis.
-
yOrigin:
number
Origin of the y-axis.
-
useMask:
boolean
Whether or not to mask the image. Image mirroring is applied when use_mask is set to FALSE.
Return type: boolean
Example:
myImage.rotateEx(127, 0, -80, 160, 120, true);
saveToFile()¶
Saves the image from the object instance to the specified file.
Signature:
saveToFile( fileName: string, flag?: number ): boolean
Parameters:
-
fileName:
string
Filename, relative path (location relative to the folder with the used INFINITY.JS executable file) or absolute path to the file which should contain the image output.
-
flag:
infinity.image.flag
, optionalOne of the
infinity.image.flag
enums.
Return type: boolean
Example:
myImage.saveToFile('image.bmp');
saveToStream()¶
Saves the image from the object instance to the specified stream.
Signature:
saveToStream( stream: infinity.stream, extension: string, flag?: number ): boolean
Parameters:
-
stream:
infinity.stream
Stream object to save to. See infinity.stream.
-
extension:
string
The file extension to assign.
-
flag:
infinity.image.flag
, optionalOne of the
infinity.image.flag
enums.
Return type: boolean
Example:
myImage.saveToStream(stream, extension);
setChannel()¶
Inserts a 8-bit dib into a 24- or 32-bit image.
Signature:
setChannel( src: infinity.image, channel: infinity.image.channel ): boolean
Parameters:
-
src:
infinity.image
Input 8-bit image to insert.
-
channel:
infinity.image.channel
Color channel to replace.
Return type: boolean
Example:
myImage.setChannel(myImage2, infinity.image.channel.green);
setData()¶
Applies data from an pixel array to the image.
Signature:
setData( data: infinity.image.pixelArray ): void
Parameters:
- data:
infinity.image.pixelArray
The pixel array to apply.
Example:
myImage.setData(pixelArray);
setPixel()¶
Sets the pixel color of an image at position (x, y).
Signature:
setPixel( x: number, y: number, color: number ): void
Parameters:
-
x:
number
Pixel position in horizontal direction.
-
y:
number
Pixel position in vertical direction.
-
color:
number
Pixel color.
Example:
myImage.setPixel(160, 120, 190904);
setSize()¶
Sets the width, height and the bits per pixel value of the image.
Signature:
setSize( type: infinity.image.type, width: number, height: number, bpp: number ): boolean
Parameters:
-
type:
infinity.image.type
Image type according to infinity.image.type.
-
width:
number
New image width in pixels.
-
height:
number
New image height in pixels.
-
bpp:
number
Bits per pixel.
Return type: boolean
Example:
myImage.setSize(infinity.image.type.bitmap, 640, 480, 32);
setThumbnail()¶
Attaches a thumbnail to the image.
Signature:
setThumbnail( src: infinity.image ): boolean
Parameters:
- src:
infinity.image
An
infinity.image
object instance to attach the thumbnail from.
Return type: boolean
Example:
myImage.setThumbnail(myImage2);
splitChannels()¶
Splits a 24-bit RGB image into 3 greyscale images corresponding to the red, green and blue channels.
Signature:
splitChannels( red: infinity.image, green: infinity.image, blue: infinity.image ): boolean
Parameters:
-
red:
infinity.image
An
infinity.image
object instance to hold the output red channel. -
green:
infinity.image
An
infinity.image
object instance to hold the output green channel. -
blue:
infinity.image
An
infinity.image
object instance to hold the output blue channel.
Return type: boolean
Example:
myImage.splitChannels(myImage2Red, myImage2Green, myImage2Blue);
threshold()¶
Converts the bitmap to 1 bit using a threshold.
Signature:
threshold( value: number ): boolean
Parameters:
- value:
number
Threshold value in [0..255].
Return type: boolean
Example:
myImage.threshold(127);
thumbnail()¶
Creates a thumbnail out of the picture inside the object instance.
Signature:
thumbnail( width: number, height: number, dest: infinity.image ): void
Parameters:
-
width:
number
Thumbnail width.
-
height:
number
Thumbnail height.
-
dest:
infinity.image
An
infinity.image
object instance to hold the output.
Example:
myImage.thumbnail(30, 20, myThumbObj);
toneMapping()¶
Converts a High Dynamic Range image to an image with a more limited dynamic range.
Signature:
toneMapping( tmo: infinity.image.tmo, firstParam: number, secondParam: number ): boolean
Parameters:
-
tmo:
infinity.image.tmo
Tone mapping operator according to
infinity.image.tmo
. -
firstParam:
number
First tone mapping algorithm parameter (algorithm dependant).
-
secondParam:
number
Second tone mapping algorithm parameter (algorithm dependant).
Return type: boolean
Example:
myImage.toneMapping(infinity.image.tmo.drago03, firstParam, secondParam);
pixelArray¶
Extends: Array<Array<number>>
An multidimensional array of numbers.
infinity.image.channel¶
Values:
-
rgb:
0
Use red, green and blue channels.
-
red:
1
Use red channel.
-
green:
2
Use green channel.
-
blue:
3
Use blue channel.
-
alpha:
4
Use alpha channel.
-
black:
5
Use black channel.
-
real:
6
Complex images: use real part.
-
imag:
7
Complex images: use imaginary part.
-
mag:
8
Complex images: use magnitude.
-
phase:
9
Complex images: use phase.
Example:
infinity.loadModule('infinity.image');
let channel = infinity.image.channel.rgb;
infinity.image.color¶
Values:
-
minIsWhite:
0
Min value is white.
-
minIsBlack:
1
Min value is black.
-
rgb:
2
RGB color model.
-
palette:
3
Color map indexed.
-
rgbAlpha:
4
RGB color model with alpha channel.
-
cmyk:
5
CMYK color model.
Example:
infinity.loadModule('infinity.image');
let color = infinity.image.color.minIsWhite;
infinity.image.dither¶
Values:
-
fs:
0
Floyd and Steinberg error diffusion.
-
bayer4x4:
1
Bayer ordered dispersed dot dithering (order 2 dithering matrix).
-
bayer8x8:
2
Bayer ordered dispersed dot dithering (order 3 dithering matrix).
-
cluster6x6:
3
Ordered clustered dot dithering (order 3 - 6x6 matrix).
-
cluster8x8:
4
Ordered clustered dot dithering (order 4 - 8x8 matrix).
-
cluster16x16:
5
Ordered clustered dot dithering (order 8 - 16x16 matrix).
-
bayer16x16:
6
Bayer ordered dispersed dot dithering (order 4 dithering matrix).
Example:
infinity.loadModule('infinity.image');
let dither = infinity.image.dither.fs;
infinity.image.filter¶
Values:
-
box:
0
Box, pulse, Fourier window, 1st order (constant) b-spline.
-
bicubic:
1
Mitchell and Netravali's two-param cubic filter.
-
bilinear:
2
Bilinear filter.
-
bspline:
3
4th order (cubic) b-spline.
-
catmullrom:
4
Catmull-Rom spline, Overhauser spline.
-
lanczos3:
5
Lanczos3 filter.
Example:
infinity.loadModule('infinity.image');
let filter = infinity.image.filter.box;
infinity.image.flag¶
Values:
-
fif_load_nopixels = 0x8000
Loading: load the image header only.
-
bmp_default = 0
-
bmp_save_rle = 1
-
cut_default = 0
-
dds_default = 0
-
exr_default = 0
Save data as half with piz-based wavelet compression.
-
exr_float = 0x0001
Save data as float instead of as half.
-
exr_none = 0x0002
Save with no compression.
-
exr_zip = 0x0004
Save with zlib compression, in blocks of 16 scan lines.
-
exr_piz = 0x0008
Save with piz-based wavelet compression.
-
exr_pxr24 = 0x0010
Save with lossy 24-bit float compression.
-
exr_b44 = 0x0020
Save with lossy 44% float compression - goes to 22% when combined with EXR_LC.
-
exr_lc = 0x0040
Save images with one luminance and two chroma channels, rather than as RGB (lossy compression).
-
faxg3_default = 0
-
gif_default = 0
-
gif_load256 = 1
Load the image as a 256 color image with ununsed palette entries, if it's 16 or 2 color.
-
gif_playback = 2
'Play' the GIF to generate each frame (as 32bpp) instead of returning raw frame data when loading.
-
hdr_default = 0
-
ico_default = 0
-
ico_makealpha = 1
Convert to 32bpp and create an alpha channel from the AND-mask when loading.
-
iff_default = 0
-
j2k_default = 0
Save with a 16:1 rate.
-
jp2_default = 0
Save with a 16:1 rate.
-
jpeg_default = 0
Loading (see JPEG_FAST); saving (see JPEG_QUALITYGOOD|JPEG_SUBSAMPLING_420).
-
jpeg_fast = 1
Load the file as fast as possible, sacrificing some quality.
-
jpeg_accurate = 2
Load the file with the best quality, sacrificing some speed.
-
jpeg_cmyk = 0x0004
Load separated CMYK "as is" (use | to combine with other flags).
-
jpeg_exifrotate = 0x0008
Load and rotate according to Exif 'Orientation' tag if available.
-
jpeg_greyscale = 0x0010
Load and convert to a 8-bit greyscale image.
-
jpeg_qualitysuperb = 0x0080
Save with superb quality (100:1).
-
jpeg_qualitygood = 0x0100
Save with good quality (75:1).
-
jpeg_qualitynormal = 0x0200
Save with normal quality (50:1).
-
jpeg_qualityaverage = 0x0400
Save with average quality (25:1).
-
jpeg_qualitybad = 0x0800
Save with bad quality (10:1).
-
jpeg_progressive = 0x2000
Save as a progressive-JPEG (use | to combine with other save flags).
-
jpeg_subsampling_411 = 0x1000
Save with high 4x1 chroma subsampling (4:1:1).
-
jpeg_subsampling_420 = 0x4000
Save with medium 2x2 medium chroma subsampling (4:2:0) - default value.
-
jpeg_subsampling_422 = 0x8000
Save with low 2x1 chroma subsampling (4:2:2).
-
jpeg_subsampling_444 = 0x10000
Save with no chroma subsampling (4:4:4).
-
jpeg_optimize = 0x20000
On saving, compute optimal Huffman coding tables (can reduce a few percent of file size).
-
jpeg_baseline = 0x40000
Save basic JPEG, without metadata or any markers.
-
koala_default = 0
-
lbm_default = 0
-
mng_default = 0
-
pcd_default = 0
-
pcd_base = 1
Load the bitmap sized 768 x 512.
-
pcd_basediv4 = 2
Load the bitmap sized 384 x 256.
-
pcd_basediv16 = 3
Load the bitmap sized 192 x 128.
-
pcx_default = 0
-
pfm_default = 0
-
pict_default = 0
-
png_default = 0
-
png_ignoregamma = 1
Loading: avoid gamma correction.
-
png_z_best_speed = 0x0001
Save using ZLib level 1 compression flag (default value is 6).
-
png_z_default_compression = 0x0006
Save using ZLib level 6 compression flag (default recommended value).
-
png_z_best_compression = 0x0009
Save using ZLib level 9 compression flag (default value is 6).
-
png_z_no_compression = 0x0100
Save without ZLib compression.
-
png_interlaced = 0x0200
Save using Adam7 interlacing (use | to combine with other save flags).
-
pnm_default = 0
-
pnm_save_raw = 0
If set the writer saves in RAW format (i.e. P4, P5 or P6).
-
pnm_save_ascii = 1
If set the writer saves in ASCII format (i.e. P1, P2 or P3).
-
psd_default = 0
-
psd_cmyk = 1
Reads tags for separated CMYK (default is conversion to RGB).
-
psd_lab = 2
Reads tags for CIELab (default is conversion to RGB).
-
psd_none = 0x0100
Save without any compression.
-
psd_rle = 0x0200
Save using RLE compression.
-
psd_psb = 0x2000
Save using Adobe Large Document Format (use | to combine with other save flags).
-
ras_default = 0
-
raw_default = 0
Load the file as linear RGB 48-bit.
-
raw_preview = 1
Try to load the embedded JPEG preview with included Exif Data or default to RGB 24-bit.
-
raw_display = 2
Load the file as RGB 24-bit.
-
raw_halfsize = 4
Output a half-size color image.
-
raw_unprocessed = 8
Output a FIT_UINT16 raw Bayer image.
-
sgi_default = 0
-
targa_default = 0
-
targa_load_rgb888 = 1
If set the loader converts RGB555 and ARGB8888 -> RGB888.
-
targa_save_rle = 2
If set, the writer saves with RLE compression.
-
tiff_default = 0
-
tiff_cmyk = 0x0001
Reads/stores tags for separated CMYK (use | to combine with compression flags).
-
tiff_packbits = 0x0100
Save using PACKBITS compression.
-
tiff_deflate = 0x0200
Save using DEFLATE compression.
-
tiff_adobe_deflate = 0x0400
Save using ADOBE DEFLATE compression.
-
tiff_none = 0x0800
Save without any compression.
-
tiff_ccittfax3 = 0x1000
Save using CCITT Group 3 fax encoding.
-
tiff_ccittfax4 = 0x2000
Save using CCITT Group 4 fax encoding.
-
tiff_lzw = 0x4000
Save using LZW compression.
-
tiff_jpeg = 0x8000
Save using JPEG compression.
-
tiff_logluv = 0x10000
Save using LogLuv compression.
-
wbmp_default = 0
-
xbm_default = 0
-
xpm_default = 0
-
webp_default = 0
Save with good quality (75:1).
-
webp_lossless = 0x100
Save in lossless mode.
-
jxr_default = 0
Save with quality 80 and no chroma subsampling (4:4:4).
-
jxr_lossless = 0x0064
Save lossless.
-
jxr_progressive = 0x2000
Save as a progressive-JXR (use | to combine with other save flags).
Example:
infinity.loadModule('infinity.image');
let flag = infinity.image.flag.bmp_default;
infinity.image.quantize¶
Values:
-
wuQuant:
0
Xiaolin Wu color quantization algorithm.
-
nnQuant:
1
NeuQuant neural-net quantization algorithm by Anthony Dekker.
-
lfpQuant:
2
Lossless Fast Pseudo-Quantization Algorithm.
Example:
infinity.loadModule('infinity.image');
let quantize = infinity.image.quantize.wuQuant;
infinity.image.tmo¶
Values:
-
drago03:
0
Adaptive logarithmic mapping (F. Drago, 2003).
-
reinhard05:
1
Dynamic range reduction inspired by photoreceptor physiology (E. Reinhard, 2005).
-
fattal02:
2
Gradient domain high dynamic range compression (R. Fattal, 2002).
Example:
infinity.loadModule('infinity.image');
let tmo = infinity.image.tmo.drago03;
infinity.image.type¶
Values:
-
unknown:
0
Unknown type.
-
bitmap:
1
Standard image : 1-, 4-, 8-, 16-, 24-, 32-bit.
-
uint16:
2
Array of unsigned short : unsigned 16-bit.
-
int16:
3
Array of short : signed 16-bit.
-
uint32:
4
Array of unsigned long : unsigned 32-bit.
-
int32:
5
Array of long : signed 32-bit.
-
float:
6
Array of float : 32-bit IEEE floating point.
-
double:
7
Array of double : 64-bit IEEE floating point.
-
complex:
8
Array of FICOMPLEX : 2 x 64-bit IEEE floating point.
-
rgb16:
9
48-bit RGB image : 3 x 16-bit.
-
rgba16:
10
64-bit RGBA image : 4 x 16-bit.
-
rgbf:
11
96-bit RGB float image : 3 x 32-bit IEEE floating point.
-
rgbaf:
12
128-bit RGBA float image : 4 x 32-bit IEEE floating point.
Example:
infinity.loadModule('infinity.image');
let type = infinity.image.type.bitmap;