Find article on the Internet: "the second PNG file structure analysis to generate PNG file (on the phone)" (can be in Google search)
I have generated properly according to the format PNG file
Access to other data, the PNG file can have multiple IDAT chunk, but how to organize multiple IDAT PNG files are not detailed,
Made the following experiment, using acdsee open the generated file is wrong,
A 50 lines of 50 list of pixel figure, is divided into two successive IDAT data, first to save 25 rows 50 columns (that is, the upper part of the image), another IDAT deposit 25 rows 50 columns (i.e., image frames), each IDAT CHUNK of no compression x78 LZ77 compression block to 0, 0 xda, 0 x1 at the beginning, then the LEN, NLEN, then the data, then the CRC information,
Surprisingly, two idat, respectively is the upper part of the image and the lower part, if it is a idat, both upper and lower display properly, but together will only display the first idat content, very strange
Look at the picture, the above are upper and lower half a PNG, separate indication is ok, together is not line, the first idat can display, then the second is a blank, don't know how to multiple idat data can be displayed correctly
CodePudding user response:
Help,,, not heavyCodePudding user response:
No one has studied? The w3c document but could not find on this piece of detailed explanationCodePudding user response:
Seems to be quite complicated, it is recommended that first to afa "blog check outhttp://blog.csdn.net/maozefa/
CodePudding user response:
There is no solution, check less than any informationCodePudding user response:
Why not use TPNGObject? Can also compare your concrete implementation and the difference of it, to see what is the problem,CodePudding user response:
Don't know the building Lord of problem solving: no, I have the same problemMy way is to first data block at the beginning, get data block
A0, A1, A2...
Then according to deflate the format of the packaging, that is, in front of each A block of data to increase 0 x01, LEN, ~ LEN, A total of 5 bytes, after packaging data block
B0, B1, B2...
Then zlib format package, that is, in front of each data block B increases CMF and FLG, that you mentioned x78 0, 0 xda, after again pack a block of data
C0, C1, C2...
Then press the IDAT format encapsulate the chunk, got is the same effect as the original poster
Later poring over the PNG agreement, finally see the problem, the key lies in PNG agreement with a statement like this:
"The compressed datastream is then The concatenation of The contents of all The IDAT chunks"
That said the final solution is when you put all the data in a IDAT together of data stream, so before I put all the packaging method after mosaics is a lot of zlib IDAT blocks of data, don't feel quite right, so the method to correct the following:
The first step, according to deflate the format of the packaging, the increase in front of each A block of data 0 x01, LEN, ~ LEN, A total of 5 bytes, after packaging data block
B0, B1, B2...
The second step is different, it should be all the {B1, B2, B3... } as a whole, a complete data flow and data flow of the entire zlib format package, get a large block of data C
The maximum length of data and then according to the requirements of IDAT to block C, into every IDAT, so you can come out the correct image
I hope it can help you