Hello,
I have read in various places that the msl language hasn't implemented all the features of PerlMagick yet, because of lack of demand -- however that features would implemented upon request "usually within a day."
There is currently no way to set gravity (ie: <set gravity='Center'/> ), which I need the ability to do.
I am using imagemagick 6.7 latest stable build, compiling source and running on various linux computers. I scoped msl.c and indeed gravity is not implemented in <set>
Thank you!
set gravity
Re: set gravity
We have a patch in ImageMagick 6.7.1-1 beta (available sometime tomorrow) to fix the problem you reported. Thanks.
Re: set gravity
Thank you!
I imagine the code will be available at ftp://ftp.imagemagick.org/pub/ImageMagick/beta/ , no?
I'll give it a whirl and post back on the status.
I imagine the code will be available at ftp://ftp.imagemagick.org/pub/ImageMagick/beta/ , no?
I'll give it a whirl and post back on the status.
Re: set gravity
It seems as if gravity is recognized now as a <set> option, however I'm not sure if it works correctly.
Consider the following
This doesn't seem to do what is expected, which (if I understand correctly) should be the equivalent of
If this assumption reflects my misunderstanding, how can I achieve a crop with gravity?
I have seen other tags (like composite) which support a gravity attribute, but crop does not.
Consider the following
Code: Select all
<set gravity='Center' />
<crop geometry='250x250+0+0'/>
Code: Select all
convert filename -gravity Center -crop 250x250+0+0 outname
I have seen other tags (like composite) which support a gravity attribute, but crop does not.
Re: set gravity
I figured it out.
at msl.c line 2141 there is the function call
changing this to
will give the behaviour I expected, and fixes my issue.
Of course, I am no imagemagick developer and I haven't even ever used PerlMagick, so I do not know whether or not I am breaking any rules or going against an earlier decision to implement <crop> in this way, but it does what I want.
Post back with any comments or insights or reprimands!
On a side note, convert -crop calls CropImageToTiles as opposed to CropImage, so my change does not exactly mimic the command line behaviour 1:1, but it comes close for my purposes. I'm not sure how msl would handle tiling behaviour anyway.
Cheers
EDIT: This fix will not work if attributes height, width, x, y are used instead of geometry. Trying to fix that now.
at msl.c line 2141 there is the function call
Code: Select all
flags=ParsePageGeometry(msl_info->image[n],value,
&geometry,&exception);
Code: Select all
flags=ParseGravityGeometry(msl_info->image[n],value,
&geometry,&exception);
Of course, I am no imagemagick developer and I haven't even ever used PerlMagick, so I do not know whether or not I am breaking any rules or going against an earlier decision to implement <crop> in this way, but it does what I want.
Post back with any comments or insights or reprimands!
On a side note, convert -crop calls CropImageToTiles as opposed to CropImage, so my change does not exactly mimic the command line behaviour 1:1, but it comes close for my purposes. I'm not sure how msl would handle tiling behaviour anyway.
Cheers
EDIT: This fix will not work if attributes height, width, x, y are used instead of geometry. Trying to fix that now.
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: set gravity
There are two composition methods used for placement of images.
gravity and a geometry offset (set using -gravity and -geometry)
virtual canvas offsets. (set using -page and -repage)
They are rarely used together.
See http://www.imagemagick.org/Usage/compose/#geometry
Be sure you are not changing something that should not be changed!
gravity and a geometry offset (set using -gravity and -geometry)
virtual canvas offsets. (set using -page and -repage)
They are rarely used together.
See http://www.imagemagick.org/Usage/compose/#geometry
Be sure you are not changing something that should not be changed!
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/