-
Notifications
You must be signed in to change notification settings - Fork 10k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JPX rendering issues #5649
Comments
I wonder which features of those images are actually supported by the pdf standard. The pdf specification says at page 87: To promote interoperability, the specifications define a subset of JPX called JPX baseline (of which JP2 is also a subset). The complete details of the baseline set of JPX features are contained in ISO/IEC 15444-2, Information Technology—JPEG 2000 Image Coding System: Extensions. Unfortunately, the JPEG2000 spec isn't freely available to check the baseline feature set. By the way, the image corpus of the second file can be found at http://www.gwg.nga.mil/ntb/baseline/software/testfile/Jpeg2000/index.htm, where they also list the jpeg2000 feature sets of the individual images and a copyright notice |
I think this is related to #5727. This behavior is very similar to what I experienced. Boats.pdf and ballon.pdf both contains image with multiple quality layers. Unfortunately, it does not fix this issue. Everything read after the bug occurs is misaligned causing the "Out of packets" error. When reading boat.pdf and ballons.pdf with PR #5727, "JPX Error: Invalid tag tree" is thrown suggesting that the inclusion tree was not built while decoding the first layer. |
+1 to fix this issue(s). Is there anyone currently working in improving j2k support in pdf.js? |
Not that I'm aware of. Please note that the image I posted might not be supported by the PDF standard, so there might be no need to actually support them. |
Thanks. How would I find out what part of the jpeg 2000 standard is supported by PDF ? All of the images in the OpenJPEG repo are jpeg 2000 Part I images. |
Hard to say because from #5649 (comment) it appears that the baseline set is not freely available. We might need to check what other PDF readers support. |
Thanks. From the standard doc: "To promote interoperability, the specifications define a subset of JPX called So, since all of the files in the OpenJPEG repo are jp2 files (jp2 == jpeg 2000 part I), pdf.js should support them. Perhaps you can interest some of the OpenJPEG guys in taking a look at the issues. |
Another example: |
Another JPX that fails to be rendered on PDF.js 2.16.75. Works well on Preview.app and all other tested PDF viewers. wu-89008118317-11-1660897219.pdf.
|
Unfortunately none of the PDF links in #5649 (comment) work now, and given #5649 (comment) it's not clear if those JPEG2000 images are actually supported when used in PDF files. @timvandermeij Given the points above, and the age of this issue, should we perhaps close this one now? |
Here's an easy way to reproduce the issue:
In this case, the transparent pixels are just shown as black, but I've seen cases where the image is missing entirely. Files involved: samples.zip
Regarding whether the
The "Component Definition box" mentioned in the document is the #define JP2_JP 0x6a502020 /**< JPEG 2000 signature box */
#define JP2_FTYP 0x66747970 /**< File type box */
#define JP2_JP2H 0x6a703268 /**< JP2 header box (super-box) */
#define JP2_IHDR 0x69686472 /**< Image header box */
#define JP2_COLR 0x636f6c72 /**< Colour specification box */
/* ... */
#define JP2_CMAP 0x636d6170 /**< Component Mapping box */
#define JP2_CDEF 0x63646566 /**< Channel Definition box */
/* ... */ Also, the document mentioned that ISO/IEC 15444-2 supports multi-component images. And in the PDF standard excerpted above:
Considering all of those secondary evidence together, I do feel they make a strong case for the standardized inclusion of at least some of the unimplemented features reported in this issue. |
Closing since most files aren't available anymore and the ones that are render fine now, most likely thanks to #17946. Moreover, given that we delegate JPX parsing to OpenJPEG now we can also be sure that any spec-compliant images will be handled properly now. |
While testing various .jp2 files, I have come across numerous images that are not rendered correctly by PDF.js, mainly because of unimplemented header types. I'm listing the broken PDFs along with the source of their images below.
First file
PDF
https://pdf.yt/d/fSMs0rOfBIjacwHv
Source
Images taken from https://code.google.com/p/openjpeg/source/browse/data/input/conformance/?r=2833, files
subsampling_1.jp2
andsubsampling_2.jp2
License
See https://code.google.com/p/openjpeg/source/browse/data/input/conformance/COPYRIGHT?r=2833. I don't think it's permissive enough to include them in the repository.
Console output
Second file
PDF
https://pdf.yt/d/Zd4e1zB9oGGPBO85
Source
Images taken from https://code.google.com/p/openjpeg/source/browse/data/input/conformance/?r=2833, files
file1.jp2
tofile9.jp2
License
See https://code.google.com/p/openjpeg/source/browse/data/input/conformance/COPYRIGHT?r=2833. I don't think it's permissive enough to include them in the repository.
Console output
Third file
PDF
https://pdf.yt/d/heg0slSRtdEA-vqi
Source
Image taken from http://opf-labs.org/format-corpus/jp2k-formats/, file
balloon.jp2
License
From http://opf-labs.org/format-corpus/jp2k-formats/readme.md: created from https://commons.wikimedia.org/wiki/File:1783_balloonj.jpg, which is in public domain, so we can include this file in the repository.
Console output
The text was updated successfully, but these errors were encountered: