Libima image codec |
Libima is a library which encodes or decodes images using an original transformation or the Haar transformation. It can do lossless or lossy compression. It supports 1 bit to 32 bits integer and fixed-point and OpenEXR 16 and 32 bits floating-point samples. It supports multiple channels, transparency, layers, animations, CMYK color coordinates, Bayer color array, Exif metadata, Adobe XMP metadata and ICC Profile. Rotation, cropping and brightness & contrast modifications can be done without losing image information or decoding the whole image. It also supports progressive-resolution coding and mipmaps. The original transformation requires an average of 2 multiplications per sample and no divisions. The Haar transformation requires no multiplications or divisions. A new transform has been added to Libima which requires no multiplications or divisions. The extra memory required is usually small. As with JPEG, more memory may be required depending on the options and the implementation. Unless tile mode is selected, a thumbnail is added at the beginning of the file. The image can be displayed as it is decoded, in increments of 16 rows of pixels. Here is an image compressed 24:1 (original): |
![]() |
(PSNR: 34.60) |
Color picture (not 24:1): A PNG image from the internet (Coral cache) Compressed with IJG's libjpeg (Coral cache) The following is compressed with libima to the same filesize: YIQ with a rotation of 45 degrees and 4:2:1 quantization YCoCg with 4:1:2 quantization If YIQ and YCoCg are calculated as 8 bits for Y and 9 bits for the chroma channels, then the ratios used are more precisely YIQ 8:2:1 and YCoCg 4:1:2. There is a bandwidth limit on GeoCities, so to see all images at once, open some of them in your web browser, wait 1 hour, then open the others. |
.IMA | .IMA (Huffman) | .PNG | Jasper | |
Kodak Corpus | 11 888 796 | 12 295 791 | 15 394 305 | 11 297 516 |
Lena color | 439 753 | 450 307 | 474 475 | 445 232 |
Lena gray | 138 970 | 142 127 | 150 926 | 141 456 |
SI-1300 Raw frame | 419 897 | 435 588 | 1 239 014 | |
PSNR on Lena gray | ||||
24:1 | 34.60 | 34.36 | - | 34.37 |
16:1 | 36.26 | 36.11 | - | 36.29 |
8:1 | 39.55 | 39.46 | - | 39.29 |
4:1 | 43.70 | 43.60 | - | 43.36 |
The second supported transform is described in this application. This link also has a description of a lossless YIQ color transform that uses 2 or 5 multiplications per pixel. Anyone wishing to participate in the project can send an e-mail to mcartoaje@gmail.com A description of the container format is here. I have started a project to program a video codec using some of the same methods as in libima. |