Page 1 of 1

Quality when converting

Posted: 2012-09-04T09:26:27-07:00
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

Re: Quality when converting

Posted: 2012-09-04T09:30:32-07:00
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";

Re: Quality when converting

Posted: 2012-09-04T10:29:49-07:00
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

Re: Quality when converting

Posted: 2012-09-04T11:36:55-07:00
by fmw42
You may need to add -density again after reading the input so that it is specified for the output pdf

Re: Quality when converting

Posted: 2012-09-04T12:11:35-07:00
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

Re: Quality when converting

Posted: 2012-09-04T12:50:43-07:00
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.