About 554,000 results
Open links in new tab
  1. python - How do I resize an image using PIL and maintain its …

    Nov 7, 2008 · By default PIL save() method is poor quality, you can use image.save(file_path, quality=quality_value) to change the quality. This script will resize an image (somepic.jpg) using PIL (Python Imaging Library) to a width of 300 pixels and a height proportional to the new width.

  2. Python PIL | Image.resize() method - GeeksforGeeks

    Aug 9, 2024 · Image.resize () Returns a resized copy of this image. size – The requested size in pixels, as a 2-tuple: (width, height). resample – An optional resampling filter.

  3. Python - Resize Image using PIL - Python Examples

    To resize an image with Python Pillow, you can use the resize () method of the PIL.Image.Image class. This method allows you to specify the desired image size, the resampling filter to use, and the region of the source image to be considered for resizing.

  4. Python Pillow – Working with Images - GeeksforGeeks

    Oct 24, 2021 · Getting the size of the image: obj.size attribute provides the size of the image. It returns a tuple that contains width and height. Output: We can change the name, format of the image, and can also rename it using the image.save () method. Syntax: Image.save (fp, format=None, **params) Code: Output:

  5. Resize an Image using Python Pillow (PIL) - AskPython

    Jan 29, 2022 · How to Resize an Image using Pillow (PIL) To start with, we use the resize method from the PIL library. Syntax: Image.resize(size, resample=0) Parameters of the method: Size: Should be in pixels, as a tuple(width, height). Resample: Optional. can be one of PIL.Image.BILINEAR (linear interpolation), PIL.Image.NEAREST (use nearest neighbor), PIL ...

  6. Resizing Images Using Python Pillow - PyTutorial

    Oct 19, 2024 · You can do this using the Image.open() method: from PIL import Image # Load an image image = Image. open ('path_to_your_image.jpg') Resizing the Image. To resize the image, use the resize() method. You can specify the new size as a tuple (width, height): # Resize the image new_size = (800, 600) resized_image = image. resize (new_size)

  7. How to Resize Images in Python using Pillow - datagy

    Apr 8, 2022 · In this tutorial, you’ll learn how to resize an image in Python using the Pillow library. You’ll learn how to resize individual images and multiple images in bulk. You’ll also learn how to specify a percentage to scale by, a maximum width, and a maximum height. By the end of this tutorial, you’ll have learned:

  8. Solved: How to Resize an Image Using PIL and Maintain Its

    Nov 1, 2024 · How to Resize an Image Using PIL and Maintain Its Aspect Ratio. Method 1: Basic Resizing to a Specified Width; Method 2: Using the Thumbnail Method; Method 3: Dynamic Resizing Based on Known Dimensions; Method 4: Resizing by a Percentage; Alternative Approaches: Using External Libraries; FAQs on How to …

  9. How to Resize Image While Maintaining Its Aspect Ratio in Python

    Feb 2, 2024 · With Python, we used Image.open to resize and read an image using PIL and maintain its aspect ratio. After calculating the new width and height, we resized the image using the resize method and saved the new image using the same method according to the new width.

  10. Python Script For Resize images At once | by Buddy | Medium

    Sep 18, 2023 · Python script that uses the Python Imaging Library (PIL) module (which is now known as Pillow) to resize images in a specified input folder and save the resized images in an output folder....

  11. Some results have been removed
Refresh