What graphics file formats encode a physical size for the image or pixels?

A graphics file represents an image in a sort of etherial way, and can be physically bigger or smaller depending on how it is displayed. That is, it can be shown on a huge or tiny screen, printed on big or small paper.

The image size and the pixel size are going up and down together here. Given a fixed number of pixels, you could pin either one down and the other would also be constrained.

That being said, what graphics file formats contain information such as image or pixel dimensions, or pixel density in pixels per inch or whatever, that would constrain this? And how do you get the information from the file?

Most image formats have resolution information, but not many ordinary applications that use or display the image will honour it. JPEGs, for example, as well as storing the essential information about the pixel width and height of the image, also store the resolution in DPI.

These two images, for example, are exactly the same pixel size (and the same size in bytes - or they would be if I had saved them both from the same source), but one of them is 600DPI and the other is 2DPI.
Opening either one in your browser will probably result in identical views, but download them and insert them into a document that expects to output to some kind of hard copy (Microsoft Word, for example) and they will be rendered as different sizes in the document.

BTW, in Windows, you can see these attributes (of a locally stored file) by right-clicking on it and selecting ‘properties’, then choosing the advanced view of the summary tab.

All of them do. You just need a program to dig that particular bit of metadata out of them. Adobe Photoshop tells you pixel height x width plus the resolution and physical size. Adobe Bridge will tell you this stuff without even having to open it first.

Not sure if that’s actually true; RAW format doesn’t even encode the pixel dimensions, or the colour model, or anything. That’s a bit of an extreme example, but I think there probably are image formats that don’t have anywhere to store the scaling metadata. They’re probably obsolete.

Not to highjack, but can any one point me to something that will help with extracting the information use in a database?

Metadata Miner appears to be a popular choice for this task. I don’t like the price though.

Perl and a module that someone has written is the way I would do it. Unfortunatly it requires some programming but if you are fooling around with data bases you should be able to do a little programming.

GIF still clutches onto life, and it does not include any pixel density information.

I know the PPM family of image formats were basically raw: essentially just a small ID header, a width, height, and a depth, followed by pixel values. No density there either. However, you could fairly call PPM obsolete by this point.

In some cases (like TIFF I think), pixel density fields might be supported but not necessarily required. In that case, there’s probably a default density to be assumed.

All of the raster-based formats do. Vector-based formats are the ones that generally don’t.

Raster formats (not an unabridged list):

TIFF
GIF
JPEG
PNG
IFF
BMP
IMG
PSD

Vector Formats (far from unabridged):

PDF
PICT *
EPS
SVG
WMF *

  • I’m pretty sure these two formats will handle either raster or vector graphics; in fact most vector formats will encompass raster info it has been inserted or incorporated. It’s the ability to handle vector info that causes me to dump them in the latter category.

If you’re on a Mac running 10.4.x, the metadata is available in the Command-F file-searcher. Click the category on the left and go down to “Other”. You can search for every image on every drive that has a resolution or a height or width in pixels that you specify. Colorspace and stuff like that, too.

>GIF still clutches onto life, and it does not include any pixel density information.

Well, I just played with a GIF image in Microsoft Photo Editor, and in File > Properties there is a field for pixels per inch. I changed it from 96 to 200 and saved the file under a different name. Now the two files have the same number of pixels but different pixels per inch. So, GIF certainly does include pixel density information.

Interesting. I was reading the spec directly and couldn’t find it. But it’s a long read and I must have overlooked it somewhere.

Good point. I sit corrected.

w00t! That’s exactly what I’ve been looking for!
Since I’m familiar with Perl and firebird so this is perfect, and I don’t like how the retail apps take over every media file on the machine.

Thanks gazpacho