First of its kind GMO-free image decoding library

SAIL is a format-agnostic image decoding library supporting all popular image formats. Being one of the fastest among competitors, it provides simple yet powerful C/C++ API for end-users. SAIL works on Windows, macOS, and Linux platforms.

Travis Build Status Latest release

macOS Screenshot

Features Overview

  • Support of all popular image formats including JPEG, PNG, TIFF, GIF, AVIF, and WEBP.
  • Thread-safe implementation. SAIL is known to be successfully used in multi-threaded servers.
  • Comprehensive APIs covering all possible use-cases: junior, advanced, deep diver, and technical diver.
  • Pluggable codecs except when SAIL was compiled with SAIL_COMBINE_CODECS=ON.
  • Load from everywhere. Files, memory, and custom I/O sources are supported.
  • Codec-specific tuning options like PNG filters. See formats.
  • Step-by-step loading of multi-paged or animated images.
  • Meta data support: text comments, EXIF, ICC profiles.
  • Probing or access to the image properties without decoding pixels.
  • Written in C11 and C++11.

Examples

/* Junior API demonstration. */
struct sail_image *image;

SAIL_TRY(sail_load_from_file(path, &image));

printf("Size: %ux%u, bytes per line: %u, "
       "pixel format: %s, pixels: %p\n",
       image->width,
       image->height,
       image->bytes_per_line,
       sail_pixel_format_to_string(image->pixel_format),
       image->pixels);

sail_destroy_image(image);

// Junior API demonstration.
sail::image image(path);

std::cout
  << "Size: "
  << image.width() << 'x' << image.height()
  << ", bytes per line: "
  << image.bytes_per_line()
  << ", pixel format: "
  << image.pixel_format()
  << ", pixels: "
  << image.pixels()
  << std::endl;

Performance

JPEG Benchmark
Time to load and output default pixels (without explicit conversion) was measured.

Installation

  • Conan

  • VCPKG

    vcpkg install sail

  • HomeBrew. SAIL is currently available in a third-party repository only.

    brew install HapySeaFox/sail/sail

  • Building from source

Copyright & License

Released under the MIT license.

Copyright (c) 2020-2022 Dmitry Baryshev

The MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.