FazBrowse Wikipedia Viewer | Main Page |
Search Wikipedia:
|
Viewing: https://en.wikipedia.org/wiki/Python_Imaging_Library

Python Imaging Library

"},"latest release version":{"wt":"1.1.7"},"latest release date":{"wt":"{{Start date and age|2009|11|15}}<ref name=\"website\">{{cite web |url=http://www.pythonware.com/products/pil/ |title=Python Imaging Library |website=Secret Labs AB |accessdate=December 8, 2013}}</ref>"},"latest preview version":{"wt":"1.2a0<ref name=\"hg\">{{cite web |title=effbot / pil-2009-raclette |url=http://hg.effbot.org/pil-2009-raclette |archive-url=https://web.archive.org/web/20150315041249/http://hg.effbot.org/pil-2009-raclette |archive-date=15 March 2015 |accessdate=December 8, 2013 }}</ref>"},"latest preview date":{"wt":"{{Start date and age|2011||}}"},"frequently updated":{"wt":"<!-- DO NOT include this parameter unless you know what it does -->"},"programming language":{"wt":"[[Python (programming language)|Python]], [[C (programming language)|C]]"},"operating system":{"wt":""},"platform":{"wt":""},"size":{"wt":""},"language":{"wt":""},"status":{"wt":""},"genre":{"wt":"Library for [[image processing]]"},"license":{"wt":"MIT-CMU<ref name=\"license\">{{cite web |title=Software License |website=Secret Labs AB |url=http://www.pythonware.com/products/pil/license.htm |accessdate=December 8, 2013}}</ref>"},"website":{"wt":"{{url|https://python-pillow.github.io/}}"}},"i":0}}]}'>
Python Imaging Library
Original authorFredrik Lundh
DeveloperSecret Labs AB
Release1995;31 years ago (1995)
Pillow
Original authorJeffrey A. Clark (Alex)
Release31 July 2010;16 years ago (2010-07-31)
importos fromPILimport Image defconvert_jpegs_to_pngs(folder_path): # Checks if the provided path is a folder if not os.path.isdir(folder_path): print(f"Error: {folder_path} is not a valid folder.") return # Iterates over all files in the folder for filename in os.listdir(folder_path): # Checks if the file has a .jpg or .jpeg extension if filename.lower().endswith(".jpg") or filename.lower().endswith(".jpeg"): # Full path of the file jpeg_path = os.path.join(folder_path, filename) # Path for the converted file png_path = os.path.join(folder_path, os.path.splitext(filename)[0] + ".png") try: # Opens the JPEG image with Image.open(jpeg_path) as img: # Converts and saves as PNG img.save(png_path, "PNG") print(f"Converted {jpeg_path} to {png_path}") except Exception as e: print(f"Error converting {jpeg_path}: {e}")

References

edit
"effbot / pil-2009-raclette". Archived from the original on 15 March 2015. Retrieved December 8, 2013.
  • ↑ "Details of package python-imaging in sid". packages.debian.org. Software in the Public Interest. Retrieved December 8, 2013.
  • ↑ "ImageFilter Module". readthedocs.io. Retrieved September 20, 2024.
  • ↑ Official website
  • PIL Library reference

  • View original on Wikipedia | Back | FazBrowse Home