Hello! I was trying to rip sprites from a Java mobile game, specifically a Chinese Pokemon clone, but pretty much all the PNGs in the game lack the chunks necessary for it to be read (stuff like the file header, IDAT, etc.). I was wondering how I would go about fixing the PNGs. I included some samples, 2 being some of the few functioning PNGs in the game, and the other 3 being the ones lacking chunks.
It is still PNG files, but with PNG header, chunk name + crc32 removed, making everything in fixed order.
For example, "img_220.mid" can be read as:
Code:
00 12 bytes PNG IHDR header
- 00 4 bytes width [= 286]
- 04 4 bytes height [= 153]
- 08 1 byte bit depth [= 8-bpp]
- 09 1 byte color type [3=is RGB + has palette]
0c 2 bytes chunk length
if type has palette , then it is PLTE chunk, then followed by tRNS for Alpha.
After that, the next chunk is IDAT chunk.
You can read more about PNG chunks here:
http://www.libpng.org/pub/png/spec/1.2/PNG-Chunks.html
For example, "img_2.mid" has color type = 6, so it is RGB + has alpha. No palette or PLTE chunk.
You can fix the images by reconstructing all headers back.
Good luck,
- Rufas
Thanks! I'll check it out and try to do that.