[BUG] Fox5Image.toPIL() appears to produce incorrect colors
Closed this issue · 1 comments
agnewhawk commented
The bug
When using Fox5Image.toPIL() to convert a Fox5 image to a PIL image, the resultant image appears to have incorrect colors
-
Resulting image that was saved from the PIL object produced by Fox5Image.toPIL() - It appears that only the green channel from the image and arbitrary transparency is saved.
Proposed solution
It appears that the issue is on this line here.
Line 67 in 58410b1
When the line is substituted as follows
data += bytes((self.data[pixel+1], self.data[pixel+2], self.data[pixel+3], self.data[pixel+0]))
the colors should be saved correctly.
Test code
Below is the code snippet I used to save the above images from a fox file, for reference - in case there's something in my code that may have caused the issue instead.
from libfurc import fox5
def getImage(fox,id):
return fox.body["ImageList"][id]
fox = fox5.load("exportTest.fox")
img = getImage(fox,0)
img = img.toPIL()
img.save("testcard.png")
#img.show()