Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4791 pages
Servers, nginx and Docker

Apache error.log fills with libpng iCCP sRGB profile warnings

Your error

libpng warning: iCCP: known incorrect sRGB profile1 more line it can show

Fix it fast

Most common cause, 1 of 3

PNG files in the site or app still embed the HP-Microsoft sRGB v2 profile

Back up the files, then remove the ICC profile from each flagged PNG.

Fix
cp -a /var/www/html /var/www/html.bak
python3 scan_iccp.py /var/www/html | awk -F'\t' '$1 == 3144 {print $3}' > flagged.txt
# ImageMagick 6 (apt on Ubuntu 24.04); with ImageMagick 7 write: magick mogrify
while IFS= read -r f; do mogrify +profile icc "$f"; done < flagged.txt
Did this fix it?
Full steps for this cause: check, fix, verify

Short answer

libpng warning: iCCP: known incorrect sRGB profile means a PNG your code opened embeds the old 3144-byte HP-Microsoft sRGB v2 profile, which libpng 1.6.46 and earlier flag as broken. Apache logs it because a CGI script's stderr is copied into error.log. Scan the PNGs for that profile, remove it with mogrify +profile icc, or run on libpng 1.6.47+.

  • Applies to libpng 1.6.43 (Ubuntu 24.04 LTS package), libpng 1.6.57 (Ubuntu 26.04 LTS package), ImageMagick 6.9.12 and 7.1.2, Apache httpd 2.4
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Which cause do you have?

The warning never says which image caused it, so look inside the PNG files your site serves or processes. This short script lists every PNG that carries an embedded ICC profile, with the profile size, its name and the path, separated by tabs. Rows showing 3144 point to cause 1; an empty result while the warning continues points to cause 2.

Run this first
cat > scan_iccp.py <<'EOF'
import pathlib, struct, sys, zlib

for p in pathlib.Path(sys.argv[1]).rglob("*.png"):
    b = p.read_bytes()
    i = 8
    while i + 8 <= len(b):
        n, t = struct.unpack(">I4s", b[i:i + 8])
        if t == b"iCCP":
            name, rest = b[i + 8:i + 8 + n].split(b"\0", 1)
            try:
                size = len(zlib.decompress(rest[1:]))
            except zlib.error:
                size = "unreadable"
            print(size, name.decode("latin-1"), p, sep="\t")
            break
        if t == b"IDAT":
            break
        i += 12 + n
EOF
python3 scan_iccp.py /var/www/html

Then find the line you see in this list and open its fix:

  1. 1PNG files in the site or app still embed the HP-Microsoft sRGB v2 profileThe scan prints rows that start with 3144, often for icons and images exported years ago
  2. 2Uploaded or downloaded images bring the profile in at runtimeThe scan of your own files is clean, yet new warnings keep arriving when users upload images or a job fetches remote ones
  3. 3The server runs a libpng from before 1.6.47The same images decode silently on a newer machine or container, and only the older server logs the warning

What does the error look like?

  • libpng warning: iCCP: known incorrect sRGB profile
  • The line appears in /var/log/apache2/error.log with no date, client or file name in front of it

Cause 1 of 3

PNG files in the site or app still embed the HP-Microsoft sRGB v2 profile

You seeThe scan prints rows that start with 3144, often for icons and images exported years ago

Check

The iCCP known incorrect sRGB profile warning comes from a checksum table inside libpng. In 1.6.46 and earlier that table marks two 3144-byte profiles named HP-Microsoft sRGB v2 as broken, because their media white point does not match the header. Any PNG holding one of them triggers the line each time it is decoded.

Check
python3 scan_iccp.py /var/www/html | awk -F'\t' '$1 == 3144'

Fix

Back up the files, then remove the ICC profile from each flagged PNG. The flagged profile only describes sRGB, so do this for the 3144 rows, not for files tagged with Display P3 or Adobe RGB profiles.

Fix
cp -a /var/www/html /var/www/html.bak
python3 scan_iccp.py /var/www/html | awk -F'\t' '$1 == 3144 {print $3}' > flagged.txt
# ImageMagick 6 (apt on Ubuntu 24.04); with ImageMagick 7 write: magick mogrify
while IFS= read -r f; do mogrify +profile icc "$f"; done < flagged.txt

Verify

The scan no longer lists any 3144 row, and the warning stops appearing for requests that use those images.

Verify
python3 scan_iccp.py /var/www/html | awk -F'\t' '$1 == 3144' | wc -l

Confirmed by raw.githubusercontent.com

Did this fix it?

Cause 2 of 3

Uploaded or downloaded images bring the profile in at runtime

You seeThe scan of your own files is clean, yet new warnings keep arriving when users upload images or a job fetches remote ones

Check

When the PNGs come from outside, fixing the files on disk once does not help. Apache copies whatever a CGI script writes to stderr straight into the error log, so each new image with the old profile adds another line while your code processes it.

Check
python3 scan_iccp.py /var/www/uploads | awk -F'\t' '$1 == 3144' | head

Fix

Strip profiles as part of the upload step, before the image is stored or resized again. In PHP with the Imagick extension, stripImage removes all profiles and comments; on the command line the ImageMagick -strip option does the same.

Fix
<?php
$img = new Imagick($tmpPath);
$img->stripImage();
$img->writeImage($storedPath);

Verify

Upload a PNG that the scan flagged before. The stored copy has no iCCP chunk and no new warning appears.

Verify
python3 scan_iccp.py /var/www/uploads | grep -c .

Confirmed by php.net

Did this fix it?

Cause 3 of 3

The server runs a libpng from before 1.6.47

You seeThe same images decode silently on a newer machine or container, and only the older server logs the warning

Check

libpng 1.6.47 reworked colour-space chunk handling, and from that release the sources no longer contain the known incorrect sRGB profile check. Ubuntu 24.04 LTS still ships libpng 1.6.43, while Ubuntu 26.04 LTS ships 1.6.57, so the line depends on the system library as much as on the image.

Check
dpkg -s libpng16-16t64 | grep ^Version

Fix

For containers, move the base image to a release with libpng 1.6.47 or newer and rebuild. On a long-lived 24.04 server, keep the system library and clean the images as in cause 1, because the old profile is still in them.

Fix
# Dockerfile
FROM ubuntu:26.04

Verify

dpkg shows 1.6.47 or later inside the rebuilt image, and the warning is gone from its logs.

Verify
docker run --rm my-image dpkg -s libpng16-16t64 | grep ^Version

Confirmed by packages.ubuntu.com

Did this fix it?

How do I stop it coming back?

  • Add the scan to CI and fail the build when any committed PNG reports a 3144-byte profile.
  • Export web images without an embedded colour profile, or with a current sRGB one, in your design tool's export settings.
  • Strip metadata and profiles in the upload handler, so stored images never depend on what the uploader's software embedded.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.