Hi everyone I need help with python pillow. I'm currently using v2.3.0 and python 3.3.
I'm trying to use pcx images extracted from an old game (Might and Magic VI) as textures. (The game has 2D UI over the 3D environment. This 2D UI is composed by various internal formats and pcx files.)
The problem is that one of these pcx is displayed incorrecly by pillow. while being displayed correctly by EyeOfGnome image viewer. (gdk-pixbuf) Another pcx is displayed correctly by pillow!
What do I mean by incorrectly? The bad image has a kind of "red shift" of pixels colors. the left border is a bit red. It' like a "3D-ified" image, it's a bit blurry and the whole is a bit darker.
I would like it to be composed with other parts of the game UI, I can't use it like that.
I opened the pcx files with an hex editor and the main difference I spotted in the pcx-header is that the wrong one has the BYTE Palette[48]; field completely empty. while the other one has some data in it. But it shoudn't be a problem because other viewers display it correctly.
struct PcxHeader
{
BYTE Identifier; // PCX Id Number (Always 0x0A) // 10
BYTE Version; // Version Number // 5
BYTE Encoding; // Encoding Format // 1
BYTE BitsPerPixel; // Bits per Pixel // 8
WORD XStart; // Left of image // 0
WORD YStart; // Top of Image // 0
WORD XEnd; // Right of Image // 319
WORD YEnd; // Bottom of image // 199
WORD HorzRes; // Horizontal Resolution // 320
WORD VertRes; // Vertical Resolution // 200
BYTE Palette[48]; // 16-Color EGA Palette
BYTE Reserved1; // Reserved (Always 0)
BYTE NumBitPlanes; // Number of Bit Planes // 1
WORD BytesPerLine; // Bytes per Scan-line // 320
WORD PaletteType; // Palette Type // 0
WORD HorzScreenSize; // Horizontal Screen Size // 0
WORD VertScreenSize; // Vertical Screen Size // 0
BYTE Reserved2[54]; // Reserved (Always 0)
};
This is a piece of the test code.
def showpcx(fname):
img = Image.open(fname)
img.show()
showpcx("border1.pcx")
showpcx("border2.pcx")
this archive contains the files https://db.tt/td291VTh