http://www.imagemagick.org/script/comma ... hp#gravity correctly says the default is "undefined", but doesn't say that "+gravity" can be used to set the default gravity.
Please add a note about "+gravity". Thanks.
-gravity documentation
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
-gravity documentation
snibgo's IM pages: im.snibgo.com
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: -gravity documentation
I do not understand the default "undefined". It seems to me that the default is northwest.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: -gravity documentation
"-gravity undefined" and "-gravity northwest" are similar but not always identical. Consider three cases (tested with v6.9.5-3):
Code: Select all
convert -size 300x100 xc: -pointsize 50 -annotate +0+20 "Hy" gravtest_null.png
Code: Select all
convert -size 300x100 xc: -gravity Undefined -pointsize 50 -annotate +0+20 "Hy" gravtest_und.png
Code: Select all
convert -size 300x100 xc: -gravity Northwest -pointsize 50 -annotate +0+20 "Hy" gravtest_nw.png
snibgo's IM pages: im.snibgo.com
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: -gravity documentation
snigbo: Thanks for the clarification. It seems to be the case when placing text. But it looks to me that they are the same for -composite as per:
And I also think they are the same for -crop.
So perhaps this should also be made clear in the docs, if this is indeed true.
Code: Select all
convert logo: rose: -compose over -composite logo_rose_und.jpg
Code: Select all
convert logo: rose: -gravity northwest -compose over -composite logo_rose_nw.jpg
So perhaps this should also be made clear in the docs, if this is indeed true.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: -gravity documentation
Crop with a percentage, no offsets, and no gravity:
"-gravity Undefined" returns the same result. But NorthWest gives us only one output:
With a percentage (%) in the crop and no offsets, supplying any real gravity gives us just one image. But supplying no gravity, or "Undefined", we get multiple images.
Looking at the code (in geometry.c and transform.c) this looks deliberate, not a bug.
My own rule of thumb is: when I care about the gravity, I specify it.
Code: Select all
f:\web\im>%IM%convert rose: -crop 20x20% info:
rose:[0] PPM 14x9 70x46+0+0 8-bit sRGB 0.000u 0:00.000
rose:[1] PPM 14x9 70x46+14+0 8-bit sRGB 0.016u 0:00.016
rose:[2] PPM 14x9 70x46+28+0 8-bit sRGB 0.016u 0:00.016
rose:[3] PPM 14x9 70x46+42+0 8-bit sRGB 0.016u 0:00.016
rose:[4] PPM 14x9 70x46+56+0 8-bit sRGB 0.016u 0:00.016
rose:[5] PPM 14x9 70x46+0+9 8-bit sRGB 0.016u 0:00.016
rose:[6] PPM 14x9 70x46+14+9 8-bit sRGB 0.016u 0:00.016
rose:[7] PPM 14x9 70x46+28+9 8-bit sRGB 0.016u 0:00.016
rose:[8] PPM 14x9 70x46+42+9 8-bit sRGB 0.016u 0:00.016
rose:[9] PPM 14x9 70x46+56+9 8-bit sRGB 0.016u 0:00.016
rose:[10] PPM 14x9 70x46+0+18 8-bit sRGB 0.031u 0:00.031
rose:[11] PPM 14x9 70x46+14+18 8-bit sRGB 0.031u 0:00.031
rose:[12] PPM 14x9 70x46+28+18 8-bit sRGB 0.031u 0:00.031
rose:[13] PPM 14x9 70x46+42+18 8-bit sRGB 0.031u 0:00.031
rose:[14] PPM 14x9 70x46+56+18 8-bit sRGB 0.031u 0:00.031
rose:[15] PPM 14x9 70x46+0+27 8-bit sRGB 0.031u 0:00.031
rose:[16] PPM 14x9 70x46+14+27 8-bit sRGB 0.031u 0:00.031
rose:[17] PPM 14x9 70x46+28+27 8-bit sRGB 0.031u 0:00.031
rose:[18] PPM 14x9 70x46+42+27 8-bit sRGB 0.047u 0:00.047
rose:[19] PPM 14x9 70x46+56+27 8-bit sRGB 0.047u 0:00.047
rose:[20] PPM 14x9 70x46+0+36 8-bit sRGB 0.047u 0:00.047
rose:[21] PPM 14x9 70x46+14+36 8-bit sRGB 0.047u 0:00.047
rose:[22] PPM 14x9 70x46+28+36 8-bit sRGB 0.047u 0:00.047
rose:[23] PPM 14x9 70x46+42+36 8-bit sRGB 0.047u 0:00.047
rose:[24] PPM 14x9 70x46+56+36 8-bit sRGB 0.047u 0:00.047
rose:[25] PPM 14x1 70x46+0+45 8-bit sRGB 0.047u 0:00.047
rose:[26] PPM 14x1 70x46+14+45 8-bit sRGB 0.063u 0:00.063
rose:[27] PPM 14x1 70x46+28+45 8-bit sRGB 0.063u 0:00.063
rose:[28] PPM 14x1 70x46+42+45 8-bit sRGB 0.063u 0:00.063
rose:[29] PPM 14x1 70x46+56+45 8-bit sRGB 0.063u 0:00.063
Code: Select all
f:\web\im>%IM%convert rose: -gravity NorthWest -crop 20x20% info:
rose: PPM 14x9 70x46+0+0 8-bit sRGB 0.000u 0:00.000
Looking at the code (in geometry.c and transform.c) this looks deliberate, not a bug.
My own rule of thumb is: when I care about the gravity, I specify it.
snibgo's IM pages: im.snibgo.com