Yes, this happens to me. This was an exercise for me, because I never cropped or created thumbnails using PIL ...
notthumbnails (size, filter = None)
Replaces the original image in place with a new image of the specified size (p. 2). The optional filter argument works the same as in the .resize () method. This operation retains the proportions (height: width). The resulting image will be as large as possible, while still adjusting to the specified size. For example, if the image im has a size of (400,150), its size after im.thumbnail ((40,40)) will be (40,15) .
So what happens
- You are using a sketch that supports aspect
- 40 x 40.
- , , -
, , :
def croptest(file, width, height):
import Image as pil
import os
max_width = width
max_height = height
file, ext = os.path.splitext(file)
img = pil.open(file)
img.thumbnail((max_width, max_height), pil.ANTIALIAS)
img.save(file + ".thumb.jpeg", 'JPEG')
croppedImage = img.crop((10, 10, 40, 40))
croppedImage.save(file + ".croppedthumb.jpeg", 'JPEG')
if __name__ == "__main__":
croptest("Desktop.bmp", 50, 50)
Desktop.thumb.jpeg 50 x 37, Desktop.croppedthumb.jpeg 30 x 30, 3 .
, , , .