Page 1 of 1

PNG to PDF comes out very large!

Posted: 2017-06-29T20:36:46-07:00
by johnfl68
Hello:

I have a 8.5" x 11" PNG at 600 DPI (5100x6600 pixels).

When I write to PDF, it comes out 70.83" x 91.67" for some reason.

How do I get a 8.5" x 11" PDF file output??

In searching I have seen others with this issue, but not really a solution.

Thank you for your help as always!

Re: PNG to PDF comes out very large!

Posted: 2017-06-29T20:50:23-07:00
by snibgo
A simple conversion works fine for me, with v6.9.5-3:

Code: Select all

convert t.png t.pdf
The input and output are the same size, in inches.

To help you, we need more information. What version of IM? Exactly what (Perl?) commands did you use? What software says the output is 70.83" x 91.67"? Please tell us what "identify -verbose" says about the "Resolution", "Print size" and "Units", of input and output.

Re: PNG to PDF comes out very large!

Posted: 2017-06-29T21:35:55-07:00
by johnfl68
Hello:

I am working in Perl with:

Code: Select all

use Image::Magick;
Version: ImageMagick 6.8.9-9 Q16 x86_64 2017-05-26 http://www.imagemagick.org

I am not using command line like your convert example, as I work strictly in Perl.

Create new image:

Code: Select all

my $image = Image::Magick->new;
$image->Set(size=>'5100x6600');
Then text is added to the image using standard perl imagemagick scripting like the following:

Code: Select all

        $image_next_hour_title = Image::Magick->new;
        $image_next_hour_title->Set(
            background => $caption_box_color,
            fill       => $fontcolor5,
            gravity    => 'west',
            font       => "$font4",
            pointsize  => 48,
            size       => '600x65'
        );
            $image_next_hour_title->Read("caption:$translations{'NextHour'}->{$language}:");

Code: Select all

    $image->Composite( geometry => '+100+670', image => $image_next_24_title );
And then output:

Code: Select all

$image->Write(filename => '/var/www/html/test0629/testoutput.png' );
$image->Write(filename => '/var/www/html/test0629/testoutput.pdf' );
PNG output is the correct size 5100 x 6600 pixels
PNG size is 70.83" x 91.67" as read by Adobe Acrobat Pro DC Version 2017.009.20044

I can not respond to your other questions, as you assumed I am using the command line. I am not and have never used the command line, that is why I posted in the PerlMagick sub-forum.

Re: PNG to PDF comes out very large!

Posted: 2017-06-30T01:34:49-07:00
by snibgo
I can't see where you set the density (resolution) to 600 dpi.
johnfl68 wrote:PNG size is 70.83" x 91.67" as read by Adobe Acrobat Pro DC Version 2017.009.20044
Perhaps you mean "PDF size is ..." If that really is the PNG size, then that's why the PDF is that size.

You can check the resolution and physical size of the PNG with exiftool or Gimp and probably with PerlMagick.