Page 1 of 1

Is there a way to modify the current caption?

Posted: 2014-08-18T10:46:46-07:00
by ooker
Say I have a picture with caption "A", I want to change it to "A and B" without knowing A? The only way I know so far is

Code: Select all

old_caption=`identify -verbose file |grep caption|cut -c 14-`
then edit the old caption. Is there any better solution?

Re: Is there a way to modify the current caption?

Posted: 2014-08-18T11:38:01-07:00
by fmw42
Do you mean comment in the Properties section? If so, you can use the %c string format at http://www.imagemagick.org/script/escape.php

comment=`convert image -format "%c" info:`

to retrieve the comment and store it in a variable. Then change the variable to add more.

Re: Is there a way to modify the current caption?

Posted: 2014-08-18T12:02:27-07:00
by ooker
Although it's still an indirect solution, your command is more intuitive. Thank you.

Re: Is there a way to modify the current caption?

Posted: 2014-08-18T12:49:47-07:00
by fmw42
If you do not care what was there already, you can just write over the old comment. Otherwise, I do not believe there is any more direct way to add to a comment. But the IM developers would have to comment to confirm that statement. Perhaps there is another way that I do not know about.

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

But I believe by modify, it really means replace and not add to.