# sail **Repository Path**: efreets/sail ## Basic Information - **Project Name**: sail - **Description**: No description available - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-12-19 - **Last Updated**: 2025-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README
Target Audience • Features • Image Formats • Getting Started • FAQ
# SAIL is a high-quality cross-platform image decoding library providing rich APIs, from one-liners to complex use cases with custom I/O sources. It supports loading and saving static, animated, and multi-paged images along with metadata and ICC profiles. :sailboat: ## Target audience - Image viewers - Game developers - Anyone who needs to load or save images in different image formats with a clean and comprehensive API ## Features overview - [x] Thread-safe C, C++, and Python interfaces - [x] Versatile APIs: `junior`, `advanced`, `deep diver`, and `technical diver` - [x] Input/output: files, memory, custom I/O streams (see [custom-io.c](https://github.com/HappySeaFox/sail/blob/607de77843614e2ba873961d36a91256d6f9bf68/tests/sail/custom-io.c)) - [x] Load by file extensions, paths, and [magic numbers](https://en.wikipedia.org/wiki/File_format#Magic_number) - [x] Format-specific tuning options (e.g., PNG filters). See [FORMATS](FORMATS.md) - [x] Metadata support: text comments, EXIF, ICC profiles - [x] Access to image properties without decoding pixels (probing) - [x] Access to source image properties (source encoding, etc.) - [x] Preserve original pixel formats when saving - [x] Extensible codec architecture demonstrated by Intel \[[*](#intel)\] \* One day Intel demonstrated the advantages of their [IPP](https://wikipedia.org/wiki/Integrated_Performance_Primitives) technology in speeding up decoding [JPEG](https://web.archive.org/web/20091009223918/http://software.intel.com/en-us/articles/intel-integrated-performance-primitives-intel-ipp-for-linux-optimizing-jpeg-coding-in-the-ksquirrel-application-with-intel-ipp) and [JPEG 2000](https://web.archive.org/web/20091009224048/http://software.intel.com/en-us/articles/performance-tools-for-software-developers-application-notes-intel-ipp-jpeg2000-and-jasper-in-ksquirrel) images with the help of [ksquirrel-libs](FAQ.md#how-old-is-sail), the predecessor of SAIL. ## 20+ image formats | Image format | Operations | Dependencies | | --------------------------------------------------------------------| ------------- | ----------------- | | [APNG](https://wikipedia.org/wiki/APNG) | RW | libpng+APNG patch | | [AVIF](https://wikipedia.org/wiki/AV1#AV1_Image_File_Format_(AVIF)) | RW | libavif | | [GIF](https://wikipedia.org/wiki/GIF) | RW | giflib | | [HEIF](https://wikipedia.org/wiki/High_Efficiency_Image_File_Format)| RW | libheif, libheif-plugin-x265 | | [JPEG](https://wikipedia.org/wiki/JPEG) | RW | libjpeg-turbo | | [JPEG 2000](https://wikipedia.org/wiki/JPEG_2000) | RW | openjpeg | | [JPEG XL](https://wikipedia.org/wiki/JPEG_XL) | RW | libjxl | | [PNG](https://wikipedia.org/wiki/Portable_Network_Graphics) | RW | libpng | | [PSD](https://en.wikipedia.org/wiki/Adobe_Photoshop#File_format) | R | | | [SVG](https://wikipedia.org/wiki/Scalable_Vector_Graphics) | R | resvg/nanosvg | | [TGA](https://wikipedia.org/wiki/Truevision_TGA) | RW | | | [TIFF](https://wikipedia.org/wiki/TIFF) | RW | libtiff | | [WEBP](https://wikipedia.org/wiki/WebP) | RW | libwebp | | ... | | | See the full list [here](FORMATS.md). Work to add more image formats is ongoing. ## Benchmarks Time to load and output default pixels (without explicit conversion) was measured. See [BENCHMARKS](BENCHMARKS.md). ## Preferred installation method - **Python:** [PyPI](https://pypi.org/project/sailpy/) - `pip install sailpy` - **Windows:** [Conan](https://conan.io/center/recipes/sail), `vcpkg` - **macOS:** [brew](https://formulae.brew.sh/formula/libsail), [Conan](https://conan.io/center/recipes/sail), `vcpkg` - **Linux:** native packages if available, [Conan](https://conan.io/center/recipes/sail), `vcpkg` See [BUILDING](BUILDING.md). ## APIs overview SAIL provides four levels of APIs, depending on your needs. Let's have a quick look at the `junior` level. #### C: ```C struct sail_image *image; SAIL_TRY(sail_load_from_file(path, &image)); /* * Handle the image pixels here. * Use image->width, image->height, image->bytes_per_line, * image->pixel_format, and image->pixels for that. * * In particular, you can convert it to a different pixel format with functions * from libsail-manip. With sail_convert_image(), for example. */ sail_destroy_image(image); ``` #### C++: ```C++ sail::image image(path); // Handle the image and its pixels here. // Use image.width(), image.height(), image.bytes_per_line(), // image.pixel_format(), and image.pixels() for that. // // In particular, you can convert it to a different pixel format with image::convert(). ``` #### Python: ```python import sailpy image = sailpy.Image.from_file(path) # Handle the image and its pixels here. # Use image.width, image.height, image.bytes_per_line, # image.pixel_format, and image.to_numpy() for that. # # In particular, you can convert it to a different pixel format with image.convert(). # View documentation # python -m sailpy --readme # Run image viewer example # pip install PySide6 # python -m sailpy.examples.12_image_viewer ``` See also [FAQ](FAQ.md) for more information. ## Programming languages **Programming language:** C11