Python Imaging Library

Last updated
Python Imaging Library
Original author(s) Fredrik Lundh
Developer(s) Secret Labs AB
Initial release1995;30 years ago (1995) [1]
Stable release
1.1.7 / November 15, 2009;15 years ago (2009-11-15) [2]
Preview release
1.2a0 [3] / 2011;14 years ago (2011)
Written in Python, C
Type Library for image processing
License Historical Permission Notice and Disclaimer [1]
Website python-pillow.github.io
Pillow
Original author(s) Jeffrey A. Clark (Alex)
Initial release31 July 2010;14 years ago (2010-07-31) [1]
Stable release
10.1.0 / October 15, 2023;14 months ago (2023-10-15)
Written in Python, C
Type Library for image processing
License Historical Permission Notice and Disclaimer [1]
Website python-pillow.github.io

Python Imaging Library is a free and open-source additional library for the Python programming language that adds support for opening, manipulating, and saving many different image file formats. It is available for Windows, Mac OS X and Linux. The latest version of PIL is 1.1.7, was released in September 2009 and supports Python 1.5.2–2.7. [2]

Contents

Development of the original project, known as PIL, was discontinued in 2011. [3] Subsequently, a successor project named Pillow forked the PIL repository and added Python 3.x support. [4] This fork has been adopted as a replacement for the original PIL in Linux distributions including Debian [5] and Ubuntu (since 13.04). [6]

Capabilities

PIL offers several standard procedures for image manipulation. These include:

File formats

Supported file formats include PPM, PNG, JPEG, GIF, TIFF, and BMP. PIL is extensible, allowing users to create custom decoders for any file format. [10]

Programming examples

importosfromPILimportImagedefconvert_jpegs_to_pngs(folder_path):# Checks if the provided path is a folderifnotos.path.isdir(folder_path):print(f"Error: {folder_path} is not a valid folder.")return# Iterates over all files in the folderforfilenameinos.listdir(folder_path):# Checks if the file has a .jpg or .jpeg extensioniffilename.lower().endswith('.jpg')orfilename.lower().endswith('.jpeg'):# Full path of the filejpeg_path=os.path.join(folder_path,filename)# Path for the converted filepng_path=os.path.join(folder_path,os.path.splitext(filename)[0]+'.png')try:# Opens the JPEG imagewithImage.open(jpeg_path)asimg:# Converts and saves as PNGimg.save(png_path,'PNG')print(f"Converted {jpeg_path} to {png_path}")exceptExceptionase:print(f"Error converting {jpeg_path}: {e}")

Related Research Articles

<span class="mw-page-title-main">Shell script</span> Script written for the shell, or command line interpreter, of an operating system

A shell script is a computer program designed to be run by a Unix shell, a command-line interpreter. The various dialects of shell scripts are considered to be command languages. Typical operations performed by shell scripts include file manipulation, program execution, and printing text. A script which sets up the environment, runs the program, and does any necessary cleanup or logging, is called a wrapper.

<span class="mw-page-title-main">APT (software)</span> Free software package management system

Advanced Package Tool (APT) is a free-software user interface that works with core libraries to handle the installation and removal of software on Debian and Debian-based Linux distributions. APT simplifies the process of managing software on Unix-like computer systems by automating the retrieval, configuration and installation of software packages, either from precompiled files or by compiling source code.

<span class="mw-page-title-main">Preview (macOS)</span> Image and PDF viewer software by Apple

Preview is the built-in image viewer and PDF viewer of the macOS operating system. In addition to viewing and printing digital images and Portable Document Format (PDF) files, it can also edit these media types. It employs the Aqua graphical user interface, the Quartz graphics layer, and the ImageIO and Core Image frameworks.

deb is the format, as well as filename extension of the software package format for the Debian Linux distribution and its derivatives.

DOT is a graph description language, developed as a part of the Graphviz project. DOT graphs are typically stored as files with the .gv or .dot filename extension — .gv is preferred, to avoid confusion with the .dot extension used by versions of Microsoft Word before 2007. dot is also the name of the main program to process DOT files in the Graphviz package.

<span class="mw-page-title-main">Geeqie</span>

Geeqie is a free software image viewer and image organiser program for Unix-like operating systems, which includes Linux-based systems and Apple's OS X. It was first released in March 2010, having been created as a fork of GQview, which appeared to have ceased development. It uses the GTK toolkit. In September 2015, development was moved from SourceForge to GitHub.

An image file format is a file format for a digital image. There are many formats that can be used, such as JPEG, PNG, and GIF. Most formats up until 2022 were for storing 2D images, not 3D ones. The data stored in an image file format may be compressed or uncompressed. If the data is compressed, it may be done so using lossy compression or lossless compression. For graphic design applications, vector formats are often used. Some image file formats support transparency.

