how to convert from png to pdf without resizing?
how to convert from png to pdf without resizing?
I think I must be some kind of idiot, because I've been playing with this for a few hours and can't figure out how to convert input.png to output.pdf without the image being obviously stretched in the pdf output. input.png is 823 pixels wide by 6228 pixels in height. How can I get input.png into output.png without the original image being stretched? I don't care if the pdf is wider than the png, so long as the png is not stretched....
Re: how to convert from png to pdf without resizing?
There's not enough information in your query to tell what went wrong.
I did
The resulting pdf looks OK (colored) when I display it with another application.
I don't know why "identify" thinks it's 16-bit grayscale.
I did
Code: Select all
convert logo: logo.png
convert logo.png logo.pdf
identify logo.pdf
logo.pdf PDF 640x480 640x480+0+0 16-bit Bilevel Gray 38.5KB 0.000u 0:00.000
convert logo.pdf logo_pdf.png
identify logo_pdf.png
logo_pdf.png PNG 640x480 640x480+0+0 8-bit sRGB 256c 27.5KB 0.000u 0:00.000
I don't know why "identify" thinks it's 16-bit grayscale.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: how to convert from png to pdf without resizing?
pdf has no size. it is a vector format and the size is determined by the -density you use when converting it to some other format or when you display it. The density must be specified before reading the pdf
you can try
convert image.png -density 72 image.pdf
but I am not sure even that will help.
(nominal density is 72)
see
http://www.imagemagick.org/Usage/formats/#vector
you can try
convert image.png -density 72 image.pdf
but I am not sure even that will help.
(nominal density is 72)
see
http://www.imagemagick.org/Usage/formats/#vector
Re: how to convert from png to pdf without resizing?
Thanks for the suggestion, fmw42 ...
I have now tried your suggestion, but I get the same result. Though the input is 823 pixels wide, the output pdf is 1097 pixels wide at 100% zoom in Evince Document Viewer ... this is confusing, because the width of 1097 pixels is noticeably more than for a typical pdf....
I have now tried your suggestion, but I get the same result. Though the input is 823 pixels wide, the output pdf is 1097 pixels wide at 100% zoom in Evince Document Viewer ... this is confusing, because the width of 1097 pixels is noticeably more than for a typical pdf....
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: how to convert from png to pdf without resizing?
As I said the pdf is a vector format and the viewer can specify the density behind the scenes and you may not have any control.
In IM, I believe, that you can specify the density when displaying the pdf. Other viewers have controls for percent size, which may be controlling the density or more likely just the scale factor on the display, once converted to pixels.
So I am not sure there is any way to make a pdf that will have the same size in pixels as there are no pixels in the pdf. It is all controlled by the density you or the viewer specifies when converting it to pixels for display purposes.
Does using a density of 72*823/1097=54 (-density 54) make any difference
In IM, I believe, that you can specify the density when displaying the pdf. Other viewers have controls for percent size, which may be controlling the density or more likely just the scale factor on the display, once converted to pixels.
So I am not sure there is any way to make a pdf that will have the same size in pixels as there are no pixels in the pdf. It is all controlled by the density you or the viewer specifies when converting it to pixels for display purposes.
Does using a density of 72*823/1097=54 (-density 54) make any difference
Re: how to convert from png to pdf without resizing?
Density 54 makes it even larger.
Density 96 is close (width 822 pixels), but it comes out a bit blurry.
If a pdf doesn't have any native resolution, then how come raster graphics in PDF files normally look correct at 100% zoom?
Density 96 is close (width 822 pixels), but it comes out a bit blurry.
If a pdf doesn't have any native resolution, then how come raster graphics in PDF files normally look correct at 100% zoom?
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: how to convert from png to pdf without resizing?
Because you can embed a raster image in a PDF shell. But without the raster image, the rest is vectors that have no size.ImMa wrote: If a pdf doesn't have any native resolution, then how come raster graphics in PDF files normally look correct at 100% zoom?
I think your viewer is doing strange things. The larger the density the larger the raster image you will get. But if it works for you, then just adjust the density a little more to get the size you want. You can use fractions in the density, i.e decimal points.
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: how to convert from png to pdf without resizing?
Most PDF viewers get the density (resolution) to display at, from the video display driver.
For my X windows display I get
Whcih is higher than the default (standard) 72dpi. As such images (and fonts) will look smaller in a PDF.
My laptop has a dpi of around 110dpi (or ppi points/pixels-per-inch)
IM does not typically use the display driver so does know know what density is appropriate for the final output device. 72dpi is a fairly standard default (set on apply/macintosh, and probably due to laser printers of the day), that was originally regarded as as being an acceptable resolution for printers and displays for reproduction of plain text black and white documents (not photo images). Microsoft Windows used 96dpi as its standard, and presumably why my Dell PC Monitor is set to 96dpi.
Of course today's devices have a far far higher resolution. With photo quality printers reaching 1200, and even 2400. While retina displays typically use around 300 ppi. Whcih is the typical human limits for 20/20 vision working 12 inches away from such a device, without magnification.
For my X windows display I get
Code: Select all
xdpyinfo | grep resolution
resolution: 96x96 dots per inch
My laptop has a dpi of around 110dpi (or ppi points/pixels-per-inch)
IM does not typically use the display driver so does know know what density is appropriate for the final output device. 72dpi is a fairly standard default (set on apply/macintosh, and probably due to laser printers of the day), that was originally regarded as as being an acceptable resolution for printers and displays for reproduction of plain text black and white documents (not photo images). Microsoft Windows used 96dpi as its standard, and presumably why my Dell PC Monitor is set to 96dpi.
Of course today's devices have a far far higher resolution. With photo quality printers reaching 1200, and even 2400. While retina displays typically use around 300 ppi. Whcih is the typical human limits for 20/20 vision working 12 inches away from such a device, without magnification.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/