Accessing PNG compressed image data #3961
-
This is a bit of a niche use case, so I expect that the answer is "no", but is it possible to get PNG compressed image data, without it being wrapped in a PNG file format? Effectively I would like the contents of the PNG The reason this is useful is that PDFs allow images to be embedded using both the PNG filtering and PNG compression algorithms, but don't want all the PNG headers. So currently I am asking libvips to generate a PNG into a buffer, parsing the chunk headers, concatenating the Edit: As an aside: I believe PDFs should also support CMYK (4-channel) images with the PNG filtering and compression applied. I'm sure that would be a bigger change for libvips to support, but in a dream scenario that would be possible too. 😄 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @tonymarklove, Sorry, I think that's a bit too specialised for libvips. It aims to be a general image processing library and doesn't have much support for the insides of specific file formats, other than trying to load and save quickly. Have you had a look at libspng? I think it'll (probably!) do what you want: https://github.com/randy408/libspng Re. PDFs -- libvips uses either poppler or PDFium for PDF rendering, so PNG compression for CMYK data would need to be implemented in one of those libraries. I'd check their feature lists and see what they have. |
Beta Was this translation helpful? Give feedback.
Hi @tonymarklove,
Sorry, I think that's a bit too specialised for libvips. It aims to be a general image processing library and doesn't have much support for the insides of specific file formats, other than trying to load and save quickly.
Have you had a look at libspng? I think it'll (probably!) do what you want:
https://github.com/randy408/libspng
Re. PDFs -- libvips uses either poppler or PDFium for PDF rendering, so PNG compression for CMYK data would need to be implemented in one of those libraries. I'd check their feature lists and see what they have.