Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[solved] jpg-pdf conversion: pdf 10 times larger
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Multimedia
View previous topic :: View next topic  
Author Message
freifunk_connewitz
Tux's lil' helper
Tux's lil' helper


Joined: 08 Feb 2006
Posts: 139

PostPosted: Thu Feb 20, 2014 5:45 pm    Post subject: [solved] jpg-pdf conversion: pdf 10 times larger Reply with quote

hi,

probably the last big package update broke jpg-to-pdf-conversion on my system. I'm heavily depending on imagemagick's 'convert' to process bunches of JPGs at a time and put them into one single PDF file. but today, suddenly, the PDFs I ended up with were more than 10 times larger than they should be, and than they have always been. does anybody have an idea what could be gone wrong here?

the usual command is:
Code:
convert RIM*.JPG -rotate 90 -quality 60 foo.pdf


which normally gives me PDFs of about 70% of the size of all the processed JPGs.

but now every JPG of 1,5 MB gets bloated to 20 MB of PDF. why?

I tried to mess around with -resize and -quality. with -resize I can make them smaller, but even when the resulting PDF is almost not readable anymore it is still bigger than the original JPG.
as for the -quality option: strange enough, this does not have ANY influence. whatever I put there, from 1 to 100, the PDF is the same size and picture quality.

so it seems like something broke the jpg-2pdf-converter. but which one is used by imagemagick? inbuilt?
I also tried to remerge imagemagick, pyPdf, qpdf and pdfbox.

now I am clueless what elso to do. please help.


Last edited by freifunk_connewitz on Mon Feb 24, 2014 10:54 pm; edited 2 times in total
Back to top
View user's profile Send private message
i92guboj
Moderator
Moderator


Joined: 30 Nov 2004
Posts: 10219
Location: Córdoba (Spain)

PostPosted: Thu Feb 20, 2014 6:22 pm    Post subject: Re: jpg tp pdf conversion: pdf files suddenly 10 times large Reply with quote

freifunk_connewitz wrote:
hi,
so it seems like something broke the jpg-2pdf-converter. but which one is used by imagemagick? inbuilt?


Not sure. Either builtin or ghostscript-gpl which is a dependency, I guess.

I'd start by checking the last entries in /var/log/emerge.log and seeing if either imagemagick or ghostscript-gpl have been updated lately. You can try downgrading one or both of these and see what happens.

You can force an specific version by doing

Code:
$ emerge -va =package-<version>

_________________
Gentoo Handbook | My website
Back to top
View user's profile Send private message
khayyam
Advocate
Advocate


Joined: 07 Jun 2012
Posts: 2950

PostPosted: Thu Feb 20, 2014 9:58 pm    Post subject: Reply with quote

freifunk_connewitz, i92guboj ...

I don't think it has any relation to the recent ghostscript-gpl-9.10-r2 update as I'm using it with media-gfx/graphicsmagick and don't have a similar problem ...

Code:
% ls
1.jpg  2.jpg  3.jpg  4.jpg  5.jpg  6.jpg  7.jpg  8.jpg
% du -lh
  3.8M    .
% convert *.jpg -rotate 90 -quality 60 out.pdf
% ls -lh out.pdf
-rw------- 1 khayyam users 1.1M 2014-02-20 22:30 out.pdf

HTH & best ... khay
Back to top
View user's profile Send private message
freifunk_connewitz
Tux's lil' helper
Tux's lil' helper


Joined: 08 Feb 2006
Posts: 139

PostPosted: Fri Feb 21, 2014 11:41 am    Post subject: Reply with quote

thanks a lot, i92guboj and khayyam

I downgraded imagemagick from 6.8.8.5 to 6.8.6.8 and convert works as before. gonna try to file the bug to them...
and maybe I'll give graphicsmagick a try. how come they are allowed to reside on the same system but using the same commands (convert)?
Back to top
View user's profile Send private message
khayyam
Advocate
Advocate


