Page 1 of 1

PNG to PDF Issue

Posted: 2013-02-19T05:54:56-07:00
by hem100
Hello All,

I am trying to convert a png file to pdf format. Using a simple command : convert {inputfile} -set units PixelsPerInch -quiet {outputfile} .

The conversion works fine, but the problem is not the entire image is converted. I mean some part around the edges is being cropped out in the generated pdf. Can any body help me in finding out why this is happening ?

The image magick version that I am using is : ImageMagick 6.2.8 08/25/10 Q16

Re: PNG to PDF Issue

Posted: 2013-02-19T07:36:41-07:00
by snibgo
I suggest you upgrade to the current IM. If that doesn't help, put your PNG on a free site and post the URL here.

Re: PNG to PDF Issue

Posted: 2013-02-19T07:58:44-07:00
by glennrp
hem100 wrote:Hello All,

I am trying to convert a png file to pdf format. Using a simple command : convert {inputfile} -set units PixelsPerInch -quiet {outputfile} .

The conversion works fine, but the problem is not the entire image is converted. I mean some part around the edges is being cropped out in the generated pdf. Can any body help me in finding out why this is happening ?

The image magick version that I am using is : ImageMagick 6.2.8 08/25/10 Q16
Does the PNG image contain offset and canvas info? I.e., oFFs and vpAg chunks?
Use "identify -verbose input.png" to find out.
You can remove those with "convert input.png -strip png_without_offsets.png"
and then proceed as before.

Re: PNG to PDF Issue

Posted: 2013-02-19T08:57:34-07:00
by hem100
glennrp wrote:
hem100 wrote:Hello All,

I am trying to convert a png file to pdf format. Using a simple command : convert {inputfile} -set units PixelsPerInch -quiet {outputfile} .

The conversion works fine, but the problem is not the entire image is converted. I mean some part around the edges is being cropped out in the generated pdf. Can any body help me in finding out why this is happening ?

The image magick version that I am using is : ImageMagick 6.2.8 08/25/10 Q16
Does the PNG image contain offset and canvas info? I.e., oFFs and vpAg chunks?
Use "identify -verbose input.png" to find out.
You can remove those with "convert input.png -strip png_without_offsets.png"
and then proceed as before.
Hi,

I used the identify -verbose command, below was the output that i received.
  • Format: PNG (Portable Network Graphics)
    Class: DirectClass
    Geometry: 800x259
    Type: TrueColorMatte
    Endianess: Undefined
    Colorspace: RGB
    Channel depth:
    Red: 8-bits
    Green: 8-bits
    Blue: 8-bits
    Alpha: 1-bits
    Channel statistics:
    Red:
    Min: 0 (0)
    Max: 227 (0.890196)
    Mean: 9.59083 (0.0376111)
    Standard deviation: 35.7738 (0.140289)
    Green:
    Min: 0 (0)
    Max: 255 (1)
    Mean: 40.7994 (0.159998)
    Standard deviation: 62.7657 (0.24614)
    Blue:
    Min: 0 (0)
    Max: 255 (1)
    Mean: 63.1976 (0.247834)
    Standard deviation: 93.8935 (0.36821)
    Alpha:
    Min: 255 (1)
    Max: 0 (0)
    Mean: 81.7366 (0.320536)
    Standard deviation: 119.004 (0.466683)
    Alpha: ( 0, 0, 0,65535) #000000000000FFFF
    Colors: 7191
    Rendering intent: Saturation
    Gamma: 0.45455
    Chromaticity:
    red primary: (0.64,0.33)
    green primary: (0.3,0.6)
    blue primary: (0.15,0.06)
    white point: (0.3127,0.329)
    Resolution: 299.99x299.99
    Units: PixelsPerCentimeter
    Filesize: 1.2e+02kb
    Interlace: None
    Background color: black
    Border color: #DFDFDFDFDFDF0000
    Matte color: grey74
    Page geometry: 800x259+0+0
    Dispose: Undefined
    Iterations: 0
    Compression: Zip
    Orientation: Undefined
    Signature: a4d7ec50a3b82f4c9c89a4f002cfdfeb8c5096363b527a821a9cd77d2aa109ab
    Software: Paint.NET v3.5.3
    Tainted: False
    Version: ImageMagick 6.2.8 08/25/10 Q16
Out of these which are the offset details ?

Re: PNG to PDF Issue

Posted: 2013-02-19T15:50:30-07:00
by glennrp
Version: ImageMagick 6.2.8 08/25/10 Q16
Out of these which are the offset details ?
Sorry, none of those. We only started printing the PNG chunk data within the past few years.
Your IM-6.2.8 (despite the 08/25/10 annotation) is from August 2006.
I'm not sure we stored the canvas back then, either.
You can find out by using a newer version of "identify".

Re: PNG to PDF Issue

Posted: 2013-02-19T23:24:06-07:00
by hem100
glennrp wrote:You can find out by using a newer version of "identify".
The new version does provide the chunk information as below :
Properties:
date:create: 2013-02-15T13:03:00+06:00
date:modify: 2013-02-15T13:06:12+06:00
png:bKGD : chunk was found (see Background color, above)
png:cHRM : chunk was found (see Chromaticity, above)
png:gAMA : gamma=0.45455 (See Gamma, above)
png:IHDR.bit_depth : 16
png:IHDR.color_type : 6
png:IHDR.interlace_method: 0
png:IHDR.width,height : 800, 259
png:pHYs : x_res=29999, y_res=29999, units=1
png:sRGB : intent=0 (See Rendering intent)
png:text : 1 tEXt/zTXt/iTXt chunks were found
signature: 68ec8030a698ef0d4ef3cd0c25102123790eeddc537ced5dade4483c0cdd959e
Software: Paint.NET v3.5.3
Artifacts:
filename: /var/www/flexi-wtp-1.0.0/testingwork/b6101e633ff950a424d7cebe7ffe02dc.png
verbose: true
Tainted: False
Filesize: 125KB
Number pixels: 207K
Pixels per second: 10.36MB
User time: 0.010u
Elapsed time: 0:01.019
Version: ImageMagick 6.7.6-1 2012-03-27 Q16 http://www.imagemagick.org

So does that mean the strip command wont work for the version that is installed currently on my server i.e. IM-6.2.8 ?

Because when I tried the strip command it did not have any impact on the generated pdf. What else can I try to sort out this issue ? And the thing is it happens for all the png file not just in case of certain png files.