I'm trying to make a small python program that combines images in different ways, but when I try to open an image it throws:
png.FormatError: FormatError: PNG file has invalid signature.
Here's the code:
from png import Reader, Writer
from sys import argv
from io import StringIO
fileName = argv[1];
directions = ["left", "right", "top", "bottom"]
readers = {
"left": Reader(StringIO(
"\"folder"+fileName+"_left.png\""
)),
"right": Reader(StringIO(
"\"folder"+fileName+"_right.png\""
)),
"top": Reader(StringIO(
"\"folder"+fileName+"_top.png\""
)),
"bottom": Reader(StringIO(
"\"folder"+fileName+"_bottom.png\""
))
}
images = {
"left": list(),
"right": list(),
"top": list(),
"bottom": list()
}
for direction in directions:
reader = readers[direction]
image = images[direction]
tempImage = reader.asRGBA8() # error
I'm sure the file isn't corrupted, as it opens just fine in everything (aseprite, gimp, paint, paint.net and krita), what else could cause this error?