Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add gravity option for cropping and/or transforming #222

Closed
jinpark opened this issue Mar 24, 2015 · 2 comments
Closed

Add gravity option for cropping and/or transforming #222

jinpark opened this issue Mar 24, 2015 · 2 comments
Labels

Comments

@jinpark
Copy link

@jinpark jinpark commented Mar 24, 2015

http://www.imagemagick.org/script/command-line-options.php#crop

Imagemagick allows for cropping with gravity to control from where the image is cropped. Would be nice to add this option to the API

I might do this myself after I familiarize myself with the codebase :)

@emcconville
Copy link
Owner

@emcconville emcconville commented Mar 24, 2015

If I remember correctly, ImageMagick's C-API doesn't include gravity options to any crop methods.

Luckily, GAVITY_TYPES are already defined in wand/darwing.py. Simply add a new gravity=None kwarg to Image.crop. Update the method to validate the presence of width & height when gravity is given, and follow the existing logic from ImageMagick's geometry.c.

@jinpark
Copy link
Author

@jinpark jinpark commented Aug 19, 2015

Thanks for doing this! Works great

@jinpark jinpark closed this Aug 19, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants