Created attachment 371936 [details, diff] enable jpeg2000 compression in pdf files I've tried to convert an image to pdf with jpeg2k compression, like: $ convert test.png -compress JPEG2000 test.pdf Unfortunately I've lost the original error message, but it was something with "DelegateLibrarySupportNotBuiltIn" and referred me to coders/pdf.c, line 1252. However, imagemagick-6.8.8.5 was built with USE=jpeg2k, and I've done this successfully with imagemagick-6.8.6.8 before. Now let's try a plain jpeg2k file: $ convert test.png test.jp2 convert: symbol lookup error: /usr/lib64/ImageMagick-6.8.8/modules-Q16HDRI/coders/jp2.so: undefined symbol: opj_stream_destroy_v3 Nice, a runtime linker error! Let's check the build log: coders/jp2.c:372:7: warning: implicit declaration of function 'opj_stream_destroy_v3' [-Wimplicit-function-declaration] Well, that symbol is not present in any released version of openjpeg, but has been added to svn trunk a year ago. This is probably the cause for bug 501706 and bug 500580, too. The attached patches fix both bugs, at least they work for me.
Created attachment 371938 [details, diff] don't use opj_stream_destroy_v3, fixes linking
I think the last sentence in comment #0 was too ambiguous: > The attached patches fix both bugs, at least they work for me. I was talking about the two errors I described first, not the gentoo bugs (which may be fixed, too, but I didn't test). I should have written: * The second patch fixes the "convert test.png test.jp2" case for me (and probably the two gentoo bugs, too). * The first patch fixes the pdf case for me.
Comment on attachment 371936 [details, diff] enable jpeg2000 compression in pdf files This patch is part of upstream release 6.8.8-8 which I'm adding to Portage now.
fixed in 6.8.8.8, added your patch in, this needs to be reported upstream!
reported here: http://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=25362
(In reply to Samuli Suominen from comment #5) > reported here: > > http://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=25362 and upstream committed a fix to the subversion :)
Created attachment 374512 [details, diff] imagemagick-6.8.8.10-enable-openjp2-delegate-in-pdf-encoder.patch jpeg2000 compression in PDF files is still broken in imagemagick-6.8.8.10. In comment #3 Samuli wrote that the patch from attachment 371936 [details, diff] is part of upstream release 6.8.8-8. This is not correct. Only one file was fixed in that release, the part of the patch which is important for this bug is *not* part of 6.8.8-8 (or 6.8.8-10). I've created a patch with the missing pieces. Here is what hat I did to test imagemagick-6.8.8.10: $ convert test.png -compress jpeg2000 -quality 35 test.pdf convert: delegate library support not built-in `test.pdf' (JP2) @ error/pdf.c/WritePDFImage/1283. $ pdfimages -list test.pdf page num type width height color comp bpc enc interp object ID --------------------------------------------------------------------- 1 0 image 2481 3500 rgb 3 8 image no 8 0 $ ls -ks1 test.{png,pdf} 4012 test.pdf 3136 test.png As you can see, jpeg2000 compression is not used. Instead I get a large file with RLE compression. The same commands after rebuilding with my patch: $ convert test.png -compress jpeg2000 -quality 35 test.pdf $ pdfimages -list test.pdf page num type width height color comp bpc enc interp object ID --------------------------------------------------------------------- 1 0 image 2481 3500 rgb 3 8 jpx no 8 0 $ ls -ks1 test.{png,pdf} 584 test.pdf 3136 test.png It works! The "enc" column shows "jpx" and the file is much smaller. You may want to send this patch upstream, too.
(In reply to Alexander Miller from comment #7) > Created attachment 374512 [details, diff] [details, diff] > imagemagick-6.8.8.10-enable-openjp2-delegate-in-pdf-encoder.patch > > jpeg2000 compression in PDF files is still broken in imagemagick-6.8.8.10. ouch. reported here, http://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=25376 will bump in Portage after morning coffee :p
(In reply to Samuli Suominen from comment #8) > (In reply to Alexander Miller from comment #7) > > Created attachment 374512 [details, diff] [details, diff] [details, diff] > > imagemagick-6.8.8.10-enable-openjp2-delegate-in-pdf-encoder.patch > > > > jpeg2000 compression in PDF files is still broken in imagemagick-6.8.8.10. > > ouch. reported here, > http://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=25376 upstream says he applied your patch :) http://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=25376&sid=4087a8d28aa34175d395029d8e6ea340#p110065 > will bump in Portage after morning coffee :p done. 6.8.8.10-r1