Reading basic png metadata

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
bidgeeman
Posts: 495
Joined: Wed Feb 21, 2007 7:58 am

Reading basic png metadata

Post by bidgeeman » Sun Jul 09, 2017 6:47 am

Hello.
Is there a way to read basic metadata from a png image like the image information or creator information that you can access when you open an image in a paint program like paintshop pro etc or even the basic details you can access when you right click, properties?

Thanks
Bidge

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10099
Joined: Fri Feb 19, 2010 10:17 am

Re: Reading basic png metadata

Post by richmond62 » Sun Jul 09, 2017 8:56 am

Knowing NOTHING about metadata I cracked open a PNG image with a text editor and also looked here:

https://en.wikipedia.org/wiki/Portable_Network_Graphics

All the data (whether metadata or just the encoding on the image) is accessible; the only snag is it is in
a format that I, at least, don't understand.

HOWEVER: it is easy to separate the image data from the metadata insofar as everything that comes
between IDAT and IEND is the image data.

{parenthetically :D this looks informative: http://fotoforensics.com/tutorial-meta.php }

https://en.wikipedia.org/wiki/Exif

Sorry; got to run: am doing diagrams for my wife's book on Historical Linguistics: back on this topic as soon as possible :wink:

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10099
Joined: Fri Feb 19, 2010 10:17 am

Re: Reading basic png metadata

Post by richmond62 » Sun Jul 09, 2017 9:10 am

"The derivation of Exif from the TIFF file structure using offset pointers in the files means that data can be spread anywhere within a file"

this makes things very difficult indeed, as one cannot just open an image as text into a textField and
"chop and change" to isolate the metaData from the imageData rather like the way I worked out
how to import Inkscape SVG images into an SVG widget in LiveCode.

bidgeeman
Posts: 495
Joined: Wed Feb 21, 2007 7:58 am

Re: Reading basic png metadata

Post by bidgeeman » Sun Jul 09, 2017 9:19 am

Hi richmond62.
You would think that a right click/image properties would be a reasonably easy thing to access seeing the data was put there in the first place to be accessed?

Cheers
Bidge

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10099
Joined: Fri Feb 19, 2010 10:17 am

Re: Reading basic png metadata

Post by richmond62 » Sun Jul 09, 2017 9:37 am

Ha, Ha, Ha: egg all over my face:

Check out metadata of image in the Documentation . . . .
metadata.jpg
Not much use as all one ends up with is the density.
Meta Muck.livecode.zip
Here's the stack
(5.87 KiB) Downloaded 286 times

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10099
Joined: Fri Feb 19, 2010 10:17 am

Re: Reading basic png metadata

Post by richmond62 » Sun Jul 09, 2017 9:39 am

reasonably easy
Don't say that to me: say that to the people in Edinburgh . . . :D

bidgeeman
Posts: 495
Joined: Wed Feb 21, 2007 7:58 am

Re: Reading basic png metadata

Post by bidgeeman » Sun Jul 09, 2017 9:39 am

LOL...yes ...I read that metadata consists only of density :) I was hoping that "Image Details" might be different to metadata.

Bidge

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10099
Joined: Fri Feb 19, 2010 10:17 am

Re: Reading basic png metadata

Post by richmond62 » Sun Jul 09, 2017 9:49 am

meatyData.png
TIME FOR AN ENHANCEMENT REQUEST

BUG 20025

bidgeeman
Posts: 495
Joined: Wed Feb 21, 2007 7:58 am

Re: Reading basic png metadata

Post by bidgeeman » Sun Jul 09, 2017 9:51 am

That gets my vote :)
Bidge

Klaus
Posts: 14198
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Reading basic png metadata

Post by Klaus » Sun Jul 09, 2017 8:35 pm

Hi all,

FYI: Mark Waddingham posted this on the use-lc mailing-list:
...
There's a livecodescript library which manipulates exif data:
https://github.com/angerangel/livecodeExif
...

Best

Klaus

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10099
Joined: Fri Feb 19, 2010 10:17 am

Re: Reading basic png metadata

Post by richmond62 » Sun Jul 09, 2017 8:41 pm

Indeed: I saw that post: downloaded the zip file and then
found I couldn't work out how to use it in the way one uses imageData in Livecode :lol:

MaxV
Posts: 1580
Joined: Tue May 28, 2013 2:20 pm
Contact:

Re: Reading basic png metadata

Post by MaxV » Mon Jul 10, 2017 12:56 pm

Contact Sunny, he is an expert of Images and Livecode: https://sunny-tdz.com/livecode/sunnymage
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm

Re: Reading basic png metadata

Post by [-hh] » Mon Jul 10, 2017 9:06 pm

The imageData of an image is the binary ARGB data, without EXIF.
The text of the image (or the contents of an image file) contains also the EXIF data, if there is any.

The zip by angerangel contains a demostack (the file, that ends in ".livecode").
The demostack contains a button "Test", that shows how to use the lib.
The script of that button contains a line that uses data from an image file:

Code: Select all

put exifProcessFile(theData, true) into allTags
For any already available image "X" use

Code: Select all

put exifProcessFile(the text of image "X", true) into allTags
shiftLock happens

Post Reply