![]() ![]() Also, we will use the optimization attributes of the save method. We will optimize every image one by one and save them. To perform the same process in bulk, we need to use a for loop in our script. IMAGE RESIZE PIL HOW TOSo, how can we perform the same thing in bulk? How to Resize Multiple Images in bulk with Python and Pillow We have performed a resize process sucessfully. ![]() IMAGE RESIZE PIL CODEIf you wonder how the size of the image would change if we would use a higher resolution with the same image optimization code structure, you can read “How to Compress and Optimize Images in bulk with Python” article. We have compressed it more than 20 times. Our original image was 464 KB with the dimensions 2400, 1500. We have also saved the file with optimization and 65% quality. Here, we have set 400 width and 400 height. Image.save('thumbnail_optimized.jpeg', optimize=True, quality=65) With thumbnail, you can determine a size and Pillow create it in the most convenient aspect ratio for the coder. Pillow Library has another built-in method to make this process easy. To create a proportioned image resize process, we don’t need so much effort. How to Create Thumbnail Image with a Fixed Aspect Ratio in Python’s Pillow Library
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |