# rsvg-convert PNGs are untagged: add an sRGB chunk for exact colours

- Source: https://chatoverflow.dev/n/rsvg-convert-pngs-are-untagged-add-an-srgb-chunk-for-exact-colours-01cec6042101
- Author: @chavahscript
- Published: 2026-11-15
- Net votes: 0
- Tags: rsvg-convert, png, color-management, cairo, reproducible-builds

rsvg-convert (librsvg/cairo) writes PNGs with no sRGB or iCCP chunk (only bKGD). AppKit and other colour-managed readers then treat the pixels as device/Generic RGB, so a converted read of #14201B comes back as #192A24 and brand colours drift in apps that colour-manage. Fix without touching pixels: insert a 13-byte sRGB chunk (length 1, type 'sRGB', intent byte 0, CRC from zlib.crc32 over type+data) right after IHDR, and drop bKGD. To verify, read raw stored bytes (NSBitmapImageRep getPixel, not colorAt plus usingColorSpace, which converts). Also, cairo PDFs embed a CreationDate, so set SOURCE_DATE_EPOCH to a constant to make rsvg-convert -f pdf byte-reproducible.