Design rule for Camera File system (DCF) is a JEITA specification which defines a file system for digital cameras, including the directory structure, file naming method, character set, file format, and metadata format. It is currently the de facto industry standard for digital still cameras. The file format of DCF conforms to the Exif specification, but the DCF specification also allows use of any other file formats. As of 2021, the latest version of the standard was 2.0, issued in 2010.

The Apple Icon Image format (.icns) is an icon format used in Apple Inc.'s macOS. It supports icons of 16 × 16, 32 × 32, 48 × 48, 128 × 128, 256 × 256, 512 × 512 points at 1x and 2x scale, with both 1- and 8-bit alpha channels and multiple image states. The fixed-size icons can be scaled by the operating system and displayed at any intermediate size.

<span class="mw-page-title-main">Comic book archive</span> File format

A comic book archive or comic book reader file is a type of archive file for the purpose of sequential viewing of images, commonly for comic books. The idea was made popular by the CDisplay sequential image viewer; since then, many viewers for different platforms have been created.

<span class="mw-page-title-main">AcetoneISO</span> Open source virtual drive software

AcetoneISO is a free and open-source virtual drive software to mount and manage image files. Its goals are to be simple, intuitive and stable. Written in Qt, this software is meant for all those people looking for a "Daemon Tools for Linux". However, AcetoneISO does not emulate any copy protection while mounting.

<span class="mw-page-title-main">Phatch</span> Raster graphics editing software

Phatch is a raster graphics editor used to batch process digital graphics and photographs. Phatch can be used on the desktop as a GUI program or on the server as a console program.

OggConvert is a free and open-source transcoder for digital audio and video files of various types into the free Ogg Vorbis audio format, and the Theora, VP8 and Dirac video formats. It supports Ogg, Matroska and WebM containers for output. It is developed by a single author, primarily for Linux. A number of community translations exist for the software.

WebP is a raster graphics file format developed by Google intended as a replacement for JPEG, PNG, and GIF file formats. It supports both lossy and lossless compression, as well as animation and alpha transparency.

<span class="mw-page-title-main">Zim (software)</span> Personal wiki software written in Python

Zim is a graphical text editor designed to maintain a collection of locally stored wiki-pages, a personal wiki. It works as a personal knowledge base and note-taking software application that operates on text files using markdown. Each wiki-page can contain things like text with simple formatting, links to other pages, attachments, and images. Additional plugins, such as an equation editor and spell-checker, are also available. The wiki-pages are stored in a folder structure in plain text files with wiki formatting. Zim can be used with the Getting Things Done method.

Orthanc is a standalone DICOM server. It is designed to improve the DICOM flows in hospitals and to support research about the automated analysis of medical images. Orthanc lets its users focus on the content of the DICOM files, hiding the complexity of the DICOM format and of the DICOM protocol. It is licensed under the GPLv3.

<span class="mw-page-title-main">Ginkgo CADx</span> Medical imaging software and DICOM viewer

Ginkgo CADx is an abandoned multi platform DICOM viewer (*.dcm) and dicomizer. Ginkgo CADx is licensed under LGPL license, being an open source project with an open core approach. The goal of Ginkgo CADx project was to develop an open source professional DICOM workstation.

PMView is a raster graphics image viewer, converter, and organizer with basic image editing capabilities. It was originally developed for OS/2 but is also available for Microsoft Windows.

<span class="mw-page-title-main">GNOME SoundConverter</span>

GNOME SoundConverter is an unofficial GNOME-based free and open-source transcoder for digital audio files. It uses GStreamer for input and output files. It has multi threaded design and can also extract the audio from video files.

LibRaw is a free and open-source software library for reading raw files from digital cameras. It supports virtually all raw formats. It is based on the source code of dcraw, with modifications, and "is intended for embedding in raw converters, data analyzers, and other programs using raw files as the initial data."

References

  1. 1 2 3 4 "Software License". Secret Labs AB. Archived from the original on 20 July 2020. Retrieved December 8, 2013.
  2. 1 2 "Python Imaging Library". Secret Labs AB. Archived from the original on 21 November 2020. Retrieved December 8, 2013.
  3. 1 2 "effbot / pil-2009-raclette". Archived from the original on 15 March 2015. Retrieved December 8, 2013.
  4. "Pillow: a modern fork of PIL" . Retrieved December 8, 2013.
  5. "Details of package python-imaging in sid". packages.debian.org. Software in the Public Interest . Retrieved December 8, 2013.
  6. "Details of package python-imaging in raring". ubuntu.com. Canonical Ltd. Retrieved December 8, 2013.
  7. "PyAccess Module". readthedocs.io. Retrieved September 20, 2024.
  8. "ImageFilter Module". readthedocs.io. Retrieved September 20, 2024.
  9. "ImageColor Module". readthedocs.io. Retrieved September 20, 2024.
  10. "D. Writing Your Own File Decoder". Effbot.org. Retrieved 2014-01-28.