This is a discussion on compressing and uncompressing png file within the Game Development forums, part of the Software Development category; You are almost right. It should be (width+1)*height+11. Afaik the '+1' is the byte used to seperate ...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
| |||
| Quote:
A-HA! (No, not the band.) Got it! Each scanline is being presented in its own deflate block. So you have to add 4 bytes (LEN and NLEN) to each one. It becomes 3 (for flags) + (width+5)*height + 4 (for adler) => (width+5)*height + 7. Again, that does not include the IDAT label, size and CRC, which represent a further 12 bytes (right?). Your comment on the scanline separator was what got me the solution. I think I missed a couple of bytes somewhere, but I'm not sure. PNG Specification: Deflate/Inflate Compression RFC 1950 (rfc1950) - ZLIB Compressed Data Format Specification version 3.3 RFC 1951 (rfc1951) - DEFLATE Compressed Data Format Specification version Cool, now I can sleep tonight. Cheers! |
| Sponsored Links |
| |||
| Quote:
test case: width:144 height: 43 Shold be: (width+1+2+2)*height+4+3+4+4 = 6422 GIMP uncompressed IDAT: 6246 PngOut uncompressed IDAT: 6456 |
| |||
| Quote:
Let me stop you right there. Correctness is defined by whether it can be correctly read by a compliant parser. Like, there are several different ways for me to say this to you, and none of them are more "correct" than the others (although the correct ones probably don't start with "like"). Specifically, you can split the data in deflate blocks wherever you want, as long as they're all within the 32k boundary. PNGOut is splitting them at each scanline -- probably due to lazyness more than anything else, since he thought nobody would use the uncompressed format. GIMP is splitting it in a different way. But they are both "correct". So there. So long, and until the next mistery...! Cheers! PS: Thanks for the puzzle. Please do post other questions like yours, it's very interesting stuff. ![]() |
| |||
| Quote:
Quote:
![]() |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| File extension of the code file & object repository file in QTP | vigneshgets | Testing Tools | 1 | 01-16-2008 11:43 PM |
| How can I extract just the extension file name from a forms file upload field? | itbarota | HTML, CSS and Javascript Coding Techniques | 1 | 10-22-2007 08:32 AM |
| convert Excel file to CSV(or text) file using java | mobilegeek | Java Programming | 2 | 09-06-2007 06:42 AM |
| Difference between a file and Random access file Classes | anbuchezhians | Java Programming | 1 | 08-08-2007 02:53 AM |
| set the file path for file type input tag | Jeyaseelansarc | PHP Programming | 0 | 05-19-2007 05:01 AM |