Hello, I have some troubles with a PNG image, that is not correctly rendered by context (too small). The difference I've found with another correctly displayed image is that the file does not contain any resolution unit (but a pixels/inch default seems reasonable). Is there a workaround or specific setup to make this work (without explicit width setting)? Here is the test file I use. If you wish I can send the images, or find the troublesome PNG image at: http://svnbook.red-bean.com/trac/browser/trunk/src/en/book/images/ch01dia1.p... Thanks for your help. \starttext \startyping identify -verbose images/ch02dia1.png images/ch02dia1.png PNG 146x168 146x168+0+0 PseudoClass 135c 2kb 0.008u 0:01 Image: images/ch02dia1.png Format: PNG (Portable Network Graphics) Geometry: 146x168 Resolution: 28.34x28.34 Units: PixelsPerCentimeter \stoptyping \externalfigure[images/ch02dia1.png] \startyping identify -verbose images/ch01dia1.png images/ch01dia1.png PNG 511x585 511x585+0+0 DirectClass 54kb 0.094u 0:01 Image: images/ch01dia1.png Format: PNG (Portable Network Graphics) Geometry: 511x585 Resolution: 72x72 Units: Undefined \stoptyping \externalfigure[images/ch01dia1.png] \stoptext Regards, BG
nico wrote:
Hello,
I have some troubles with a PNG image, that is not correctly rendered by context (too small). The difference I've found with another correctly displayed image is that the file does not contain any resolution unit (but a pixels/inch default seems reasonable).
But pixels/cm is equally reasonable, and that is why pdftex ignores invalid settings in PNG images completely, and uses its internal default instead. You can control that default resolution by setting \pdfimageresolution to an appropriate guess: {\pdfimageresolution=72 \externalfigure[ch01dia1.png]} Cheers, Taco
On Thu, 18 May 2006 17:28:42 +0200, Taco Hoekwater
nico wrote:
Hello,
I have some troubles with a PNG image, that is not correctly rendered by context (too small). The difference I've found with another correctly displayed image is that the file does not contain any resolution unit (but a pixels/inch default seems reasonable).
But pixels/cm is equally reasonable, and that is why pdftex ignores invalid settings in PNG images completely, and uses its internal default instead. You can control that default resolution by setting \pdfimageresolution to an appropriate guess:
{\pdfimageresolution=72 \externalfigure[ch01dia1.png]}
But 72 means 72 dots per inch, isn't it? The file already contains that information (field Resolution given by identify). It's the unit that is missing (but when you set pdfimageresolution there isn't any unit either, the unit is implicit). But indeed setting the resolution by hand makes it work, thanks. Regards, BG
{\pdfimageresolution=72 \externalfigure[ch01dia1.png]}
when you set pdfimageresolution there isn't any unit either, the unit is implicit
What about a new pdftex primitive: \pdfimagepixel, which would force using a unit. Then the above would be done by \pdfimagepixel=1bp This subject is dear to me because (1) I'm writing a textbook on dimensional analysis, and (2) almost none of my students use units in their assignments, and often therefore make absurd mistakes. That's what happened to the NASA Mars probe that crashed into the surface after travelling all the way. The engine makers and NASA had different ideas of what units the thrust was in (I think NASA had converted to SI units, whereas the manufacturer used 'English' units). -Sanjoy `Never underestimate the evil of which men of power are capable.' --Bertrand Russell, _War Crimes in Vietnam_, chapter 1.
Sanjoy Mahajan wrote:
{\pdfimageresolution=72 \externalfigure[ch01dia1.png]}
when you set pdfimageresolution there isn't any unit either, the unit is implicit
It is defined to be an integer number of pixels per inch, in the pdftex manual.
What about a new pdftex primitive: \pdfimagepixel, which would force using a unit. Then the above would be done by \pdfimagepixel=1bp
You can (as always) propose it on the pdftex list, but i personally do not see the point. Bear in mind that the png spec is extremely clear on the use pHYs: If this ancillary chunk is not present, pixels are assumed to be square, and the physical size of each pixel is unknown. So the problem was created way before pdftex came into play. Cheers, Taco
On 5/18/06, Taco Hoekwater
What about a new pdftex primitive: \pdfimagepixel, which would force using a unit. Then the above would be done by \pdfimagepixel=1bp
You can (as always) propose it on the pdftex list, but i personally do not see the point. Bear in mind that the png spec is extremely clear on the use pHYs:
If this ancillary chunk is not present, pixels are assumed to be square, and the physical size of each pixel is unknown.
So the problem was created way before pdftex came into play.
Pdftex's image inclusion should be viewed as a convenience feature
that is nice when it works, but it is no substitute for using good
external software to create good images (preferrably in pdf format so
no conversions are needed). Once you have support for
including images you have to deal with questions of what should be
supported, and to which the only good answer is "any image George's
boss wants to use". By offloading such questions onto the authors of
sam2p, imagemagick, netpbm, gimp, cinepaint, Photoshop, etc. there is
time for more texy questions that those authors won't address.
--
George N. White III
participants (4)
-
gnwiii@gmail.com
-
nico
-
Sanjoy Mahajan
-
Taco Hoekwater