Storing art direction information in an image file

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
triblondon
Posts: 2
Joined: 2012-08-18T04:53:15-07:00
Authentication code: 67789

Storing art direction information in an image file

Post 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?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Storing art direction information in an image file

Post 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
triblondon
Posts: 2
Joined: 2012-08-18T04:53:15-07:00
Authentication code: 67789

Re: Storing art direction information in an image file

Post by triblondon »

Thanks. So does that mean there is no more semantic support for this kind of data?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Storing art direction information in an image file

Post 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
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Storing art direction information in an image file

Post 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:
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply