User Rating 0.0
Total Usage 0 times
Drop BMP files here or click to browse Supports .bmp files up to 20 MP
Is this tool helpful?

Your feedback helps us improve.

About

BMP (Bitmap) files store raw, uncompressed pixel data. A 1920×1080 BMP at 24-bit color depth consumes roughly 5.9 MB. GIF (Graphics Interchange Format) applies LZW lossless compression and restricts the palette to 256 colors, typically reducing file size by 60 - 90% for graphics and illustrations. Feeding a photographic BMP into GIF without proper color quantization produces severe banding artifacts. This tool applies Median Cut quantization to extract an optimal 256-color palette, with optional Floyd-Steinberg dithering to mask banding. All processing runs locally in your browser. No files are uploaded to any server.

Limitations: GIF is inherently limited to 256 indexed colors per frame. Photographic content with smooth gradients will show quality loss compared to PNG or JPEG. This converter handles single-frame static GIF output. Transparency is supported by designating one palette index as transparent. Expect encoding times of 1 - 5 seconds for images under 2 MP, scaling linearly with pixel count due to LZW compression overhead.

bmp to gif image converter gif encoder lzw compression color quantization bitmap converter image format

Formulas

The GIF file format (GIF89a) encodes image data using Lempel-Ziv-Welch (LZW) compression on indexed color data. The encoding pipeline has two critical stages:

Stage 1 - Color Quantization (Median Cut):

The input BMP pixel array P of N pixels, each with channels (R, G, B) [0, 255], is partitioned into k 256 clusters. For each cluster, the representative color is the component-wise mean:

Cj = 1|Sj| p Sj p

Each pixel is then mapped to the nearest palette index by Euclidean distance in RGB space:

idx(p) = argminj (Rp Rj)2 + (Gp Gj)2 + (Bp Bj)2

Stage 2 - LZW Compression:

The index stream is compressed using LZW with variable-length codes. Initial code size M = max(2, ceil(log2(k))). A dictionary is initialized with 2M + 2 entries (palette indices + Clear Code + EOI Code). Code width starts at M + 1 bits and grows to a maximum of 12 bits (4096 entries). When the dictionary fills, a Clear Code resets it.

Floyd-Steinberg Dithering (optional):

Quantization error e = p Cidx is diffused to neighboring pixels with weights: right 716, bottom-left 316, bottom 516, bottom-right 116.

Where: P = pixel array, N = total pixel count, k = palette size ( 256), Sj = cluster j, Cj = centroid color of cluster j, M = minimum LZW code size, e = quantization error vector.

Reference Data

PropertyBMPGIF
Full NameBitmap Image FileGraphics Interchange Format
Extension.bmp, .dib.gif
CompressionNone (or RLE)LZW (lossless)
Max Colors16.7 million (24-bit)256 (indexed)
TransparencyVia alpha channel (32-bit)Single-color transparency
AnimationNot supportedSupported (multi-frame)
Color Depth1, 4, 8, 16, 24, 32 bit1 to 8 bit
File Size (1920×1080)5.9 MB0.3 - 1.5 MB
MIME Typeimage/bmpimage/gif
SpecificationMicrosoft BMP v5GIF89a (1989)
LZW Min Code SizeN/A2 - 8 bits
Max Image SizeUnlimited (OS-bound)65535 × 65535 px
Best Use CaseRaw editing, Windows iconsLogos, icons, simple graphics
Browser SupportUniversalUniversal
Byte OrderLittle-endianLittle-endian
Header Magic Bytes42 4D ("BM")47 49 46 ("GIF")

Frequently Asked Questions

GIF supports a maximum of 256 colors per frame. Your BMP likely contains thousands or millions of unique colors. The Median Cut quantization algorithm selects the 256 most representative colors, but smooth gradients inevitably lose intermediate tones. Enable Floyd-Steinberg dithering in the settings - it diffuses quantization error to neighboring pixels, producing a stippled pattern that the human eye perceives as smoother transitions. Dithering slightly increases file size (LZW compresses uniform regions better than dithered ones) but significantly improves perceived quality on photographic content.
Processing is constrained by browser memory. Canvas elements in modern browsers support up to approximately 16384 × 16384 pixels (268 MP) on desktop, though practical limits depend on available RAM. A 4000 × 3000 BMP (12 MP) at 32-bit color requires roughly 48 MB of raw pixel data, plus the encoded output buffer. Files under 20 MP convert reliably. For images exceeding 10 MP, expect encoding times of 5-15 seconds. The tool uses a Web Worker to prevent UI freezing during encoding.
32-bit BMP files with an alpha channel are supported. The converter reads the alpha channel and can designate fully transparent pixels (alpha = 0) as the GIF transparent color index. However, GIF only supports binary transparency - each pixel is either fully opaque or fully transparent. Semi-transparent pixels (alpha between 1 and 254) are quantized: pixels with alpha < 128 become transparent, and those ≥ 128 become opaque. For graduated transparency effects, PNG is the appropriate format.
LZW compression efficiency depends on pattern repetition in the indexed pixel stream. Images with many unique colors, noise, or dithering produce longer dictionary chains and larger output. Photographic BMPs converted with dithering enabled can produce GIF files only 20-40% smaller than the BMP source. Graphics with flat color regions (logos, diagrams, pixel art) compress dramatically - often 80-95% reduction. If file size is critical, try reducing the palette size to 128 or 64 colors, or disable dithering.
LZW starts with codes of M + 1 bits, where M is the minimum code size (derived from palette bit depth). As the dictionary grows, code width increases by 1 bit each time the dictionary size exceeds a power of 2, up to the 12-bit maximum (4096 entries). Once full, a Clear Code resets the dictionary. Images with high local pattern repetition keep the dictionary effective longer. Frequent resets (due to varied content) waste bits on re-learning patterns. The converter emits Clear Codes optimally when dictionary efficiency drops.
Yes. The browser's native image decoder handles BMP variants including uncompressed (BI_RGB), RLE-8, and RLE-4 compression. The converter loads the BMP via an Image element, which delegates decoding to the browser engine. This means OS/2 BMP variants and BITMAPV4/V5 headers with color profiles are also supported, provided the browser's image codec recognizes them. If a BMP fails to load, the file may be corrupted or use an unsupported header version.