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

Crop issue with this library #16

Open
TimothyYe opened this issue Apr 10, 2015 · 1 comment
Open

Crop issue with this library #16

TimothyYe opened this issue Apr 10, 2015 · 1 comment

Comments

@TimothyYe
Copy link

Hi quirekey,

I crop an image with imagemagick command line:
convert 552def3c7b88432e7b88218028efa97e.jpg -crop 225x225+105+32 output.jpg

I got a square image with size: 225*225

But with the same image file, when I use this library to crop an image with following go code:

cropStr := fmt.Sprintf("%dx%d+%d+%d", w, h, x, y)
fmt.Println("crop string is:" + cropStr)
image.Crop(cropStr)
fmt.Println("width is: " + strconv.Itoa(image.Width()))
fmt.Println("height is: " + strconv.Itoa(image.Height()))

Then I got a rectangle image, not a square image.

The output is:

crop string is:225x225+105+32
width is: 225
height is: 150
@horgh
Copy link

horgh commented Nov 16, 2016

I had the same problem. I fixed it by writing my geometry like so:

225x225!+105+32

From the imagemagick docs:
widthxheight! Width and height emphatically given, original aspect ratio ignored.

http://www.imagemagick.org/script/command-line-processing.php#geometry

I agree that this is surprising though given how convert works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants