Page 1 of 1

How do labelling on 2 lines using %f in montage

Posted: 2008-08-04T15:07:14-07:00
by kalagani
Bonjour,

I am using below

Code: Select all

montage -background white -label "%f\n%wx%h  %b" -frame 2 -quality 100 \
          -geometry 200x+2 *[0] -title `pwd`  index.jpg
but sometime %f returned is very long, so I want to put it on 2 lines automaticaly or after caracters counting
After search on Internet, reading http://www.imagemagick.org/Usage...
I tried caption, or awk inserted in the code above but without results

I just succeed in doing in a single identify command

Code: Select all

identify -format "%f\n" *[1] |awk '{print substr($0,0,12)"\n"substr($0,13,100)}' 

Re: How do labelling on 2 lines using %f in montage

Posted: 2008-08-10T21:42:34-07:00
by anthony
Label is not a word-wrapped text to image convertor, unfortunatally that is what "montage" uses.

The one which word wraps is 'caption' which is what a '-polarariod' framing operator will use.

see IM Examples, for a montage that uses -polariod..
http://www.imagemagick.org/Usage/montage/#polaroid

The only other thing that can be suggested is to DIY the montage yourself, or pre-process the labeling yourself.

IM Examples "Annotating Images" can help with this.

Re: How do labelling on 2 lines using %f in montage

Posted: 2008-11-05T15:01:06-07:00
by kalagani
Hello Anthony,
I make a workaround to have labelling on 2 lines:
evaluate length of photo, then pre-processing polaroid thumbnails with caption on 1 or 2 lines
so make the index with montage from the thumbnails, end by removing the thumbnails.

Defaults:
Creating intermediate thumbnails, the html is not useful because it is on the thumbnails not on the source!
Lot of blank area between photos in the polaroid index
Each polaroid thumbnail is slightly curved

Do you know solution to solve these defaults?

Thanks

Code: Select all

    for Photos in *
    do 
      if [ -f "$Photos" ]
	  then 
	  datePhoto=`echo "$Photos" | awk '{print substr($0,0,12)}'`
	  nomPhoto=`echo "$Photos" | awk '{print substr($0,14,32)}'`
	  nomPhoto2=`echo "$Photos" | awk '{print substr($0,46,50)}'`
#          Make label with name  on 1 or 2 lines in a polaroid thumbnail
#          *[0] to take only the main picture
	  if [ -z "$nomPhoto2" ]
	      then
	      convert -caption "$datePhoto\n$nomPhoto\n %wx%h  %b" $Photos[0] -thumbnail 240x240 \
	      -polaroid -0 $Photos"_thumb".png
	  else
	      convert -caption "$datePhoto\n$nomPhoto\n$nomPhoto2 %wx%h  %b" $Photos[0] -thumbnail 240x240 \
	      -polaroid -0 $Photos"_thumb".png 2>> "$dateRep"_000_"$themeRep"_convert.error
	  fi
      fi
    done
#    Index from polaroid thumbnails
    echo " index`" type: aaaa-mm-jj-x_theme"
    montage -size 500x500 *_thumb.png -geometry 200x+0+0 -title "$1" -tile 6x \
                     "$dateRep"_000_"$themeRep"_index.jpg
    \rm *_thumb.png

Re: How do labelling on 2 lines using %f in montage

Posted: 2008-11-05T16:21:01-07:00
by anthony
I am not certain exactly what you are after. It is not very clear.

however if "montage" or a "montage with polaroids" does not do what you want, than your only solution is to try to generate your own version of montage.

That is create thumbnails, pad, annotate, frame, and create an array of images in the way that you require it.

IM can do this...

Sorry that is all I can suggest.