Page 1 of 1
convert from a picture to pdf doesn't keep the original size
Posted: 2012-04-11T12:01:00-07:00
by Sworddragon
I'm using ImageMagick 6.6.9.7 (from the Ubuntu repository) and have already made a bug on Launchpad about this:
https://bugs.launchpad.net/ubuntu/+sour ... bug/897009
I'm using Ubuntu 12.04 dev with imagemagick 8:6.6.9.7-5ubuntu1. I have converted a picture to a pdf but it was on 100% zoom in evince upscaled. But I can't say if convert is upscaling the picture on the conversion or if evince (I'm using evince 3.2.1-1ubuntu1) is upscaling the picture.
Steps to reproduce:
1. Create a white picture with a dimension of 100x100 pixel and save it as test.png.
2. Convert the picture with "convert test.png test.pdf".
3. Open test.pdf with evince and set the zoom level to 100%.
4. Make a screenshot of evince and check the dimensions of the white picture (for example with GIMP).
5. In my case the white picture in evince was at 100% zoom 124x124 pixel.
Re: convert from a picture to pdf doesn't keep the original
Posted: 2012-04-11T12:08:55-07:00
by fmw42
I am not an expert, but pdf files are vector format and as such do not have a specific resolution. When you imbed an image, even with the images specific size, the pdf still has a vector shell around it with no specific dpi. You need to specify the desired dpi that will make your image stay the same size. I will, however, defer to others more expert in this matter than I.
Re: convert from a picture to pdf doesn't keep the original
Posted: 2012-07-21T15:26:56-07:00
by broucaries
Any news of this bug report ?
Re: convert from a picture to pdf doesn't keep the original
Posted: 2012-07-21T16:21:52-07:00
by fmw42
broucaries wrote:Any news of this bug report ?
I do not believe it is a bug. As I mentioned above:
I am not an expert, but pdf files are vector format and as such do not have a specific resolution. When you imbed an image, even with the images specific size, the pdf still has a vector shell around it with no specific dpi. You need to specify the desired dpi that will make your image stay the same size. I will, however, defer to others more expert in this matter than I.
Re: convert from a picture to pdf doesn't keep the original
Posted: 2012-07-25T13:34:12-07:00
by Sworddragon
broucaries wrote:Any news of this bug report ?
The problem still exists. Using -density 72x72 or nothing will result in 124x124 pixel. Using -density 150x150 will result in 60x60 pixel. But I can't say too if this is a bug or if convert should use at default the correct resolution.
Re: convert from a picture to pdf doesn't keep the original
Posted: 2012-07-25T15:08:47-07:00
by fmw42
As I have been trying to say, pdf files have no inherent size in pixels. The size is defined by whatever density you assign to it when you convert it or print it. You cannot display a PDF and expect the size to be the same as the image it came from. It all depends upon how the viewer decides to assign it a density.
Try this:
convert -size 100x100 xc:white white.png
convert white.png white.pdf
identify white.pdf
white.pdf PDF 100x100 100x100+0+0 16-bit Bilevel DirectClass 1.36KB 0.000u 0:00.000
convert -density 72 white.pdf white2.png
identify white2.png
white2.png PNG 100x100 100x100+0+0 8-bit PseudoClass 1c 385B 0.000u 0:00.000
If you use another density value other than 72, the white2.png image will be larger or smaller.
Re: convert from a picture to pdf doesn't keep the original
Posted: 2012-07-25T23:51:28-07:00
by broucaries
I will try to get a patch for documentation purpose (I suspect pdf A1 does not have this kind of problem).
Bastien
Re: convert from a picture to pdf doesn't keep the original
Posted: 2012-07-26T00:02:53-07:00
by broucaries
BTW could we by default, determine the screen resolution using the same code then in dpyinfo ? Using something like density auto ?
Bastien
Re: convert from a picture to pdf doesn't keep the original
Posted: 2012-07-26T09:54:08-07:00
by fmw42
broucaries wrote:BTW could we by default, determine the screen resolution using the same code then in dpyinfo ? Using something like density auto ?
Bastien
Sorry I know little more about this. You can perhaps wait to hear back from either Anthony or Magick.
Re: convert from a picture to pdf doesn't keep the original
Posted: 2012-08-08T19:15:53-07:00
by anthony
Fred (fwm42) has this exactly.
Readers of PDf has no why of knowing the 'ideal' resolution to use to display wrapper raster images exactly 1:1
In fact the image in the PDF may be ulta large and scaled to fit a specific area of a page. It get them 1:1 you would need to create humongous pages!
More so a page could contain multiple images each at a different scale and/or resolution needed for 1:1 viewing.
Basically it is impossible for the simple reason PDF is vector, and not meant to have a specific resolution.
Re: convert from a picture to pdf doesn't keep the original
Posted: 2012-12-06T18:46:26-07:00
by Sworddragon
Pictures with a different size will have a different size in the pdf document too which is not the original size. How is the information of the size stored?
The main problem is I want to merge a pdf document with .odt files with a document of some pictures. In the result the pictures are more than double so big than the .odt files. My idea was to get the real size in the pdf document and adjusting the pictures. But this doesn't work because the pdf document isn't showing the real size.
So my goal was just to get a consistent size for all files in the pdf document. I doesn't even matter about the real size but I thought there could be a bug with the size on converting. I'm wondering how I can get a pdf document with a consistent size.
Re: convert from a picture to pdf doesn't keep the original
Posted: 2012-12-06T22:00:37-07:00
by anthony
I don't think you can.
Compression is used for rasters embeded in pdf's so that is variable. and if it is vector, well then it is small but also variable.
The same does for almost any image file format except raw uncompressed data formats.
Re: convert from a picture to pdf doesn't keep the original
Posted: 2013-06-20T12:49:04-07:00
by Sworddragon
A little time ago I have found the solution for this problem. The argument -page will control a consistent size in the document. In my case I needed just to use "-page A4" to scale the images to the same size as .odt documents.