Page 1 of 1

Storing art direction information in an image file

Posted: 2012-08-18T05:05:35-07:00
by triblondon
Hi all,

I'm looking at the idea of storing additional data in image files to provide crop guides for resizing the image, and wondered whether anyone's done this before and how it could/should be done. The background is that I work for a newspaper, and we produce large images all the time, and we want these to be viewable in lots of different layouts, orientations and screen sizes. Many images have lots of 'background space' that could be cropped off to allow the image to fit an unknown aspect ratio without losing any of the subject, but you'd need to know when a too-aggressive crop would chop off someone's head!

Equally, when a group shot (say a photo of the UK Olympic team) needs to be shown at a very small size, it may be preferable to recrop it to show only a few of the people at the centre of the shot, but you'd want to do this in a way that avoided cropping half way through a person.

So, I think I'm looking for a way of using EXIF or PNG metadata to store 'suggested crops' as well as allowable variations to account for unknown aspect ratios. The user agent can then read the metadata and choose a crop that is closest to the size of the canvas, making adjustments within the allowable variations for that crop.

Is there any existing support for this kind of thing in any image metadata format? If not, is there a way that it is conventionally done?

Re: Storing art direction information in an image file

Posted: 2012-08-18T07:39:05-07:00
by fmw42
You can use -comment or -set comment to put information in the meta data

see http://www.imagemagick.org/script/comma ... hp#comment

Re: Storing art direction information in an image file

Posted: 2012-08-18T09:22:42-07:00
by triblondon
Thanks. So does that mean there is no more semantic support for this kind of data?

Re: Storing art direction information in an image file

Posted: 2012-08-18T10:36:48-07:00
by fmw42
triblondon wrote:Thanks. So does that mean there is no more semantic support for this kind of data?
What do you mean by that?

By naming your comment, you can extract it from the verbose information stored in the file using unix commands to search for the name. Is that what you are asking?

convert rose: -set comment mycomment:"this is a comment" rose.png
identify -verbose rose.png
...

Properties:
comment: mycomment:this is a comment
date:create: 2012-08-18T10:39:04-07:00
date:modify: 2012-08-18T10:39:04-07:00
...


mycomment=`identify -verbose rose.png | grep "mycomment" | cut -d: -f 3`
echo "$mycomment"
this is a comment

Re: Storing art direction information in an image file

Posted: 2012-08-27T18:24:47-07:00
by anthony
Any normal properity setting will be saved with the image using PNG format.
However only a few image processing programs may be able to make use of it.

See the Montage: Using Saved Image MetaData, for examples
http://www.imagemagick.org/Usage/montage/#metadata


NOTE: IMv7 can make direct use of such meta-data in operators.

For example save a image with some 'prefered resize and crop data'...

Code: Select all

magick logo: -set resize_setting '30%'  -set crop_setting '89x121+78+23'  logo.png
Now using IMv7 load the image then: resize, crop, and display, using that saved data

Code: Select all

magick logo.png -resize '%[resize_setting]'  -crop '%[crop_setting]' show: