Official DCX sample file cannot be read from GraphicsMagick
Swiss army knife of image processing
Brought to you by:
bfriesen
Graphics Magick refuses to load official DCX sample image listed here:
http://justsolve.archiveteam.org/wiki/DCX
D:\temp\30>gm.exe identify SAMPLE.DCX
gm.exe identify: Improper image header (SAMPLE.DCX).
gm.exe identify: Request did not return an image.
I have analyzed file and it looks fine without any problems. My own tool can read it without any problems. It looks that .DCX reader implementation is faulty.
D:\temp\30>gconvert SAMPLE.DCX SAMPLE.png
<<< GCONVERT >>> Convert picture format (c)1997-2026 F&TSoft, version 2.85
Loading
OK
Converted .DCX from my utility as a reference.
Please note .DCX fileformat chart: https://formats.kaitai.io/pcx_dcx/

Last edit: Jaroslav Fojtik 2 days ago
I notice that latest ImageMagick 7 also cannot read this DCX file.
In GM, the (initial?) problem seems related to a bytes-per-line value which is computed based on multiplying columns and bits-per-pixel. This file computes 216, but the code requires at least 217.
Where can we find the source code for your utility?
I do not understand this limit. I do not remember to implement something like this.
You can get my utility from here: https://ftsoft.com.cz/pictures/pictures.html
It can be compiled under Linux, but it was not so heavily tested.
I discovered that many DCX files can no longer be read due to a problematic file size sanity check. I have committed a fix for that file size check. Unfortunately, the issue reported here is due to a different check.
Here you can find several DCX images to test: https://sembiance.com/fileFormatSamples/image/dcx/
PCX/DCX standard does not specify sanity checks.
The link you referenced was where I found several very useful DCX files,
including some which suffer from the same bug you reported.
On Fri, Sep 11, 2026, 4:11 PM Jaroslav Fojtik fojtik@users.sourceforge.net
wrote:
Related
Bugs: #776