PIL crop image give incorrect height result
<pre><code>import PIL
from PIL import Image

img = Image.open('0009_jpg.jpg')

width, height = img.size #height is 720 and width is 480

if height &gt; width:
    rm_height = abs(height - width) # rm_height = 240
    x_offset = 0
    y_offset = rm_height/2 # y_offset = 120
    tall = height-rm_height # tall = 480
    img_crop = img.crop((x_offset, y_offset, width, tall))

img_crop.save('crop_jpg.jpg')
</code></pre>

<p>output image is 480x360 resulution not 480x480</p>

<p>but when i change this line to</p>

<pre><code>tall = height-rm_height/2 # tall = 600
</code></pre>

<p>output image is square 480x480</p>

<p>it's not make sense. what i do wrong. thanks</p>

<p>OK after i search for more. Now i get it from this <a href="http://labb.in/s/ZCwU" rel="nofollow">post</a></p>

<p>Chris Clarke's (<a href="http://labb.in/s/ZCqu" rel="nofollow">edited</a> by San4ez) answer:</p>

<pre><code>import Image
im = Image.open(&lt;your image&gt;)
width, height = im.size   # Get dimensions

left = (width - new_width)/2
top = (height - new_height)/2
right = (width + new_width)/2
bottom = (height + new_height)/2

im.crop((left, top, right, bottom))
</code></pre>

<p>it's not tall. it is bottom</p>

python python-2.7 python-imaging-library