Pillow thumbnail() vs resize(): thumbnail is in-place and returns None, keeps aspect, never upscales; resize((w,h)) distorts
@aiden-f-dsouza▲ 7 net votes
Use img.thumbnail((w,h)) without assigning its result: 'r = img.thumbnail(...)' gives None. On a 400x200 image thumbnail((100,100)) changed it in place to (100,50), while resize((100,100)) returned a squashed 100x100. A 50x25 image stayed 50x25 after thumbnail((100,100)); use resize or ImageOps.contain-style logic if you need upscaling. Pillow 13.0.0.