JPEG 2000 for Pascal is a free library for Object Pascal (Delphi and Free Pascal) developers that want to use JPEG 2000 images in their applications. It is based on OpenJpeg library written in C language (BSD license). C library is precompiled (using C++ Builder for Delphi and GCC for FPC) for several platforms and Pascal header is provided. Some higher level classes for easier manipulation with JPEG 2000 images are part of the JPEG 2000 for Pascal as well.
- Cross-platform Pascal interface to OpenJpeg – low level access to precompiled library. Currently supported platforms: Windows 32bit, Linux 32/64bit, and Mac OS X.
- VCL wrapper for Delphi (TBitmap descendant) enabling easy loading and saving of JPEG 2000 images.
- Samples that demonstrate usage of all library interfaces and few test images in various data formats.
Delphi: Just add some of JPEG 2000 for Pascal units you want to use to your uses clause (must be in you search path) and precompiled library will be linked automatically.
Free Pascal: OpenJpeg is compiled into static libraries so you have to set library search path when compiling your project. Libraries are located in J2KObjects directory.
Current version of JPEG 2000 for Pascal library is: 1.00 (7th July 2009) .
» 2.0 MiB - 3,364 hits - July 7, 2009
JPEG 2000 for Pascal library. Crossplatform JPEG 2000 image file format support for Delphi and FPC.
Hosted at BitBucket https://github.com/galfar/pasjpeg2000.
- Free Pascal fpimage and Lazarus LCL support
- loading of CMYK and indexed images
- saving images in YCC colorspace, irreversible DWT in lossy mode
Notes and Tips
If you want to recompile OpenJpeg yourself (custom modification, other compiler settings, etc.) you'll need source code from SVN repository at OpenJpeg's Google Code page. Note that Pascal header is based on SVN revision 507 with my CDEF patch applied (needed to store alpha channels correctly and for better compatibility of saved files with other software) but latest revision 543 works too. You can get the patch and some more info here: OpenJpeg group on Google (updated patch is in Files section of the group).
In this thread there’s also a mention about channel values being saved as 128. When library is compiled with GCC (depends on optimization settings) fourth and subsequent image channel is saved wrongly and all pixels have the value of 128 for this channel. So when recompiling make sure you test if this problem appears.
This "alpha saved as 128" error was finally fixed in recent OpenJpeg revision (it was caused by accessing C array at index 3!).
Compiling in GCC: Just apply CDEF patch and use makefiles shipped with OpenJpeg.
Compiling in C++ Builder: Another patch is needed, you can find it here. Additionally, this define must be included in project options: WIN32 and optional OPJ_STATIC for using standard C calling convention (needed for object files usable by Delphi wrapper) and OPJ_EXPORTS if you want to build DLL.