Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

convert rgb image to binary in pillow

from PIL import Image 
image_file = Image.open("cat-tied-icon.png") # open colour image
image_file = image_file.convert('1') # convert image to black and white
image_file.save('/tmp/result.png')
Comment

convert rgb image to binary in pillow

from PIL import Image

col = Image.open("cat-tied-icon.png")
gray = col.convert('1')
bw.save("result_bw.png")
Comment

PREVIOUS NEXT
Code Example
Python :: pandas from range of columns 
Python :: sqlite query using string as parameter in python 
Python :: inheritance in python 3 example 
Python :: adding new key in python 
Python :: remove emoji 
Python :: python test module 
Python :: use a library in python 
Python :: create tuples in pandas 
Python :: python reverse a list 
Python :: turn string into operator python 
Python :: django model functions 
Python :: adding numbers in python 
Python :: how to write user input to a file in python 
Python :: pyqt matplotlib 
Python :: pandas filter rows by column value regex 
Python :: difference between this and super 
Python :: doctest python 
Python :: qr code scanner using opencv 
Python :: neat way to print 2d array 
Python :: Python Switch case statement by Dictionary Mapping 
Python :: armstrong number in python 
Python :: tensorflow Dense layer activatity leaklyrelu 
Python :: numpy.where 
Python :: how to add pagination in discord.py 
Python :: how to round whole numbers in python 
Python :: python power of natural number 
Python :: python re.split() 
Python :: python strip function 
Python :: |safe django 
Python :: how to schedule python script in windows 
ADD CONTENT
Topic
Content
Source link
Name
8+4 =