Thread: Accessing comments in a PNG file
-
June 5th 2010, 01:49 AM #1
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.
-
June 5th 2010, 04:31 AM #2
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
-
June 5th 2010, 09:13 AM #3
- Join Date
- August 2nd, 2008
- Location
- Southern England
- Posts
- 7,639
- Blog Entries
- 12
- Mentioned
- 4 Post(s)
Male - AgnosticRe: 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
-
New -> File
By Seasanctuary in forum Computer LabReplies: 19Last Post: June 3rd 2008, 01:38 PM -
Problems accessing websites.
By Leonhard in forum Computer LabReplies: 12Last Post: April 7th 2008, 09:12 PM -
Thunderbird, and accessing webmail on desktop
By bar Jonah in forum Computer LabReplies: 17Last Post: July 18th 2005, 02:46 AM -
34 % of readers of Today's Christian Woman admitted accessing porn
By Bob Jenkins in forum Civics 101Replies: 45Last Post: January 6th 2004, 05:35 AM















































































Quote

Tornados
Yesterday, 06:02 PM in Chaplain's Office