Skip to content

XE2 update for my image metadata reading/writing library (CCR Exif)

16 January, 2012

I was going to get round to it eventually, though having an explicit request prompted me to actually do it: updating my open source image metadata reading/writing library (CCR Exif) to properly support XE2. The updates I’ve just posted to Google Code has it cross compiling for each of Delphi XE2′s three DCC-targeting platforms, Win32, Win64 and OS X; it should also still compile back to D2006, though at least D2007, and preferably D2009 are preferred. On the downside, iOS isn’t supported because the code remains as Delphi-specific as ever (and no, FPC 2.6.0 doesn’t help much). Also, there aren’t any FireMonkey demos as yet, though the console ones all cross compile if you have XE2 and add OS X as a target platform.

In practical terms, Win64 took as long as it took to add ‘Win64′ as a target for each of the demos; OS X was somewhat longer for a mixture of reasons, primarily because the code had some entanglement with the VCL graphics classes, and there’s no ‘clean’ way for the same code to work with both VCL and FMX on that score. By far the biggest waste of time effort was managing project files across an array of Delphi versions though, with battling Subversion a close second, i.e. not actual coding at all. As I wanted to make running the demos as newbie-friendly as possible, I’ve ended up with separate project files for D2006, D2007, D2009-10 and XE+ – just open the appropriate project group located at the top of the trunk and do a Project|Compile All. If compiling under D2007 or later, executables will then be outputted in a sub-directory off the Bin folder next to the individual projects, and DCUs in a ‘DCUs’ folder off of the main trunk.

Anyhow, the Google Code page is here; if using the File|Open From Version Control… command in the XE or XE2 IDE, the URL to enter is http://ccr-exif.googlecode.com/svn/trunk/; choose either Console Demos (XE+).groupproj or VCL Demos (XE+).groupproj as appropriate when prompted.

Advertisement
9 Comments leave one →
  1. Kristof permalink
    16 January, 2012 1.01 pm

    By far the biggest waste of time effort was managing project files across an array of Delphi versions though, with battling Subversion a close second, i.e. not actual coding at all

    I was rolling on the floor when I read this part … But it’s true, currently battling with SVN merge also … It’s 2-3 but I’ll make it 4-3 by the end of the day

  2. Vladimir Khanykov permalink
    28 January, 2012 3.42 pm

    Hi Chris. I have a problem with Version 1.5.1 beta
    Windows 7, Delphi XE. Error Compiling ExifList.dproj (Debug, Win32):
    [DCC Error] ExifListFrame.pas(457): E2003 Undeclared identifier: ‘TTiffDirectoryLoadError
    [DCC Error] ExifListFrame.pas(790): E2003 Undeclared identifier: ‘tdUndefined”

    Help me please.

    • Chris Rolliston permalink*
      28 January, 2012 4.14 pm

      Have you updated (or got) from the repository the *whole* trunk? Specifically, the demos need to be updated too – the VCL ones also have had their directory renamed from ‘GUI Demos’ to ‘VCL Demos’ (this is because I’m going to do FireMonkey demos too when I get round to it). What Subversion client are you using? If the IDE, download the whole package again as I detailed at the end of the post, preferably to a new directory. If you’re using TortoiseSVN, then update the root directory.

      • Vladimir Khanykov permalink
        12 February, 2012 3.07 pm

        Sorry, but I can’t find a ‘VCL Demos’ directory in zip file.
        One more question. How can I get full list of EXIF tags with their names? I need to create some kind of a .INI file like this:
        [esGeneral] // Section
        Make = FUJIFILM
        Model = FinePix6900ZOOM
        Orientation = 1
        XResolution = 72.00
        YResolution = 72.00
        ResolutionUnit = 2
        Software = Digital Camera FinePix6900ZOOM Ver1.00
        DateTime = 2002:03:14 15:59:39
        YCbCrPositioning = 2
        Copyright =
        FNumber = F11.0
        ExposureProgram = 3
        ISOSpeedRatings = 400
        …etc ?

      • Chris Rolliston permalink*
        12 February, 2012 6.32 pm

        ‘Sorry, but I can’t find a ‘VCL Demos’ directory in zip file.’

        Use a Subversion client (Tortoise SVN or the XE/XE2 IDE) to get the latest version.

        ‘How can I get full list of EXIF tags with their names?’

        Do you mean a full list of *possible* Exif tages or a full list of tags in a specific image? If the former, Google for ‘Exif specification’; if the latter, enumerate the TExifData instance with a for/in loop, firstly to enumerate the various ‘sections’ (IFDs) and secondly to enumerate the tags within each section. You will need to do the mapping between numeric identifier and string representation yourself.

        • Vladimir Khanykov permalink
          13 February, 2012 7.38 pm

          Hi Chris. Thank You for reply.
          I meant “a full list of tags in a specific image”. I’ll try to do the mapping between numeric identifier and string representation, though I think this feature may be useful for many other users.

        • Chris Rolliston permalink*
          15 February, 2012 1.21 am

          Tags are stored by their numbers, not their names, and I don’t believe in hardcoding strings. Further, if you ever want to *write* a tag (which is something my code supports, excepting maker notes), you should understand its type. That said, see my comment below, which should get you going – let me know if it doesn’t.

  3. Chris Rolliston permalink*
    15 February, 2012 1.24 am

    For Vladimir – the start of some code to list all tags by name, together with their content as a string:

    function GetTagName(SectionKind: TExifSectionKindEx; TagID: TExifTagID): string;
    begin
      //assign a default 'name'
      FmtStr(Result, '$%.4x', [TagID]);
      //lookup tag (see CCR.Exif.TagIDs)
      case SectionKind of
        esGeneral:
          case TagID of
            ttImageDescription: Result := 'Image description';
            ttMake: Result := 'Make';
            ttModel: Result := 'Mode';
            //... and so on
          end;
        esDetails:
          case TagID of
            ttExposureTime: Result := 'Exposure time';
            ttFNumber: Result := 'F number';
            //... and so on
          end;
        esInterop:
          case TagID of
            ttInteropIndex: Result := 'Interop index';
            ttInteropVersion: Result := 'Interop version';
            //... and so on
          end;
        esGPS:
          case TagID of
            ttGPSVersionID: Result := 'GPS version';
            ttGPSLatitudeRef: Result := 'GPS latitude ref';
            //... and so on
          end;
        esThumbnail:
          case TagID of
            ttCompression: Result := 'Compression';
            ttJPEGIFOffset: Result := 'JPEG data offset';
            //... and so on
          end;
        esMakerNote: {... need to a lookup like the ExifList demo does};
      end;
    end;
    
    procedure EnumExifData(ExifData: TCustomExifData);
    var
      Section: TExifSection;
      Tag: TExifTag;
    begin
      for Section in ExifData do
        for Tag in Section do
          WriteLn(GetTagName(Section.Kind, Tag.ID), ': ', Tag.AsString);
    end;
    
    • Vladimir Khanykov permalink
      19 February, 2012 11.11 am

      Hi Chris.
      I’ve created an array of Records, containing TagIDs and corresponding TagNames. It works fine. Thank You.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.