Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python image black and white

from PIL import Image
img = Image.open("image.jpg")
img.convert("1").save("result.jpg")
Comment

convert image to black and white python

#applying thresholding technique to return black and white image (threshold = 127 = 255/2)
import cv2
  
originalImage = cv2.imread('image.jpg')
grayImage = cv2.cvtColor(originalImage, cv2.COLOR_BGR2GRAY)
  
(thresh, blackAndWhiteImage) = cv2.threshold(grayImage, 127, 255, cv2.THRESH_BINARY)
 
cv2.imshow('Black white image', blackAndWhiteImage)
cv2.imshow('Original image',originalImage)
cv2.imshow('Gray image', grayImage)
Comment

PREVIOUS NEXT
Code Example
Python :: order dataframe by multiple columns python 
Python :: numpy add axis 
Python :: how to check for duplicates in a column in python 
Python :: pickle load 
Python :: Python Split list into chunks using List Comprehension 
Python :: pandas normalize df 
Python :: pandas combine two data frames with same index and same columns 
Python :: confusion matrix heat map 
Python :: pandas query variable count 
Python :: print nested list in new lines in python 
Python :: python code to wait 
Python :: pandas query like 
Python :: filter an importrange 
Python :: virtual env 
Python :: python import specific excel sheet 
Python :: python endswith list 
Python :: gow to find a letter in a word in python 
Python :: streamlit dropdown 
Python :: combinations python 
Python :: numpy stdev 
Python :: calcolatrice 
Python :: pandas drop columns by index 
Python :: QTableWidget as a button pyqt 
Python :: python project ideas 
Python :: python how to sort by date 
Python :: how to move columns in a dataframen in python 
Python :: tkinter draw squaer 
Python :: python regex remove digits from string 
Python :: keras read image 
Python :: pyqt latex 
ADD CONTENT
Topic
Content
Source link
Name
3+6 =