Joined: 07 Jun 2012
Posts: 2950

PostPosted: Fri Feb 21, 2014 11:46 am    Post subject: Reply with quote

freifunk_connewitz wrote:
[...] maybe I'll give graphicsmagick a try. how come they are allowed to reside on the same system but using the same commands (convert)?

freifunk_connewitz ... media-gfx/grahicsmagick has a "imagemagick" useflag that will have graphicsmagick act as a drop in replacement. Obviously with this useflag enabled imagemagick can't be installed at the same time.

best ... khay
Back to top
View user's profile Send private message
freifunk_connewitz
Tux's lil' helper
Tux's lil' helper


Joined: 08 Feb 2006
Posts: 139

PostPosted: Fri Feb 21, 2014 11:51 am    Post subject: Reply with quote

yeah, just read that thread ;)
but IF I have both installed, how do I make use of GM's 'convert' command?
Back to top
View user's profile Send private message
i92guboj
Moderator
Moderator


Joined: 30 Nov 2004
Posts: 10219
Location: Córdoba (Spain)

PostPosted: Fri Feb 21, 2014 11:59 am    Post subject: Reply with quote

There's a chance that the problem in is Gentoo's side, though. Just keep that in mind. This is the diff between the two ebuilds.

Code:
--- imagemagick-6.8.6.8.ebuild   2013-09-07 22:31:21.000000000 +0200
+++ imagemagick-6.8.8.5.ebuild   2014-02-20 16:01:21.000000000 +0100
@@ -1,6 +1,6 @@
-# Copyright 1999-2013 Gentoo Foundation
+# Copyright 1999-2014 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/media-gfx/imagemagick/imagemagick-6.8.6.8.ebuild,v 1.12 2013/09/07 20:16:31 ago Exp $
+# $Header: /var/cvsroot/gentoo-x86/media-gfx/imagemagick/imagemagick-6.8.8.5.ebuild,v 1.6 2014/02/20 14:45:59 ago Exp $
 
 EAPI=5
 inherit multilib toolchain-funcs versionator libtool flag-o-matic eutils
@@ -13,8 +13,9 @@
 
 LICENSE="imagemagick"
 SLOT="0/${PV}"
-KEYWORDS="alpha amd64 arm hppa ia64 ~mips ppc ppc64 ~s390 ~sh sparc x86 ~ppc-aix ~amd64-fbsd ~x86-fbsd ~x86-interix ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~x64-solaris ~x86-solaris"
-IUSE="autotrace bzip2 corefonts cxx djvu fftw fontconfig fpx graphviz hdri jbig jpeg jpeg2k lcms lqr lzma opencl openexr openmp pango perl png postscript q32 q64 q8 raw static-libs svg test tiff truetype webp wmf X xml zlib"
+# KEYWORDS="~alpha ~ppc64 ~sparc ~amd64-fbsd" dropped because of missing KEYWORDS in app-text/mupdf wrt #491876
+KEYWORDS="~alpha amd64 ~arm hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~x86-fbsd ~x86-interix ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~x64-solaris ~x86-solaris"
+IUSE="autotrace bzip2 corefonts cxx djvu fftw fontconfig fpx graphviz hdri jbig jpeg jpeg2k lcms lqr lzma opencl openexr openmp pango pdf perl png postscript q32 q64 q8 raw static-libs svg test tiff truetype webp wmf X xml zlib"
 
 RESTRICT="perl? ( userpriv )"
 
@@ -29,14 +30,15 @@
    graphviz? ( media-gfx/graphviz )
    jbig? ( media-libs/jbigkit )
    jpeg? ( virtual/jpeg:0 )
-   jpeg2k? ( media-libs/jasper )
+   jpeg2k? ( media-libs/openjpeg:2 )
    lcms? ( media-libs/lcms:2 )
    lqr? ( media-libs/liblqr )
    opencl? ( virtual/opencl )
