-
Notifications
You must be signed in to change notification settings - Fork 74
Home
CharLS is a codec library that can be used to build applications that can handle JPEG-LS compliant images. In the application you are writing you can call the CharLS codec and pass it images (sometimes called raster bitmaps), to have them encoded to JPEG-LS, or JPEG-LS streams, which CharLS will decode to images.
The strongest point of JPEG-LS is that you can encode images lossless, with a high compression ratio. JPEG-LS allows for compression ratios that are similar to JPEG 2000, which means that compression can go up to 1:4 for natural images, and better than 1:10 for synthetic images. This is done with a relatively simple thus fast algorithm. Which makes it appropriate if you have a huge number of images to deal with and you need the highest possible lossless compression and appreciate high performance. This could be the case if you work with medical images, satellite images, raw images from digital cameras, or for remote desktop applications. A modified version of JPEG-LS algorithm has been used to send images from the Mars rovers down to earth! The typical usage domains are:
-
Medical
Many countries have legal requirements that medical images that have been used to diagnose patients to be kept for a certain period of time (for example up to 10 years) in the original or in a lossless compressed format. The medical DICOM standard lists JPEG-LS as one of the possible options for this purpose. -
Deep Space Exploration
Images captured in difficult and expensive circumstances are often worth to transmit in a lossless compression format. -
Research and Development
There are many scenarios were images needs to be compared and a lossless algorithm makes comparing easy and reliable.
The biggest drawback of the JPEG-LS format is that it has so far not been widely adopted (except in the medical domain). If your application writes files to be read by other applications, it is unlikely that JPEG-LS will be supported by them. Secondly, when you need to choose between JPEG-2000 and JPEG-LS, you should consider JPEG 2000 if you want to use multi-resolution images (say for images exceeding 10000 x 10000 pixels).
CharLS is a conforming ISO/IEC 14495-1:1999 implementation, with some exceptions that have little or no impact in real-world usage. All exceptions are listed in the README.md
- CharLS supports three types of color transforms, identical to the transforms supported in the HP sample code. CharLS will read and write the same tags that the HP implementation uses to signal their use.
- CharLS can read and write SPIFF headers. SPIFF headers are the officially ISO recommended headers when creating standalone (not embedded in another container) JPEG-LS images. Important information like the color space and the meaning of the components can be stored in the SPIFF header.
CharLS works on Microsoft Windows (64/32 bit), Linux (64/32 bit) and macOS. You need a C++17 compiler to compile CharLS. CharLS API consists of a handful of functions you can call with C linkage or with the C++ adapter classes. This will be straightforward to use from any C17/C++17 compiler. From other languages, you should read how the code can interop with code that provides a C interface. For .NET applications a .NET adapter can found in the charls-native-dotnet repository.