Strategies for metadata management

I have probably hundreds of Processing sketches, and most of them use save() to export images.
Along the years I have relied on using the filename and sometimes a “watermark” on the image itself to keep track of some of the metadata: the sketch that generated the image, or some of the parameters.
I really would like to find a more robust method, and I wanted to ask if someone has succeeded with a good workflow that incorporates metadata into the exported images - either using TIFF format, or hacking with “metadata chunks” in PNG (PNG does not support EXIF metadata but it can store metadata in other blocks).
Reference for PNG metadata blocks: https://dev.exiv2.org/projects/exiv2/wiki/The_Metadata_in_PNG_files

2 Likes

I have added information to the file name. It can help within a project to identify images and keep track how they were created. I wouldn’t call it robust, though. If I had to check those images today, I would need to go through the code to find meaning of stored parameters.

If using metadata in files is cumbersome, you could use database or even a text file to store metadata. A unique file name works as an identifier. If you want to store structured data then XML or JSON should work fine. Or csv if you know all the metadata fields in advance. I would use JSON, because its human readable, fairly easy to create and read in to a program, saves field names and can store data types and other information of data fields too.

I guess you could also incorporate externally stored metadata later to the image files. Or perhaps use an utility program to do that.

1 Like

Thank you @SomeOne for sharing your insights. I have also relied on file names to Lee some of the metadata, however it’s quickly becomes messy. For example, I might want to keep track of float values of a few parameters, and having in the file names makes for a long and illegible file name.

Another simple idea I had was to automate a way to extended the image size on save() , adding some extra space at the bottom with whatever text information was relevant. It would mean “burning” the metadata onto the image, which can be cropped during printing for example. It is not machine readable, but it helps to find a way back to my parameters.

I have not had the chance to investigate embedding the metadata but that would be preferred, as all other options would require some coding and an infrastructure to maintain.

Adding data to the image as text is an interesting idea. And it can be read with OCR. OpenCV has ready to use libraries for it. Do you need human readable or machine readable data? If machine readable only then you can append data as array of bytes (black for 0, white for 1) instead of space consuming readable text.

java library

You can use any java library in processing to add meta data via exif or to a png file.

Just google it.

work-around

Having said that, here is a work-around:
With every image you save, save a csv file of the same name (except extension) with the meta data.
Use saveStrings()

Since it’s the same file name the image file and
the text file belong together

No hassle writing a data base / json

You write a viewer to view both files simultaneously

Database approach

Use a table and fill this with file name and then the data - just one table file for all images

1 Like

I disagree about hassle with JSON. Learning curve is a bit steep at start, but once you get a hang of it, it’s very natural to use. Besides there are libraries that make it easier to use. In same cases very easy to get data out of JSON.

1 Like