JPEG2000 to PDF without recompression

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
edwardsj

JPEG2000 to PDF without recompression

Post by edwardsj »

We tried using ImageMagick's "convert" utiltiy from the command line to convert JPEG2000 images to PDF, but it looks like convert is recompressing the souce images. Is there some setting that would turn off recompression and just "wrap" PDF around the original JPEG2000 data?

DETAILS: We have zillions of JPEG2000 scans of historic government land documents, and some of our users want to download them in PDF format. It is my understanding that Adobe Viewer and PDF support JPEG2000 inherently, so we should be able to generate PDFs from our JPEG2000 files without recompressing and sacrificing image quality. When we tried using ImageMagick's convert utility, it generated a PDF that was much larger than the JPEG2000 original file. We tried various settings for image quality and compression, but it really seems like there's no "don't recompress" option.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: JPEG2000 to PDF without recompression

Post by magick »

Did you try
  • convert image.jp2 -compress JPEG2000 image.pdf
ImageMagick will uncompress image.jp2 and then compress it before its written to PDF. It would be simple enough to modify ImageMagick to inject the original image in the PDF stream. It would be even easier to write a simple wrapper program for your JPEG2000 images or use an off-the-shelf PDF library SDK. If you write your own wrapper, make sure it conforms to the PDF/A standard.
edwardsj

Re: JPEG2000 to PDF without recompression

Post by edwardsj »

Thanks for the information, that's what we wanted to know. We have looked at some PDF SDKs but haven't yet found one that is smart enough to not recompress JPEG2000.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: JPEG2000 to PDF without recompression

Post by magick »

We could code up a wrapper for you if you sent your requirements. There of course would be a modest charge for our time. If interested, send us a private message (PM) to discuss.
dingodog
Posts: 1
Joined: 2011-08-21T10:37:06-07:00
Authentication code: 8675308

Re: JPEG2000 to PDF without recompression

Post by dingodog »

magick wrote:We could code up a wrapper for you if you sent your requirements. There of course would be a modest charge for our time. If interested, send us a private message (PM) to discuss.
I also I'm interested
josch
Posts: 2
Joined: 2012-03-29T02:18:00-07:00
Authentication code: 8675308

Re: JPEG2000 to PDF without recompression

Post by josch »

I wrote a tool that does what you want with JPEG and JPEG2000 files. It just embeds them into the pdf without any re-encoding. If any other file type is given, it is just flate encoded. It can also output a multipage pdf.

https://github.com/josch/img2pdf
Post Reply