Silverfrost Forums

Welcome to our forums

Getting file properties

22 Jun 2011 12:29 #8448

I worked to late last night trying to organise all the photos I have downloaded from cameras onto my notebook, but not had the time to tidy them up when I did it. I had multiple copies of the same picture, often with different date/time stamps of when they were loaded onto the computer, rather than when they were taken. Often they also have different names, depending on the quick method I took to strip them from the camera.

Is there a routine that I can call to get photo specific properties, such as 'Date Picture Taken' and 'Dimensions' ?

I'm thinking of using my disk scanning program, which uses 'files@' and then obtain more info if it is a picture file (.jpg or .bmp).

I looked at FILEINFO@, but the documentation appears to exclude some arguments with the note : 'Arguments that do not appear in the above description are redundant in this operating system environment.'

I recall someone posted a program example that provided some info on graphics files, but I can't locate it.

Any help ?

John

22 Jun 2011 4:59 #8449

In many cases, images from digital cameras are stored as JPGs. Those files have additional information in the so-called EXIF header, containing exposure time, lens opening, focal length, date and more. You may look for 'EXIF reader' to find suitable software. There is no function available in FTN95 or ClearWin+ for this.

If you modify the original images (reduce the resolution, increase the compression rate, store the image in a different file format etc.) then it depend on the software whether the output file will also have an EXIF header. For instance, this will never be true for BMP files but often for JPGs.

Regards - Wilfried

23 Jun 2011 1:49 #8452

Wilfried,

Thanks for your advice. I googled EXIF readers and downloaded a picture viewer, which gave more info on the .jpg file attributes.

I have also looked at the file attrributes that can be displayed in Windows Explorer, which include 'Date Picture Taken' and 'Dimensions'.

I looked at FILEINFO@ and found that SIZE, ATIME, MTIME and CTIME all appear to give sensible info ( Seconds since 1970 !!, another format from that provided by FILES@). I'm not sure about the others.

We need a routine Get_NTFS_File_Info@ or Get_JPEG_File_Info@ to give more of the info reported in Windows Explorer. It would be interesting to know where Explorer gets the picture info from. Is it in the directory header or the file itself ?

Paul, If a WINAPI routine exists to recover these attributes, could you provide me with a fortran wrapper to call the routine ? I presume FILEINFO@ has this approach.

John

23 Jun 2011 6:23 #8455

I don't know of such an API function. If, as Wilfried says, the information is in the file header, then you will need to read the file as binary and locate the information you need. As I recall, there are FTN95 routines for reading in binary.

30 Jun 2011 4:41 #8487

You can link with this library.

http://libexif.sourceforge.net/

If you don't want to use it you can figure out the offsets to the data you want from the comments in the source code.

Please login to reply.