(img, target_width, method=Image.BICUBIC)
| 96 | |
| 97 | |
| 98 | def __scale_width(img, target_width, method=Image.BICUBIC): |
| 99 | ow, oh = img.size |
| 100 | if (ow == target_width): |
| 101 | return img |
| 102 | w = target_width |
| 103 | h = int(target_width * oh / ow) |
| 104 | return img.resize((w, h), method) |
| 105 | |
| 106 | |
| 107 | def __scale_shortside(img, target_width, method=Image.BICUBIC): |