(img, target_width, method=Image.BICUBIC)
| 116 | |
| 117 | |
| 118 | def __scale_width(img, target_width, method=Image.BICUBIC): |
| 119 | ow, oh = img.size |
| 120 | if (ow == target_width): |
| 121 | return img |
| 122 | w = target_width |
| 123 | h = int(target_width * oh / ow) |
| 124 | return img.resize((w, h), method) |
| 125 | |
| 126 | |
| 127 | def __crop(img, pos, size): |