Base58 to GIF Converter
Convert Base58-encoded strings to GIF image files. Real binary decoding with LZW compression and full GIF89a specification output.
About
Base58 encoding uses a 58-character alphabet that excludes visually ambiguous characters (0, O, I, l) and non-alphanumeric symbols. It is the standard encoding for Bitcoin addresses, IPFS content identifiers, and various cryptographic payloads. Converting Base58 back to raw bytes and then interpreting those bytes as pixel data requires correct big-integer arithmetic. A single misplaced character invalidates the entire decode. This tool performs real Base58 decoding via BigInt division, maps the resulting byte array onto a pixel grid, and encodes the output as a compliant GIF89a file with full LZW compression. It does not simulate conversion.
The GIF89a specification mandates LZW variable-length code compression with sub-block packaging. The minimum code size depends on the color table depth. This tool builds the binary stream byte-by-byte: magic number, logical screen descriptor, global color table (256 entries), image descriptor, and compressed raster data. Limitations: input strings that decode to fewer than 1 byte produce a 1Ă1 pixel image. Very large inputs (>â500âKB decoded) may take several seconds due to LZW compression cost.
Formulas
Base58 decoding converts a string in base-58 to a big integer, then extracts bytes via repeated division by 256:
where si is the i-th character, idx maps it to 0 - 57, and L is string length. Bytes are extracted in big-endian order. Leading 1 characters prepend 0x00 bytes.
Pixel mapping assigns each decoded byte as a grayscale intensity index into a 256-entry palette. The pixel grid dimensions are computed as:
where N is the total decoded byte count, w is image width, and h is image height. LZW compression builds a dictionary starting at code 258 (after clear code 256 and EOI 257), emitting variable-length codes from 9 to 12 bits, resetting on dictionary overflow at 4096 entries.
Reference Data
| Parameter | Value / Range | Notes |
|---|---|---|
| Base58 Alphabet | 123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz | Bitcoin variant (Base58Check omits 0, O, I, l) |
| GIF Magic Number | GIF89a | 6 bytes: 0x47 0x49 0x46 0x38 0x39 0x61 |
| Logical Screen Descriptor | 7 bytes | Width, Height, GCT flag, background, aspect |
| Global Color Table (GCT) | 256 entries Ă 3 bytes | RGB triplets = 768 bytes total |
| LZW Minimum Code Size | 8 bits | For 256-color palette |
| LZW Clear Code | 256 | 28 |
| LZW EOI Code | 257 | End of Information |
| Max LZW Code Size | 12 bits | GIF spec maximum |
| Sub-block Max Size | 255 bytes | Each data sub-block ⤠255 bytes |
| Image Descriptor | 10 bytes | Separator 0x2C, position, size, flags |
| Trailer Byte | 0x3B | End of GIF file |
| Base58 Radix | 58 | Each character represents log2(58) ≈ 5.858 bits |
| Byte Ratio | ≈ 1.365 chars/byte | Base58 is ~73% efficient vs raw |
| Max Pixel Grid | 65535 Ă 65535 | GIF spec uses 16-bit unsigned width/height |
| Leading Zero Bytes | Count of leading 1s | Each leading "1" in Base58 = one 0x00 byte |