-   openexr? ( media-libs/openexr )
+   openexr? ( media-libs/openexr:0= )
    pango? ( x11-libs/pango )
-   perl? ( >=dev-lang/perl-5.8.8 )
-   png? ( media-libs/libpng:0 )
+   pdf? ( app-text/mupdf:0= )
+   perl? ( >=dev-lang/perl-5.8.8:0= )
+   png? ( media-libs/libpng:0= )
    postscript? ( app-text/ghostscript-gpl )
    raw? ( media-gfx/ufraw )
    svg? ( gnome-base/librsvg )
@@ -45,7 +47,7 @@
       media-fonts/urw-fonts
       >=media-libs/freetype-2
       )
-   webp? ( media-libs/libwebp )
+   webp? ( media-libs/libwebp:0= )
    wmf? ( media-libs/libwmf )
    X? (
       x11-libs/libICE
@@ -68,6 +70,14 @@
 
 src_prepare() {
    elibtoolize # for Darwin modules
+
+   # http://bugs.gentoo.org/472766
+   shopt -s nullglob
+   cards=$(echo -n /dev/dri/card* | sed 's/ /:/g')
+   if test -n "${cards}"; then
+      addpredict "${cards}"
+   fi
+   shopt -u nullglob
 }
 
 src_configure() {
@@ -107,11 +117,12 @@
       $(use_with graphviz gvc) \
       $(use_with jbig) \
       $(use_with jpeg) \
-      $(use_with jpeg2k jp2) \
+      $(use_with jpeg2k openjp2) \
       --without-lcms \
       $(use_with lcms lcms2) \
       $(use_with lqr) \
       $(use_with lzma) \
+      $(use_with pdf mupdf) \
       $(use_with openexr) \
       $(use_with pango) \
       $(use_with png) \


As you see, there have been some changes regarding pdf and jpeg2k (not sure if that will affect regular jpeg files though).

mupdf has been introduced as a dependency, I don't know if that could have caused the issues you are describing. I tell you this just so you keep it in mind when reporting it upstream.
_________________
Gentoo Handbook | My website
Back to top
View user's profile Send private message
khayyam
Advocate
Advocate


Joined: 07 Jun 2012
Posts: 2950

PostPosted: Fri Feb 21, 2014 12:07 pm    Post subject: Reply with quote

freifunk_connewitz wrote:
[...] but IF I have both installed, how do I make use of GM's 'convert' command?

freifunk_connewitz ... 'convert' is just a symlink to 'gm' (which is the result of 'magick-compat' enabled by the 'imagemagick' useflag) without such a symlink one would call 'gm' directly, ie:

Code:
% gm convert *.jpg -rotate 90 -quality 60 out.pdf

best ... khay
Back to top
View user's profile Send private message
freifunk_connewitz
Tux's lil' helper
Tux's lil' helper


Joined: 08 Feb 2006
Posts: 139

PostPosted: Fri Feb 21, 2014 1:54 pm    Post subject: Reply with quote

thank you both!
I filed the bug upstream, mentioning your considerations. let's see what they say.
Back to top
View user's profile Send private message
freifunk_connewitz
Tux's lil' helper
Tux's lil' helper


Joined: 08 Feb 2006
Posts: 139

PostPosted: Mon Feb 24, 2014 10:53 pm    Post subject: Reply with quote

the imagemagick guys came back with a solution:

add
Code:
-compress jpeg

to the command. that did it.

so obviously, since version 6.8.8, you have to issue this additional option with every command in order to have pdfs with jpeg compressed images when putting together jpeg files :/

but, well, it works again as expected.
Back to top
View user's profile Send private message
i92guboj
Moderator
Moderator


Joined: 30 Nov 2004
Posts: 10219
Location: Córdoba (Spain)

PostPosted: Tue Feb 25, 2014 9:38 am    Post subject: Reply with quote

Thanks for the feedback. It might come in handy.
_________________
Gentoo Handbook | My website
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Multimedia All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum