Post without Account — your post will be reviewed, and if appropriate, posted under Anonymous. You can also use this link to report any problems registering or logging in.

JPEG2000 image file support

  • 3 Replies
  • 247 Views
*

Offline Phil

  • Global Moderator
  • Sr. Member
  • *****
  • 456
    • View Profile
JPEG2000 image file support
« December 11, 2018, 02:33:21 PM »
In Problem extracting pages from PDF v. 1.6 documents, carylewis replied 29 July 2018:

Quote
I’m seeing more and more jp2 files, and pdf 1.4 doesn’t support that fije type. This necessitates converting files to 1.4 and that means converted the jpeg2000 images to tiff which is slow.

I'll throw support of JPEG2000 images into the hopper. The first thing is to confirm that some PDF 1.x version properly handles it. I've seen claims that it's in PDF 1.5.

*

Offline Phil

  • Global Moderator
  • Sr. Member
  • *****
  • 456
    • View Profile
Re: JPEG2000 image file support
« Reply #1: December 18, 2018, 01:18:16 PM »
I've done some reading on JPEG2000 (.jp2, .jpx). Apparently it has some much-improved compression algorithms (less artifacting, smaller size, or lossless compression if desired). However, uptake has been very slow, and it has little support. Nonetheless, if I can get some documentation on it, I can consider how much effort it will take to implement it. There's also the question of patents used in it, and whether they've expired by now (same goes for GIF and LZW). If it's a big project, it may not be worth doing unless there is more demand for JPEG2000 support (so far, only one request). I don't see any libraries on CPAN for this format.

*

Offline Phil

  • Global Moderator
  • Sr. Member
  • *****
  • 456
    • View Profile
Re: JPEG2000 image file support
« Reply #2: January 11, 2019, 10:00:05 AM »
Browsing the PDF documentation some more, it talks a bit about JP2/JPX using the JPXDecode filter instead of JPEG's DCTDecode. If that's all it is (or at least, covers most of the waterfront), it shouldn't be too much effort to put this in PDF::Builder as a PDF-1.5 feature. However, the JPEG2000 pages talk about all sorts of other features and capabilities (e.g., opacity by band, combining multiple images at different samplings into one, etc.) that leads me to suspect that there may be much more work to do. At the least, it should benignly ignore extra features and still do the basic job of showing a JP2/JPX image. At this point, unless a CPAN library shows up that handles it for me, I'll have to wait until someone knowledgeable in JPEG2000 can lend a hand.

*

Offline Phil

  • Global Moderator
  • Sr. Member
  • *****
  • 456
    • View Profile
Re: JPEG2000 image file support
« Reply #3: February 08, 2019, 11:04:30 AM »
It seems that there is another contender who's thrown its hat into the ring: WebP from Google. Its chief claim to fame seems to be an improvement to the compression method (both lossless compression, like PNG, and lossy compression, like JPEG) giving smaller files. .webp support is now built in to Chrome, Edge, and Firefox. See https://developers.google.com/speed/webp/ .

I expect that we would have to await a new filter to be supplied to PDF readers to allow this format to be used. Maybe something would have to be done on the PDF::Builder end to do more than just specify a new filter.

In the meantime, there are tools to convert .webp into other formats such as PNG and JPEG, so not all is lost if only WebP images are available.
« Last Edit: February 08, 2019, 02:30:08 PM by Phil »