Menu ▾ ▴

#779 GraphicsMagick >= 1.3.48 broke png conversion

v1.0_(example)
closed-fixed
None
5
2026-09-29
2026-09-28
Timo Gurr
No

TYPO3 uses GraphicsMagick to convert images, there's an environment check tool which does a test "Write png" which became broken since updating GraphicsMagick from 1.3.47 to 1.3.48.

works: 1.3.47
broken: >= 1.3.48 including current hg commit fd75d7eb1ec5131efa53c2b0ab044dc6133f5645

The command used is:

'/usr/bin/gm' 'convert' -interlace 'None' -auto-orient '+profile' '*' -auto-orient -geometry 300x225! -colorspace 'RGB' 'png:Test.png[0]' 'installTool-write-pngxxxxx.png'

The image source for the test image is:

https://github.com/TYPO3/typo3/blob/main/typo3/sysext/install/Resources/Public/Images/TestInput/Test.png

Attached you'll find a screenshot of the issue, but it can also easily be reproduced with the command above.

1 Attachments

Discussion

  • Bob Friesenhahn

    Bob Friesenhahn - 2026-09-28
    • assigned_to: Bob Friesenhahn
     
  • Bob Friesenhahn

    Bob Friesenhahn - 2026-09-28

    It is really weird that I used different ways to retrieve 'Test.png' (e.g. 'curl -O' and firefox download from github repository) and I ended up with files with sizes 227181, 379266, or 20061 bytes. The 20061 byte version appears to be the correct one. The larger ones are corrupt and not even PNG files. I eventually checked out the typo3 repository.

    Regardless, I am able to re-create a wrong looking image using the command you supplied.

     
    👍
    1
  • Bob Friesenhahn

    Bob Friesenhahn - 2026-09-28

    Due to GM 1.3.48 doing deeper analysis of the input image pixels (1.3.47 does not), it is writing 24-bit RGB rather than 32-bit RGB+alpha.

    If I use 1.3.47 and add '-type Optimize' it also produces broken output:

    gm convert -interlace 'None' -auto-orient '+profile' '*' -auto-orient -geometry 300x225! -colorspace 'RGB' 'png:Test.png[0]' -type optimize -debug coder 'installTool-write-pngxxxxx.png

    This means that it was actually a previously existing condition which was not encountered/reported. There may be redundant ways to specify the output internally and they are in conflict.

     
  • Bob Friesenhahn

    Bob Friesenhahn - 2026-09-28

    If I modify the above command and add '+matte' before, or after, '-type optimize' then the problem does not happen:

    gm convert -interlace 'None' -auto-orient '+profile' '*' -auto-orient -geometry 300x225! -colorspace 'RGB' 'png:Test.png[0]' +matte -type optimize -debug coder 'installTool-write-pngxxxxx.png

    This command with +matte added works (but the image lacks useless transparency):

    gm convert -interlace 'None' -auto-orient '+profile' '*' -auto-orient -geometry 300x225! -colorspace 'RGB' 'png:Test.png[0]' +matte -debug coder 'installTool-write-pngxxxxx.png'

    From this behavior, I surmise that there is likely another internal variable which conflicts with the image 'matte' flag and disabling 'matte' (transparency) causes the two values to agree.

     
  • Bob Friesenhahn

    Bob Friesenhahn - 2026-09-29

    The problem is now well-understood and has been corrected. In addition to the default output, I have tested the various documented permutations and they all seem to work.

    The fix is submitted to Mercurial as changeset 18163:5a567397c8bc and is included in development snapshot tarball "GraphicsMagick-1.4.020260929".

     
    ❤️
    1
  • Bob Friesenhahn

    Bob Friesenhahn - 2026-09-29
    • status: open --> closed-fixed
     
  • Bob Friesenhahn

    Bob Friesenhahn - 2026-09-29

    Closing as fixed now. Please make sure that all works as you expect. Thank you very much for reporting the issue, and also that typo3 is using GraphicsMagick.

     

Log in to post a comment.