Crop Label width

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
utbl
Posts: 18
Joined: 2016-09-22T01:53:33-07:00
Authentication code: 1151

Crop Label width

Post by utbl »

I want to crop the label / text width in this command:

convert -background none -bordercolor none -gravity west
1.png label:"1" +swap -append label:"text 1" -append -write miff:- +delete
2.png label:"2" +swap -append label:"text 2" -append -write miff:- +delete
3.png label:"3" +swap -append label:"text 3" -append -write miff:- +delete
4.png label:"4" +swap -append label:"text 4" -append -write miff:- +delete
5.png label:"5" +swap -append label:"text 5" -append -write miff:- +delete
6.png label:"6" +swap -append label:"text 6" -append miff:- | montage -set label "" miff:-
-background pink -tile 3x2 -geometry +15+5 result.png

the command creates me an image nearly like this one: https://i.stack.imgur.com/uipMc.png
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Crop Label width

Post by fmw42 »

I am not sure what you want to crop. Can you be more specific? Is it the part marked LOGO?

That is an incorrect command. First there is no label specified in your command. You probably mean -title "Logo" rather than -set label ""

If you do something like this (unix syntax) and add -debug annotate, you will get the information about the text being created.

Code: Select all

convert -background none -bordercolor none -gravity west \
rose:  label:"1" +swap -append label:"text 1" -append -write miff:- +delete \
rose:  label:"2" +swap -append label:"text 2" -append -write miff:- +delete \
rose:  label:"3" +swap -append label:"text 3" -append -write miff:- +delete \
rose:  label:"4" +swap -append label:"text 4" -append -write miff:- +delete \
rose:  label:"5" +swap -append label:"text 5" -append -write miff:- +delete \
rose:  label:"6" +swap -append label:"text 6" -append miff:- |\
montage -debug annotate -title "TEST" miff:- -background pink -tile 3x2 -geometry +15+5 result.png
...
Metrics: text: TEST; width: 62; height: 28; ascent: 22; descent: -5; max advance: 48; bounds: 0.5625,-0.078125 14.1875,18; origin: 62,0; pixels per em: 24,24; underline position: -4.5625; underline thickness: 2.34375
2016-11-24T11:31:56-08:00 0:00.590 0.050u 6.9.6 Annotate montage[477]: annotate.c/RenderFreetype/1418/Annotate
Font /Library/Fonts/Arial.ttf; font-encoding none; text-encoding none; pointsize 24
2016-11-24T11:31:56-08:00 0:00.590 0.060u 6.9.6 Annotate montage[477]: annotate.c/RenderFreetype/1418/Annotate
Font /Library/Fonts/Arial.ttf; font-encoding none; text-encoding none; pointsize 12
2016-11-24T11:31:56-08:00 0:00.590 0.060u 6.9.6 Annotate montage[477]: annotate.c/GetTypeMetrics/838/Annotate
...




Please always provide your IM version and platform, since syntax may differ.
utbl
Posts: 18
Joined: 2016-09-22T01:53:33-07:00
Authentication code: 1151

Re: Crop Label width

Post by utbl »

Sorry for that late reply I want to crop the label / text width.

My IM version: ImageMagick 6.9.3-7 Q16 x64 2016-03-06 http://www.imagemagick.org

OS: Windows 10
Post Reply