Skip to content
geeksforgeeks
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Tutorials
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
  • Practice
    • Build your AI Agent
    • GfG 160
    • Problem of the Day
    • Practice Coding Problems
    • GfG SDE Sheet
  • Contests
    • Accenture Hackathon (Ending Soon!)
    • GfG Weekly [Rated Contest]
    • Job-A-Thon Hiring Challenge
    • All Contests and Events
  • Python Tutorial
  • Interview Questions
  • Python Quiz
  • Python Glossary
  • Python Projects
  • Practice Python
  • Data Science With Python
  • Python Web Dev
  • DSA with Python
  • Python OOPs
Open In App
Next Article:
Python PIL | ImageEnhance.Brightness() and ImageEnhance.Sharpness() method
Next article icon

Python PIL | ImageEnhance.Color() and ImageEnhance.Contrast() method

Last Updated : 27 Jun, 2019
Comments
Improve
Suggest changes
Like Article
Like
Report

PIL is the Python Imaging Library which provides the python interpreter with image editing capabilities. The ImageEnhance module contains a number of classes that can be used for image enhancement.

ImageEnhance.Color() method –

This class can be used to adjust the color balance of an image, in a manner similar to the controls on a color TV set. An enhancement factor of 0.0 gives a black and white image. A factor of 1.0 gives the original image.

Syntax: ImageEnhance.Color(image)

First, it is required to create an object of corresponding class in order to enhance image.




# This will import Image and ImageEnhance modules
from PIL import Image, ImageEnhance
  
# Opening Image
im = Image.open(r"C:\Users\Admin\Pictures\images.png")
  
# Creating object of Color class
im3 = ImageEnhance.Color(im)
  
# showing resultant image
im3.enhance(0.0).show()
 
 

Output:
For first image factor = 0.0 and for second image factor is 5.0.

ImageEnhance.Contrast() method –

This class can be used to control the contrast of an image, similar to the contrast control on a TV set. An enhancement factor of 0.0 gives a solid grey image. A factor of 1.0 gives the original image.

Syntax:

obj = ImageEnhance.Contrast(image)
obj.enhance(factor)

First, it is required to create an object of corresponding class in order to enhance image.




# This will import Image and ImageEnhance modules
from PIL import Image, ImageEnhance
  
# Opening Image
im = Image.open(r"C:\Users\Admin\Pictures\images.png")
  
# Creating object of Contrast class
im3 = ImageEnhance.Contrast(im)
  
# showing resultant image
im3.enhance(0.0).show()
 
 

Output:
For first image factor is 5.0 and for second 0.0



Next Article
Python PIL | ImageEnhance.Brightness() and ImageEnhance.Sharpness() method
author
sanjeev2552
Improve
Article Tags :
  • Python
  • Image-Processing
  • python-utility
Practice Tags :
  • python

Similar Reads

  • Python PIL | ImageEnhance.Brightness() and ImageEnhance.Sharpness() method
    PIL is the Python Imaging Library which provides the python interpreter with image editing capabilities. The ImageEnhance module contains a number of classes that can be used for image enhancement. ImageEnhance.Brightness() method - This class can be used to control the brightness of an image. An en
    2 min read
  • Python PIL | Image.alpha_composite() Method
    PIL is the Python Imaging Library which provides the python interpreter with image editing capabilities. The Image module provides a class with the same name which is used to represent a PIL image. The module also provides a number of factory functions, including functions to load images from files,
    1 min read
  • Python PIL | Image.convert() Method
    PIL is the Python Imaging Library which provides the python interpreter with image editing capabilities. The Image module provides a class with the same name which is used to represent a PIL image. The module also provides a number of factory functions, including functions to load images from files,
    2 min read
  • Python | ImageOps.autocontrast()method
    PIL is the Python Imaging Library which provides the python interpreter with image editing capabilities. the ImageOps module contains a number of ‘ready-made’ image processing operations. This module is somewhat experimental, and most operators only work on L and RGB images. ImageOps.autocontrast()
    1 min read
  • Python PIL | getbands() and getextrema() method
    Python PIL library contains Image module in which variety of functions are defined. PIL.Image.Image.getbands() This method is used to get the mode (bands) present in an image. Syntax: PIL.Image.Image.getbands(image_object [valid image path])Parameters: It takes a parameter image_object i.e it the re
    2 min read
  • Python PIL | ImageMath.eval() Method
    PIL is the Python Imaging Library which provides the python interpreter with image editing capabilities .The module also provides a number of factory functions, including functions to load images from files, and to create new images. The ImageMath module can be used to evaluate “image expressions”.
    2 min read
  • Python PIL | Image.draft() method
    PIL is the Python Imaging Library which provides the python interpreter with image editing capabilities. The Image module provides a class with the same name which is used to represent a PIL image. The module also provides a number of factory functions, including functions to load images from files,
    2 min read
  • Python PIL | ImageColor.getcolor() Method
    PIL is the Python Imaging Library which provides the python interpreter with image editing capabilities. The ImageColor module contains color tables and converters from CSS3-style color specifiers to RGB tuples. This module is used by PIL.Image.Image.new() and the ImageDraw module, among others.Imag
    1 min read
  • Python Pillow - Colors on an Image
    In this article, we will learn Colors on an Image using the Pillow module in Python. Let's discuss some concepts: A crucial class within the Python Imaging Library is the Image class. It's defined within the Image module and provides a PIL image on which manipulation operations are often administere
    4 min read
  • Python PIL | ImageChops.darker() method
    PIL is the Python Imaging Library which provides the python interpreter with image editing capabilities. ImageChops.darker() method is used to compare two images pixel by pixel, and returns a new image containing the darker values. Syntax: ImageChops.darker(image1, image2) Parameters: image1: It is
    1 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences