nightfox89
nightfox89

Reputation: 83

ImageMagick incorrect dimensions

I've been on this problem for several hours now. I can't crop/resize a certain image correctly.

The source image has a dimension of 900x398 px The target dimension is 650x178 px

but the returned dimension is 647x178 px. I dont't get it. This is the command I use:

/usr/bin/convert jpg:"/location/20-prefab_woningen.jpg" -auto-orient -shave 0x78 -resize 650x174 -colorspace RGB "location/new.jpg" &&exit

Is this a common bug? I can't find anything on the web about it. ImageMagick version doesn't seem to matter, tried both local and on the server but I get the same results.

Upvotes: 4

Views: 3911

Answers (1)

Pekka
Pekka

Reputation: 449465

resize tries to fit the image into the specified dimensions. It doesn't force it to exactly that size. See the manual.

Use the !flag to tell IM to ignore the aspect ratio.

/usr/bin/convert jpg:"/location/20-prefab_woningen.jpg" 
                -auto-orient -shave 0x78 
                -resize 650x174\! 
                -colorspace RGB "location/new.jpg" &&exit

Upvotes: 4

Related Questions