Image formats supported by FreeImage and PIL.
Plugin | FIT | mimetype | description | FreeImage read | FreeImage write | PIL read | PIL write | extensions |
---|---|---|---|---|---|---|---|---|
BMP | 0 | image/bmp | Windows or OS/2 Bitmap | 1 | 1 | 1 | 1 | bmp |
BUFR | 0 | 0 | 1 | 1 | bufr | |||
CUT | 21 | image/x-cut | Dr. Halo | 1 | 0 | 0 | 0 | cut |
DCX | Intel FAX container format | 0 | 0 | 1 | 0 | dcx | ||
DDS | 24 | image/x-dds | DirectX Surface | 1 | 0 | 0 | 0 | dds |
EPS | application/postscript | Encapsulated Postscript | 0 | 0 | 1 | 1 | eps, ps | |
EXR | 29 | image/x-exr | ILM OpenEXR | 1 | 1 | 0 | 0 | exr |
FITS | 0 | 0 | 1 | 1 | fit, fits | |||
FLI | Autodesk FLI/FLC Animation | 0 | 0 | 1 | 0 | flc, fli | ||
FPX | FlashPix | 0 | 0 | 1 | 0 | fpx | ||
G3 | 27 | image/fax-g3 | Raw fax format CCITT G.3 | 1 | 0 | 0 | 0 | g3 |
GBR | GIMP brush file | 0 | 0 | 1 | 0 | gbr | ||
GIF | 25 | image/gif | Graphics Interchange Format | 1 | 1 | 1 | 1 | gif |
GRIB | 0 | 0 | identify | 0 | grib | |||
HDF5 | 0 | 0 | identify | 0 | h5, hdf | |||
HDR | 26 | image/vnd.radiance | High Dynamic Range Image | 1 | 1 | 0 | 0 | hdr |
ICNS | Mac OS icns resource | 0 | 0 | 1 | 0 | icns | ||
ICO | 1 | image/vnd.microsoft.icon | Windows Icon | 1 | 1 | 1 | 0 | ico |
IFF | 5 | image/x-iff | IFF Interleaved Bitmap | 1 | 0 | 0 | 0 | iff, lbm |
IM | IFUNC Image Memory | 0 | 0 | 1 | 1 | im | ||
IMT | IM Tools | 0 | 0 | 1 | 0 | |||
J2K | 30 | image/j2k | JPEG-2000 codestream | 1 | 1 | 0 | 0 | j2k, j2c |
JNG | 3 | image/x-mng | JPEG Network Graphics | 1 | 1 | 0 | 0 | jng |
JP2 | 31 | image/jp2 | JPEG-2000 File Format | 1 | 1 | 0 | 0 | jp2 |
JPEG | 2 | image/jpeg | JPEG - JFIF Compliant | 1 | 1 | 1 | 1 | jpg, jif, jpeg, jpe |
KOALA | 4 | image/x-koala | C64 Koala Graphics | 1 | 0 | 0 | 0 | koa |
MCIDAS | McIdas area file | 0 | 0 | 1 | 0 | |||
MIC | Microsoft Image Composer | 0 | 0 | 1 | 0 | mic | ||
MNG | 6 | video/x-mng | Multiple-image Network Graphics | 1 | 0 | 0 | 0 | mng |
MPEG | 0 | 0 | identify | 0 | mpeg, mpg | |||
MSP | Windows Paint | 0 | 0 | 1 | 1 | msp | ||
PALM | image/palm | 0 | 0 | 0 | 1 | palm | ||
PBM | 7 | image/freeimage-pnm | Portable Bitmap (ASCII) | 1 | 1 | 1 | 1 | pbm |
PBMRAW | 8 | image/freeimage-pnm | Portable Bitmap (RAW) | 1 | 1 | 1 | 1 | pbm |
PCD | 9 | image/x-photo-cd | Kodak PhotoCD | 1 | 0 | 0 | 0 | pcd |
PCX | 10 | image/x-pcx | Zsoft Paintbrush | 1 | 0 | 1 | 1 | pcx |
application/pdf | 0 | 0 | 0 | 1 | ||||
PFM | 32 | image/x-portable-floatmap | Portable floatmap | 1 | 1 | 0 | 0 | pfm |
PGM | 11 | image/freeimage-pnm | Portable Greymap (ASCII) | 1 | 1 | 1 | 1 | pgm |
PGMRAW | 12 | image/freeimage-pnm | Portable Greymap (RAW) | 1 | 1 | 0 | 0 | pgm |
PICT | 33 | image/x-pict | Macintosh PICT | 1 | 0 | 0 | 0 | pct, pict, pic |
PIXAR | PIXAR raster image | 0 | 0 | 1 | 0 | |||
PNG | 13 | image/png | Portable Network Graphics | 1 | 1 | 1 | 1 | png |
PPM | 14 | image/freeimage-pnm | Portable Pixelmap (ASCII) | 1 | 1 | 1 | 1 | ppm |
PPMRAW | 15 | image/freeimage-pnm | Portable Pixelmap (RAW) | 1 | 1 | 0 | 0 | ppm |
PSD | 20 | image/vnd.adobe.photoshop | Adobe Photoshop | 1 | 0 | 1 | 0 | psd |
RAS | 16 | image/x-cmu-raster | Sun Raster Image | 1 | 0 | 1 | 0 | ras |
RAW | 34 | image/x-dcraw | RAW camera image | 1 | 0 | 0 | 0 | 3fr, arw, bay, bmq, cap, cine, cr2, crw, cs1, dc2, dcr, drf, dsc, dng, erf, fff, ia, iiq, k25, kc2, kdc, mdc, mef, mos, mrw, nef, nrw, orf, pef, ptx, pxn, qtk, raf, raw, rdc, rw2, rwl, rwz, sr2, srf, srw, sti |
SGI | 28 | image/x-sgi | SGI Image Format | 1 | 0 | 1 | 0 | sgi |
SPIDER | 0 | 0 | 1 | 1 | ||||
TARGA | 17 | image/x-tga | Truevision Targa | 1 | 1 | 1 | 1 | tga, targa |
TIFF | 18 | image/tiff | Tagged Image File Format | 1 | 1 | limited | limited | tif, tiff |
TIFF G3 compression | 1 | 1 | 0 | 0 | ||||
TIFF G4 compression | 1 | 1 | 0 | 0 | ||||
multipage TIFF | 1 | 1 | 0 | 0 | ||||
WBMP | 19 | image/vnd.wap.wbmp | Wireless Bitmap | 1 | 1 | 0 | 0 | wap, wbmp, wbm |
WMF | Windows Metafile | 0 | 0 | identify | 0 | emf, wmf | ||
XBM | 22 | image/x-xbitmap | X11 Bitmap Format | 1 | 0 | 1 | 1 | xbm |
XPM | 23 | image/x-xpixmap | X11 Pixmap Format | 1 | 1 | 1 | 0 | xpm |
XVTHUMB | XV thumbnail image | 0 | 0 | 1 | 0 |
PIL has only a limited support for TIFF files. Some compression schemas and multipage TIFFs aren’t supported by PIL 1.1.7.
Image(filename[, buffer=None[, flags=0]])
Create a new Image. Either filename or buffer must applied.
adjustColors(brightness=0.0, contrast=0.0, gamma=1.0, invert=False) -> None
bpp -> int
bits per pixel
@note: clone uses low level FI functions to clone metadata and ICC, too.
Close the image and free all resources. The close operation fails when a buffer is still using the image data.
closed -> bool
color_type -> int (fi.FIC_*)
Get color type of the image, e.g. fi.FIC_MINISBLACK, fi.FIC_RGB, fi.FIC_CMYK ...
color_type_name -> str
Get color order (BGR or RGB)
The color order depends on the endianess of the system
colors_used -> int
Returns number of colors used in the image (palette-size) or 0 for high color images.
Converts a bitmap to 1-bit monochrome bitmap using a dithering algorithm.
dpi -> (dpi_x: int, dpi_y: int)
dpi_x -> int
Dots per inch (x axis)
dpi_y -> int
Dots per inch (y axis)
dpm -> (dpm_x: int, dpm_y: int)
dpm_x -> int
Dots per meter (x axis)
dpm_y -> int
Dots per meter (y axis)
filename
Fill the entire image
format -> int (fi.FIF_*)
Format is the image format like fi.FIF_JPEG or fi.FIF_PNG.
getHistogramm([channel=fi.FICC_BLACK]) -> list[256]
Return ICC profile a byte string
@param binary: if true, return values as binary instead of unicode string @param strict: encoding error handling for unicode string conversion
Count number of metadata for each model
Get raw data
Returns raw image data as bytes. It’s up to you to interpret the raw bytes according to image type, bpp, color order and stride padding.
@note: FreeImage stores the lines upside down @return: copy of raw image data @rtype: bytes
has_bg_color -> bool
has_icc -> bool
Returns true if the image has an ICC profile
Check if image is loaded with fi.FIF_LOAD_NOPIXELS
@return: True if image has pixel and isn’t loaded with fi.FIF_LOAD_NOPIXELS
Apply an LCMS transformation
icc_cmyk -> bool
is_transparent -> bool
mimetype -> str
mimetype of the image, e.g. image/jpeg
Paste source image into this image.
alpha: 0 to 255 for alpha blending or 256 for combination.
pitch -> int
Get pitch of scan lines (width + padding)
Remove ICC profile
Get bitmask for red, green and blue channel
Only angles 90, 180 and 270 degrees are supported
Warning: rotation will result in loose of metadata
rotate(angle: double, ...) -> new image
wrapper around fi.FreeImage_RotateEx
angle: angle in degree
Save image to file
size -> (width: int, height: int)
Converts a bitmap to 1-bit monochrome bitmap
@param threshold: 0 to 255
toBuffer([format=-1[, flags=0]] -> _MemoryIO instance
Access raw data of the image as read-only buffer or file like object
toPIL([format=-1[, flags=0]] -> PIL image
type -> int (fi.FIT_*)
Type referes to the data type of the image like fi.FIT_BITMAP or fi.FIT_RGBF.
Multipage image support
filename
format -> int (fi.FIF_*)
Format is the image format like fi.FIF_JPEG or fi.FIF_PNG.
size -> (width: int, height: int)
Perform lossless rotation or flipping on a JPEG image
@param src: path to source image @type src: str @param dst: path to destination file, can be the same file as src @typ dst: str @param op: a FIJPEG_OP_* constant @param perfect: if true raises an exception if image has odd iMCU
aligned (see PDF)
Guess format from file
Guess format from filename
Guess format from mime type string
Iterate over all supported formats
Get color order or RGB data
The color order is platform dependent.
big endian: RGB(A) little endian: BGR(A)
Windows and X86 platforms are usually little endian machines while PowerPC is usually big endian. ARM processors support both endianess.
@return: either “RGB” or “BGR” @rtype: str
Get index of RGBA quad
@return: R, G, B, A @rtype: tuple of four ints
Get color mask of RGBA quad
@return: R, G, B, A @rtype: tuple of four ints
Get color shift of RGBA quad
@return: R, G, B, A @rtype: tuple of four ints
Get color mask of 16bit 555 image
@return: R, G, B @rtype: tuple of three ints
Get color shift of 16bit 555 image
@return: R, G, B @rtype: tuple of three ints
Get color mask of 16bit 565 image
@return: R, G, B @rtype: tuple of three ints
Get color shift of 16bit 565 image
@return: R, G, B @rtype: tuple of three ints
Get version of loaded freeimage library
Is FreeImage compiled against libjeg-turbo