Стал разбирать заголовок pcx и искать в нём проблему. Сперва думал, что всё упирается в занулленую палитру, но ошибся, оказывается играться нужно со значением "video memory bytes per image row", но как его правильно посчитать?
offset size de******ion
dec
0 1 manufacturer byte, must be 10 decimal
1 1 PCX version number
0 = PC Paintbrush version 2.5
2 = PC Paintbrush 2.8 with palette information
3 = PC Paintbrush 2.8 without palette information
4 = PC Paintbrush for Windows
5 = PC Paintbrush 3.0 or later, PC Paintbrush Plus
2 1 run length encoding byte, must be 1
3 1 number of bits per pixel per bit plane
4 8 image limits in pixels: Xmin, Ymin, Xmax, Ymax
12 2 horizontal dots per inch when printed (unreliable)
14 2 vertical dots per inch when printed (unreliable)
16 48 16-color palette (16 RGB triples between 0-255)
64 1 reserved, must be zero
65 1 number of bit planes
66 2 video memory bytes per image row
68 2 16-color palette interpretation (unreliable)
0 = color or b&w, 1 = grayscale
70 2 horizontal screen resolution - 1 (unreliable)
72 2 vertical screen resolution - 1 (unreliable)
74 54 reserved, must be zero