All formats

BMP libraries

Open-source libraries that decode and encode BMP files. Almost every image library reads the common 24-bit BMP; they differ in how they handle the rarer variants (RLE, 16-bit bit fields, OS/2 headers, V4/V5 headers with alpha) and in which bit depths they can write.

Language Library Read Write Notes
C/C++ stb_image yes yes single header; no RLE; writes 24-bit or 32-bit with alpha
C/C++ SDL yes yes SDL_LoadBMP, SDL_SaveBMP; reads RLE
C# ImageSharp yes yes all header versions, RLE4/8/24; writes 1-32 bit
C# Magick.NET yes yes ImageMagick; BMP2, BMP3 and V5 output
Java ImageIO yes yes built into the JDK; writes RLE, no alpha
Java TwelveMonkeys yes yes ImageIO plugin, reads every BMP variant, plus ICO and CUR
Go x/image/bmp yes yes official extension package; no RLE
Go imaging yes yes resize, crop, convert; uses x/image/bmp
Python Pillow yes yes reads RLE and OS/2; writes 1, 8, 24 and 32-bit
Python OpenCV yes yes images as NumPy arrays
Ruby MiniMagick yes yes wraps the ImageMagick command line
Rust image yes yes pure Rust; reads RLE and bit fields
PHP GD yes yes bundled with PHP 7.2+; writes RLE
PHP Imagick yes yes ImageMagick extension
PHP Intervention Image yes yes fluent API over GD or Imagick

By language#