Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2011-10

JPEG Dimensions

3 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

ADTEC Pty Ltd

Does anyone know of a simple way to determine the picture dimensions for a JPEG file? I can determine them using the LazJPG unit and loading the file into a variable. The problem is that when I'm trying to determine the dimensions on a whole directory of files, the time taken to load each file makes the process unuseable.

I've tried to understand the file layout for jpg files (wikipedia and jpeg.org) but don't see where the final dimensions are stored. What I would like to do is read just enough of each file to get the height and width of the final image. Any suggestions?

Thanks

Graham Cooke

Reply by email

Mattias Gaertner
to ADTEC Pty Ltd
Show quoted text 10 lines
Does anyone know of a simple way to determine the picture dimensions for a JPEG file? I can determine them using the LazJPG unit and loading the file into a variable. The problem is that when I'm trying to determine the dimensions on a whole directory of files, the time taken to load each file makes the process unuseable. I've tried to understand the file layout for jpg files (wikipedia and jpeg.org) but don't see where the final dimensions are stored. What I would like to do is read just enough of each file to get the height and width of the final image. Any suggestions?

Maybe you can alter the fpreadjpeg unit and add a property to read only the header.
I need a quick jpeg dimension function too.

Mattias

Reply by email

Bart
to Mattias Gaertner

Inside an old program of mine, there is a unit called picslib, which does exactly that for JPG, GIF, BMP and PNG (IIRC).

Souces are at:
http://home.tiscali.nl/~knmg0017/software/htmledit_bron.zip

The code is MPL 1.1 licenced at the moment, but I'm gonna make it LGPL in the near future (I'm currently re-doing this app in Lazarus), so you have my explicit consent to use it with the LGPL licence.

Bart

Mattias Gaertner wrote 26 lines
On Sun, 2 Oct 2011 13:26:09 +0200 "ADTEC (Pty) Ltd" wrote: > Does anyone know of a simple way to determine the picture dimensions > for a JPEG file? I can determine them using the LazJPG unit and > loading the file into a variable. The problem is that when I'm trying > to determine the dimensions on a whole directory of files, the time > taken to load each file makes the process unuseable. > > I've tried to understand the file layout for jpg files (wikipedia and > jpeg.org) but don't see where the final dimensions are stored. What I > would like to do is read just enough of each file to get the height > and width of the final image. Any suggestions? Maybe you can alter the fpreadjpeg unit and add a property to read only the header. I need a quick jpeg dimension function too. Mattias -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply by email