The image library

To use the Image rendering (libimg) library, the BlackBerry 10 OS includes the following:

  • A configuration file, at /etc/system/config/img.conf, which specifies the codecs that the image library should load
  • Supported codecs (img_codec_*.so), which allow the image library to encode and decode images of various types

To learn more about the various data types and functions in the image library, see the Image Library section of the API reference.

The configuration file

The image library uses a configuration file to determine which codecs to load. When you want to use the image library in your app, you need to call the img_lib_attach() function. This function initializes the image library, searches for the configuration file, and loads the codecs that are listed in that file. In the BlackBerry 10 OS, this file is located in /etc/system/config/img.conf.

Codecs in the configuration file are specified as sections. Each section begins with the codec name in square brackets, followed by an unordered list of properties that specify additional information about the codec. You must provide at least a MIME type and list of extensions to associate with the codec.

Here's an example of an entry in the configuration file for images in JPG format:


Supported codecs

The following table lists the codecs that the image library uses. Each codec includes a description and any potential limitations.

Codec Description

This codec represents the Windows Bitmap format. It provides full Microsoft BMP support for most known variants, including the older OS/2 variant.


This codec does not support Header Version 5.x or the v1.x DDB format.

This codec represents the Joint Photographic Experts Group (JPEG) file format. It supports 24-bit RGB, YUV, and grayscale.

This codec represents the Portable Networks Graphics (PNG) format. It provides full PNG support with alpha, transparency, and interlacing support.


This codec ignores the following chunks:

  • Background color
  • Chromaticity
  • Gamma
  • Histogram
  • Physical pixel dimension
  • Significant bits
  • Text data
  • Image last-modified time

This codec represents the Graphics Interchange Format (GIF). It supports GIF 87a and GIF 89a variants. This codec supports the graphics control extension that provides most of the significant features for this format (transparency, interlacing, multiframe, and so on).


This codec ignores other extensions that allow embedded text, comments, application data, and so on.

It also currently supports encoding only a single frame (for example, you cannot create an animated GIF using the encoder).

This codec represents the Silicon Graphics Image (SGI) format. It supports black-and-white, grayscale, and color images (.sgi, .rgb, .rgba, and .bw file formats).


This codec supports decoding only.

This codec represents the Truevision Graphics Adapter (TGA) format. For decoding, this codec handles run length encoding (RLE) compression and supports these formats:

  • True color 16-, 24-, and 32-bit
  • cmap 15-, 16-, 24-, and 32-bit
  • Black and white 8-bit

For encoding, this codec supports true color (8888) 32-bit RLE.

This codec represents the Tagged Image File Format (TIFF). It supports full Baseline TIFF decoding from the Adobe TIFF Revision 6.0 specification (for example, bilevel, grayscale, RGB, multiple subfiles, PackBits, and Huffman compression). Some TIFF extensions are supported, such as CCITT bilevel encodings (which enables fax image decoding), LZW compression, and associated alpha.


This codec encodes only grayscale and RGB buffers.

Also, because TIFF images are not sequential streams of data, the TIFF decoder must be able to seek in the image stream to find image data. As a result, it may not be compatible with certain unidirectional or unbuffered I/O streams. For best results, you should decode a TIFF image from a file or full memory buffer.

This codec represents the Wireless Application Protocol Bitmap file format. It supports decoding and encoding of monochrome images.

Last modified: 2015-03-31

Got questions about leaving a comment? Get answers from our Disqus FAQ.

comments powered by Disqus