Quality when converting

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
Flo
Posts: 3
Joined: 2012-09-04T09:17:39-07:00
Authentication code: 67789

Quality when converting

Post by Flo »

Hi :)

I wrote a script that divides each page of a pdf into two, so that you can print twice as large with the same paper size.
But the quality of file at the end is too low, and I do not know why and how to fix it.
Can you help me please?
Here is the script :

Code: Select all

#!/bin/sh

for var in "$@"; do
    pdfcrop "$var" "$var-crop" # Suppression des marges
    pdftoppm "$var-crop" temp # Convertir la PDF en images
    for f in temp-*.ppm; do # Découpe des images et conversion pdf
	convert "$f" -crop 1x2+00+20@ -scale 100%  +repage +adjoin "$(basename $f .ppm)-1x2@_%d.pdf";
    done
    convert "temp-*@*.pdf" "$(basename "$var" .pdf)-agrandi.pdf" # Assemblage des fichiers PDF agrandis
    rm -r temp* "$var-crop" # Suppression des fichiers temporaires
done
Flo
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Quality when converting

Post by Bonzo »

I would guess that you need to add -density 400 or similar although this will probably mean you need to recalculate your crops etc.

Code: Select all

convert -density 400 "$f" -crop 1x2+00+20@ -scale 100%  +repage +adjoin "$(basename $f .ppm)-1x2@_%d.pdf";
Flo
Posts: 3
Joined: 2012-09-04T09:17:39-07:00
Authentication code: 67789

Re: Quality when converting

Post by Flo »

I tried with this option, but the result is the same.
In fact, the lack of quality not seen the pdf file, but only on paper after printing, maybe the problem is not with imagemagick.

Flo
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Quality when converting

Post by fmw42 »

You may need to add -density again after reading the input so that it is specified for the output pdf
Flo
Posts: 3
Joined: 2012-09-04T09:17:39-07:00
Authentication code: 67789

Re: Quality when converting

Post by Flo »

This is what I tried :

Code: Select all

#!/bin/sh

for var in "$@"; do
    pdfcrop "$var" "$var-crop" # Suppression des marges
    pdftoppm "$var-crop" temp # Convertir la PDF en images
    for f in temp-*.ppm; do # Découpe des images et conversion pdf
	#convert "$f" -crop 1x2+00+20@ -scale 100%  +repage +adjoin "$(basename $f .ppm)-1x2@_%d.pdf";
	convert -density 400 "$f" -crop 1x2+00+20@ -scale 100%  +repage +adjoin "$(basename $f .ppm)-1x2@_%d.pdf";
    done
    convert -density 400 "temp-*@*.pdf" "$(basename "$var" .pdf)-agrandi.pdf" # Assemblage des fichiers PDF agrandis
    rm -r temp* "$var-crop" # Suppression des fichiers temporaires
done
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Quality when converting

Post by fmw42 »

Can you post a link to an example pdf and the exact command to process it rather than the script. That is fill in the parameters with values and file names. That way we can test ourselves to see what may the issue.
Post Reply