pdfjs
pdfjs copied to clipboard
PNG image support
I recognize that the library doesn't currently support PNG images.
I looked into the effort involved, and created a fork with an initial attempt at it. Parsing image dimensions was easy, but dealing with color profiles and transparency is much more work. I had it working at one point, but don't have a decent example of it yet.
Any advice on how to move forward, or if this feature is planned?
Hi @ismyrnow, thanks for having a look into a PNG implementation. I definitely plan on adding it, but because of the effort required and the fact that I am currently mostly fine with embedding existing PDFs as images, I've not yet started in doing so. Anyway, I'll try to have a look at you initial attempt in the next couple of days; maybe I can help or can use it as a starting point :-)
I seems that PNGs need to be split into image data (IDAT), palette (PLTE) and a color profile (iCCP) object. That is, embedding PNGs is not as simple as embedding JPEGs. For parsing PNGs, I think an external library would make totally sense. However, I was not yet able to find one that I would be happy with (e.g. not browser compatible or no 16bit png support ...). I am not yet sure how to tackle this, but will keep thinking about it.
Really looking forward to PNG support 👍