Accessing comments in a PNG file

  • Aggressive
  • Amazed
  • Amused
  • Angelic
  • Angry
  • Artistic
  • Asleep
  • Bashful
  • Blah
  • Bored
  • Breezy
  • Brooding
  • Busy
  • Buzzed
  • Chatty
  • Cheeky
  • Cheerful
  • Cloud 9
  • Cold
  • Cold Turkey
  • Confused
  • Cool
  • Crappy
  • Curious
  • Cynical
  • Daring
  • Dead
  • Depressed
  • Devilish
  • Doh
  • Doubtful
  • Drunk
  • Energetic
  • Fiendish
  • Fine
  • Flirty
  • Gloomy
  • Goofy
  • Grumpy
  • Happy
  • Hot
  • Hung Over
  • In Love
  • In Pain
  • Innocent
  • Inspired
  • Lonely
  • Lurking
  • Mellow
  • Mischievious
  • Nerdy
  • None
  • Not Worthy
  • Paranoid
  • Pensive
  • Psychedelic
  • Question
  • Relaxed
  • ROFLMAO
  • Sad
  • Scared
  • Shocked
  • Sick
  • Sleepy
  • Sneaky
  • Snobbish
  • Spaced
  • Stressed
  • Sunshine
  • Sweet Tooth
  • Thinking
  • Tired
  • Twisted
  • Vegged Out
  • Worried
  • Yee Haw
  • Results 1 to 3 of 3
    1. #1
      Tobias Reiper's Avatar
      Tobias Reiper is online now Persona non grata
      ---
       
      Join Date
      May 12th, 2003
      Location
      Here and there
      Posts
      1,734
      Male - Christian
      Mentioned
      0 Post(s)

      Accessing comments in a PNG file

      I've recently done some architectural walkthroughs (modeled in Blender and rendered with OGRE) and had trouble getting paid for them.

      The first client said the check's in the mail and quit responding to any e-mails (I haven't been spamming them, they were once a week informing him that I have yet to receive payment).

      For the second client I decided to get the geometry and rendering engine up and running, send it to him, and then send him the textures, along with how to install them, when I received payment.

      As the second client was referred to me by the first, they were obviously in contact. I received an e-mail saying that the first client sent a copy of the texture pack used in his project and, even though I didn't feel the textures from the first project would fit the second, apparently that was enough to satisfy him.

      Then when I saw The Gimp's "Save Comment" feature and figured out how to add one I got an idea. As I create each texture place a code in the comments section of each PNG, with a new series of numbers used for each project.

      For example, the living room floor texture would have as a comment R21253-42652-89567, then the program would load it by texture name, check the comments, and if that string wasn't there or was incorrect it would shut the program down (no textures would allow the program to run for demonstration purposes, but incorrect textures would be proof of tampering).

      The only problem with that is I have no idea how to access the comments within C++ and I haven't found much information on it.
      I am a firm believer in gun control. As a matter of fact, I'm on the range every chance I get to improve my ability to control my gun.

    2. #2
      Raphael's Avatar
      Raphael is online now Child of the One True King
      In Love
       
      Join Date
      June 28th, 2007
      Location
      Middle Earth, New Zealand
      Posts
      11,735
      Male - Christian
      Mentioned
      0 Post(s)

      Re: Accessing comments in a PNG file

      You might get away with using DSOFile to do it, that's what I use for reading and writing attributes, however, it only works on NTFS.

      http://www.microsoft.com/downloads/d...displaylang=en

      bit of hunting, and I found this that might help, but you would need ImgSource (not free if you don't want big red X's plastered ofver your images):
      http://www.smalleranimals.com/isourc...esample_v2.htm
      Code:
      // open PNG
      HISSRC hSrc = _ISOpenFileSource(pInputFileName);
      
      // read it
      UINT23 w, h;
      HGLOBAL hRGB = _ISReadPNG(hSrc, &uOrigW, &uOrigH, 24, NULL);
      
      // close
      _ISCloseSource(hSrc);
      
      // clean up
      GlobalFree(hRGB);
      
      // dump comment text
      UINT32 uTextCount = _ISGetPNGInputTextCount();
      
      for (UINT32 i =0; i < uTextCount; i++)
      {
          HGLOBAL hText = NULL;
          HGLOBAL hKey = NULL;
          UINT32 uCompression = 0;
          _ISGetPNGInputText(i, 
                             &hKey, 
                             &hText, 
                             &uCompression);
          if (hKey)
          {
              TRACE("Read PNG comment : [%s]", (const char *)hKey);
      
              GlobalFree(hKey);
              if (hText)
              {
                  TRACE(" %s %s", 
                        (const char *)hText, 
                        uCompression ? "(compressed)" : "");
      
                  GlobalFree(hKey);
              }
      
              TRACE("\n");
          }
      }
      "If you can ever make any major religion look absolutely ludicrous, chances are you haven't understood it"
      -Ravi Zacharias, The New Age: A foreign bird with a local walk

      Be watchful, stand firm in the faith, act like men, be strong.
      1 Corinthians 16:13

      "...he [Doherty] is no historian and he is not even conversant with the historical discussions of the very matters he wants to pontificate on."
      -Ben Witherington III

    3. #3
      Chrs's Avatar
      Chrs is offline Have you tried turning it off and on again?
      Twisted
       
      Join Date
      August 2nd, 2008
      Location
      Southern England
      Posts
      7,639
      Male - Agnostic
      Blog Entries
      12
      Mentioned
      4 Post(s)

      Re: Accessing comments in a PNG file

      You can open the picture in a Hex Editor.

      EDIT: Sorry. you want a automated check. *slaps self for not reading*

      Try using Regex to search for that type of string, then use a serial code type method to evaluate it? Not my sort of area, unfortunately.

    Similar Threads

    1. New -> File
      By Seasanctuary in forum Computer Lab
      Replies: 19
      Last Post: June 3rd 2008, 01:38 PM
    2. Problems accessing websites.
      By Leonhard in forum Computer Lab
      Replies: 12
      Last Post: April 7th 2008, 09:12 PM
    3. Thunderbird, and accessing webmail on desktop
      By bar Jonah in forum Computer Lab
      Replies: 17
      Last Post: July 18th 2005, 02:46 AM
    4. Replies: 45
      Last Post: January 6th 2004, 05:35 AM

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •