jpeg file format

jpeg file format

Post by Graham Nicholl » Wed, 13 Aug 2003 22:58:51


I'm looking for information regarding the jpeg file format.  
What I'm trying to do is to extract the pixel size and density from any jpeg
file.  Now I'm getting the problem that there are variants on the format -
each with its own set of segment ids.  

The reasson I need the pixel density is that I'm trying to add jpeg files
into pdf files, using a tool called pdfrw.  Pdfrw accepts a scale factor
something like this:

img src=fred.jpg scale=50

where 50 would reduce the size to 50% of the original.  The  trouble is,
pdfrw is ignoring the pixel density of the image (which is probably fair
enough from its point of view).  However, I''m trying to work out the scale
factor to use by finding the pixel size of the image and dividing it into
the size of the area it has to fit into.  If the image says "I'm 1800 by
1200 pixels", then pdfrw makes it a big image regardless of whether the
pixel density is 300 by 300, or 150 by 150.  (Maybe I should contact the
authors of pdfrw.)  If I can extract the pixel density as well as the pixel
size, then I can work out the physial dimensions (in mm or (brain dead)
imperial units), and thus scale the image to fit its appropriate area of
the final image.

This all has to be done programatically, rather than manually, so right
clicking in Konqueror (a browser) on an image, and looking at the values
wont work.

So, I need some pointers to descriptions of the file format, and where I can
find the image size AND pixel density in the file, preferably regardless of
whether its a jfif, an exif, or what.

Graham Nicholls
Rock Computer Consultancy


1. Jpeg File Format - also ART(AOL) GIF PNG ??

Does anyone know where I can find both a simplified and detailed description
of the JPEG file format ?.

I do know that there is no actual file format for JPEG, but I am looking for
an explanation of the compression.

Also the same for GIF     ART (AOL)  and PNG.

Thanks in advance.


2. Automation of ImageList and QuickReport...

3. jpeg file format spec

4. Problems openning Window Meta Files (WMF)

5. I need help to find JPEG file format specifications

6. Primary Reason to Use LW over MAX

7. JPEG File Format Info needed!

8. new 3D transform method?

9. JPEG file format

10. Motion JPEG File Format

11. JPEG File Format

12. EPS JPEG file format - preview?