Beginnings of an image embedding library

Beginnings of an image embedding library

So to start of this project for the Creative Commons Organization, I looked at the two more popular image formats, JPEG and PNG.

Before I go into more detail about the embedding, let me explain what the project is.  The CC organization wants to create an easy way for developers to embed CC licenses into images that are created using their software.  For example, I am a developer and I make a camera app for Android.  I can use this library to let the user of my app insert the CC license into any image they take with a few clicks.  Ideally this would not be limited to Android.  It would work on any platform that can successfully integrate it.  We are trying for that exact goal that this should work everywhere, but are skeptical about supporting the many platforms out there.  We will most likely be targeting Android with first release, if we are unable to make multi-platform.

The two more popular image formats are JPEG and PNG.  First, let's start with JPEG.  JPEG is actually a compression algorithm while the format for JPEG is actually provided by two standards, Exif and JFIF.  Exif is more commonly used by digital cameras and smart phones to format a JPEG image.  It contains all of the meta-data about the image including size, aspect ratio, ISO, location (if geotagging is enabled) etc.  The size of the Exif metadata is limited to 64 kB so size will be less of a concern when embedding text into the image.  JFIF, on the other hand, is more commonly used in image processing software and on the web.  It is the simplified version of original JIF format.  I could not find specific information about the size of the metadata in this format.

PNG is a different type of format then JPEG.  It contains its compression and formatting algorithms and uses loss less compression.  This means that a PNG image can be completely restored to its original raw state even after being compressed.  The metadata information of PNG is stored in chunks of variable size.  There is a predefined tEXt chunk that can be used to store text.  This is the chunk that we will most likely use to store the license within the file.  I could not find any data on a maximum size of the tEXt chunk.

In my research I also found a PDF about the creation of a cross platform library.  It takes you through the conversion of an existing program into a library.  It seems a bit dated but still contains some helpful tips and design ideas about creating cross platform libraries.

I am working on a program that embeds text into an image using the Qt framework.  Let's see how it turns out.