Methods
Public Class
- check_last_error
- copyright
- find_lib
- free_image_library_paths
- little_endian?
- msvc?
- search_paths
- version
Public Instance
Classes and Modules
- FreeImage::Conversions
- FreeImage::FFI
- FreeImage::ICC
- FreeImage::Information
- FreeImage::Modify
- FreeImage::Pixels
- FreeImage::Transforms
- FreeImage::AbstractSource
- FreeImage::Bitmap
- FreeImage::Boolean
- FreeImage::Complex
- FreeImage::Error
- FreeImage::File
- FreeImage::IO
- FreeImage::IOStruct
- FreeImage::InfoHeader
- FreeImage::Memory
- FreeImage::MemoryStream
- FreeImage::Palette
- FreeImage::RGB16
- FreeImage::RGB16BF565
- FreeImage::RGBA16
- FreeImage::RGBAF
- FreeImage::RGBF
- FreeImage::RGBQuad
- FreeImage::RGBTriple
- FreeImage::Scanline
Constants
| BITFIELDS | = | 3 |
BI_BITFIELDS |
|
| CALLBACK | = | Proc.new do |format, ptr| # Create an exception object and stash it away. We can't raise it here # because FreeImage won't be able to clean up any resources it needs to. # Instead, the calling code must call check_last_error. message = ptr.get_string(0) Thread.current[LAST_ERROR] = Error.new(format, message) end | ||
| COLOR_ALPHA_IS_INDEX | = | 0x04 |
The color's rgbReserved member (alpha) contains the palette index to be used |
|
| COLOR_FIND_EQUAL_COLOR | = | 0x02 |
For palettized images: lookup equal RGB color from palette |
|
| COLOR_IS_RGBA_COLOR | = | 0x01 |
RGBQUAD color is a RGBA color (contains a valid alpha channel) |
|
| COLOR_IS_RGB_COLOR | = | 0x00 |
RGBQUAD color is a RGB color (contains no valid alpha channel) |
|
| COLOR_PALETTE_SEARCH_MASK | = | (COLOR_FIND_EQUAL_COLOR | COLOR_ALPHA_IS_INDEX) |
No color lookup is performed |
|
| LAST_ERROR | = | 'free_image_error' | ||
| RGB | = | 0 |
BI_RGB |
Public Class methods
# File lib/free-image/errors.rb, line 38 def check_last_error error = Thread.current[LAST_ERROR] Thread.current[LAST_ERROR] = nil raise(error) if error end
Returns a standard copyright message you can show in your program.
# File lib/free-image/modules/helper.rb, line 27 def self.copyright FreeImage.FreeImage_GetCopyrightMessage end
# File lib/free-image.rb, line 28 def self.find_lib(lib) files = search_paths.inject(Array.new) do |array, path| file_name = File.expand_path(File.join(path, "#{lib}.#{FFI::Platform::LIBSUFFIX}")) array << Dir.glob(file_name) array end files.flatten.compact.first end
# File lib/free-image.rb, line 37 def self.free_image_library_paths @free_image_library_paths ||= begin libs = %w{libfreeimage libfreeimage.3 FreeImage} libs.map do |lib| find_lib(lib) end.compact end end
Returns TRUE if the platform running FreeImage uses the Little Endian convention (Intel processors) and returns FALSE if it uses the Big Endian (Motorola processors).
# File lib/free-image/modules/helper.rb, line 39 def self.little_endian? FreeImage.FreeImage_IsLittleEndian end
# File lib/free-image.rb, line 5 def self.msvc? # If this is windows we assume FreeImage was compiled with # MSVC since that is the binary distibution provided on # the web site. If you have compiled FreeImage yourself # on windows using another compiler, set this to false. # # This is important because FreeImage defines different # type sizes for MSVC - see types/ffi.rb FFI::Platform.windows? end
# File lib/free-image.rb, line 16 def self.search_paths @search_paths ||= begin if ENV['FREE_IMAGE_LIBRARY_PATH'] [ ENV['FREE_IMAGE_LIBRARY_PATH'] ] elsif FFI::Platform::IS_WINDOWS ENV['PATH'].split(File::PATH_SEPARATOR) else [ '/usr/local/{lib64,lib32,lib}', '/opt/local/{lib64,lib32,lib}', '/usr/{lib64,lib32,lib}' ] end end end
Returns the current version of the FreeImage library
# File lib/free-image/modules/helper.rb, line 17 def self.version FreeImage.FreeImage_GetVersion end
Public Instance methods
FreeImage supports the following color types:
| :minis_black |
Monochrome bitmap (1-bit) -> first palette entry is black. Palletised bitmap (4 or 8-bit) and single channel non standard bitmap -> the bitmap has a greyscale palette |
| :minis_white |
Monochrome bitmap (1-bit) -> first palette entry is white. Palletised bitmap (4 or 8-bit) and single channel non standard bitmap -> the bitmap has an inverted greyscale palette |
| :palette |
Palettized bitmap (1, 4 or 8 bit) |
| :rgb | |
| :rgb_alpha |
High-color bitmap with an alpha channel (32 bit bitmap, RGBA16 or RGBAF) |
| :cmyk |
CMYK bitmap (32 bit only) |
# File lib/free-image/enums/color_types.rb, line 17
FreeImage supports the following dithering algorithms:
| :fs |
Floyd & Steinberg error diffusion algorithm |
| :bayer4x4 |
Bayer ordered dispersed dot dithering (order 2 – 4x4 -dithering matrix) |
| :bayer8x8 |
Bayer ordered dispersed dot dithering (order 3 – 8x8 -dithering matrix) |
| :bayer16x16 |
Bayer ordered dispersed dot dithering (order 4 – 16x16 dithering matrix) |
| :cluster6x6 |
Ordered clustered dot dithering (order 3 - 6x6 matrix) |
| :cluster8x8 |
Ordered clustered dot dithering (order 4 - 8x8 matrix) |
| :cluster16x16 |
Ordered clustered dot dithering (order 8 - 16x16 matrix) |
# File lib/free-image/enums/dithers.rb, line 16
FreeImage supports the following rescaling filters:
# File lib/free-image/enums/filters.rb, line 6 enum :filter, [:box, 0, :bicubic, 1, :bilinear, 2, :bspline, 3, :catmullrom, 4, :lanczos3, 5]
FreeImage supports over 30 bitmap types, which are indentified via symbols. Supported formats include:
| :bmp | |
| :cut |
Dr. Halo (*.CUT) |
| :dds |
DirectDraw Surface (*.DDS) |
| :exr |
ILM OpenEXR (*.EXR) |
| :faxg3 |
Raw Fax format CCITT G3 (*.G3) |
| :gif |
Graphics Interchange Format (*.GIF) |
| :hdr |
High Dynamic Range (*.HDR) |
| :ico |
Windows Icon (*.ICO) |
| :iff |
Amiga IFF (*.IFF, *.LBM) |
| :jpeg |
Independent JPEG Group (*.JPG, *.JIF, *.JPEG, *.JPE) |
| :jng |
JPEG Network Graphics (*.JNG) |
| :j2k |
JPEG-2000 codestream (*.J2K, *.J2C) |
| :jp2 |
JPEG-2000 File Format (*.JP2) |
| :koala |
Commodore 64 Koala format (*.KOA) |
| :lbm |
Amiga IFF (*.IFF, *.LBM) |
| :mng |
Multiple Network Graphics (*.MNG) |
| :pbm |
Portable Bitmap (ASCII) (*.PBM) |
| :pbmraw |
Portable Bitmap (BINARY) (*.PBM) |
| :pcd |
Kodak PhotoCD (*.PCD) |
| :pcsx |
Zsoft Paintbrush PCX bitmap format (*.PCX) |
| :pfm |
Portable Floatmap (*.PFM) |
| :pgm |
Portable Graymap (ASCII) (*.PGM) |
| :pgmraw |
Portable Graymap (BINARY) (*.PGM) |
| :pict |
Macintosh PICT (*.PCT, *.PICT, *.PIC) |
| :png |
Portable Network Graphics (*.PNG) |
| :ppm |
Portable Pixelmap (ASCII) (*.PPM) |
| :ppmraw |
Portable Pixelmap (BINARY) (*.PPM) |
| :psd |
Adobe Photoshop (*.PSD) |
| :ras |
Sun Rasterfile (*.RAS) |
| :raw |
RAW camera image (many extensions) |
| :sgi |
Silicon Graphics SGI image format (*.SGI) |
| :targa |
Truevision Targa files (*.TGA, *.TARGA) |
| :tiff |
Tagged Image File Format (*.TIF, *.TIFF) |
| :wbmp |
Wireless Bitmap (*.WBMP) |
| :xbm |
X11 Bitmap Format (*.XBM) |
| :xpm |
X11 Pitmap Format (*.XPM) |
# File lib/free-image/enums/formats.rb, line 46
FreeImage supports the following image types:
| :unknown |
Unknown format (returned value only, never use it as input value) |
| :bitmap |
Standard image: 1-, 4-, 8-, 16-, 24-, 32-bit |
| :uint16 |
Array of unsigned short: unsigned 16-bit |
| :int16 |
Array of short: signed 16-bit |
| :uint32 |
Array of unsigned long: unsigned 32-bit |
| :int32 |
Array of long: signed 32-bit |
| :float |
Array of float: 32-bit IEEE floating point |
| :double |
Array of double: 64-bit IEEE floating point |
| :complex |
Array of FICOMPLEX: 2 x 64-bit IEEE floating point |
| :rgb16 |
48-bit rgb image: 3 x 16-bit |
| :rgba16 |
64-bit rgba image: 4 x 16-bit |
| :rgbf |
96-bit rgb float image: 3 x 32-bit IEEE floating point |
| :rgbaf |
128-bit rgba float image: 4 x 32-bit IEEE floating point |
# File lib/free-image/enums/image_types.rb, line 22