crop with gravity

Discuss the conjure program and the Magick Scripting Language (MSL) here. MSL is an XML-based wrapper to the ImageMagick image-processing functions.
Post Reply
docjones2
Posts: 11
Joined: 2011-07-27T15:42:04-07:00
Authentication code: 8675308

crop with gravity

Post by docjones2 » 2011-07-28T13:17:51-07:00

I reported this issue in a different thread, but I am moving it to its own thread, to ensure the issue gets attention.

A patch which appeared in today's beta allows gravity to be <set>, however <crop> does not implement gravity at this time.

in msl.c at line 2141, the function ParsePageGeometry is called as opposed to ParseGravityGeometry, which causes gravity to be ignored in rendering the image.

Changing line 2141 to :

Code: Select all

flags=ParseGravityGeometry(msl_info->image[n],value,
                        &geometry,&exception);
results in proper handling of gravity.

This fix does will only work for the geometry attribute. Supplying attributes height, width, x and y will result in gravity being ignored.

If <crop> was implemented in this way (to ignore gravity) on purpose, it would be a good idea to implement a gravity attribute to work around this design.

If this can be adopted, that would be great. My project requires a <crop> with gravity support, if this is not implemented, I will not be able to use msl for this project. Project requirements dictate that we can not use modified source code.

Thank you!

I will be toying with msl.c to try to get gravity to work with height, width, x and y. If I come up with a good solution, I will post it here.

docjones2
Posts: 11
Joined: 2011-07-27T15:42:04-07:00
Authentication code: 8675308

Re: crop with gravity

Post by docjones2 » 2011-07-29T14:55:15-07:00

There has been no response to this thread.

Can somebody tell me the status?

If this request reflects a misunderstanding on my part, can someone explain to me the proper way to achieve a `convert file -gravity Center -crop 250x250+0+0` using msl?

Thank you.

Post Reply