Add EXIF Tag to JPEG

Discussion in 'Digital Cameras' started by BluDog, Jun 15, 2004.

  1. BluDog

    BluDog Guest


    I was wandering if anyone knew if it was possible to add custom EXIF
    tags (such as Photographer and Title) to a JPEG image, or to modify
    the existing tags (such as ImageDescription).

    There is an extremely good article on Code Project for reading these
    tags, but I cannot find any information on how to modify them:


    BluDog, Jun 15, 2004
    1. Advertisements

  2. BluDog

    mphanke Guest


    [I'm writing this assuming you are using C++ .NET]

    this is what I wrote yesterday nite, after I found out you can't create
    and assign PropertyItem to an image. I don't know why this behaviour is
    by design - makes no sense to me, to go the "save and reload then
    modify"-way? Maybe Bob can explain this... ?!?

    You have to write a wrapper in C# to retrieve the codec - also a
    behaviour by design - and also makes no sense to me, I believe MS
    screwed up on this one!

    It should be easy to port that code to any other .NET lang...
    If you have a problem, drop me a line.


    [C#-Wrapper for codec retrievement]
    [Fill and Write the comment field:]
    //this is the way to get the property Items
    //retrieve comment from given Commentfield
    //convert to unsigned char array and set
    //required fields for unrestricted user comment

    //string data

    //exif user comment w/o restriction
    //Set the Property item to the selected Image
    //save the image with the properties set
    mphanke, Jun 15, 2004
    1. Advertisements

  3. BluDog

    mphanke Guest


    forgot about this, you might want to download this file and have a look
    at it. There you will find all the valid tag IDs for the Exif2.2 tags.

    Have fun,

    mphanke, Jun 15, 2004
  4. BluDog

    BluDog Guest

    forgot about this, you might want to download this file and have a look
    Thanks mate. Looks great, unfortunately I only have knowledge of VB,
    could you give me a hand on the conversion side please?


    BluDog, Jun 15, 2004
  5. BluDog

    mphanke Guest

    I don't know much about VB. But you only have to find the appropriate
    calls to the namespace funcs and then replace them... But I will give my
    best to support you on this - give it a try and then post the code and
    tell me where the problem is... I should be able to help you.

    mphanke, Jun 15, 2004
  6. BluDog

    Eric Hourant Guest

    You can also use an ocx from WaterMarker.
    Check on and follow the AIS Exif ActiveX. I use it for
    reading exif information but it can also be used to write infos.


    Eric Hourant, Jun 15, 2004
  7. BluDog

    mphanke Guest

    Thanks Eric,

    but I don't use commercial libraries - it's a codex.
    mphanke, Jun 15, 2004
  8. BluDog

    BluDog Guest


    I have converted the C# wrapper bit to VB no probs:

    Public Shared Function GetEncoderCodec(ByVal mimetype As String) As

    Dim codecs() As ImageCodecInfo =
    Dim codec As ImageCodecInfo

    For Each codec In codecs
    If codec.MimeType = mimetype Then Return codec

    End Function

    But the rest, this is C++, i am assuming from your post that this can
    only be acheived using C++ and cannot be converted to VB?

    Is this correct?


    BluDog, Jun 15, 2004
  9. BluDog

    mphanke Guest


    no this is all .Net standard stuff. You don't have to worry about quit a
    lot of things like the pointer stuff. This is normal object as it is in
    VB. Give it a try, you should encounter no problems.

    I'm leaving office now, if you have any further questions on this, I
    will answer them tomorrow morning.

    mphanke, Jun 15, 2004
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.