Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

circular cropping of image in python

import numpy as np
from PIL import Image, ImageDraw
  
img=Image.open("img.jpg")
display(img)
  
height,width = img.size
lum_img = Image.new('L', [height,width] , 0)
  
draw = ImageDraw.Draw(lum_img)
draw.pieslice([(0,0), (height,width)], 0, 360, 
              fill = 255, outline = "white")
img_arr =np.array(img)
lum_img_arr =np.array(lum_img)
display(Image.fromarray(lum_img_arr))
final_img_arr = np.dstack((img_arr,lum_img_arr))
display(Image.fromarray(final_img_arr))
Comment

PREVIOUS NEXT
Code Example
Python :: python jinja2 from string 
Python :: print output 
Python :: python install progressbar 
Python :: tic-tac toe in pygame 
Python :: pyttsx3 
Python :: stack more system in python 
Python :: pandas cummin 
Python :: Get more than one longest word in a list python 
Python :: code for test and train split 
Python :: python request add header 
Python :: link_to class 
Python :: get data from kaggle to colab 
Python :: random integer 
Python :: scatter density plot seaborn 
Python :: remove columns that contain string pandas 
Python :: cholesky decomposition in python 
Python :: plynomial regression implementation python 
Python :: sphinx autodoc extension 
Python :: Python Requests Library Delete Method 
Python :: python how to import a module given a stringg 
Python :: max value pandas 
Python :: python with 
Python :: Max fonction code in python 
Python :: how to add a list in python 
Python :: python serve html 
Python :: dict_keys to list 
Python :: deleting an object in python 
Python :: find if value exists in dictionary python 
Python :: how to invert a true false array in python 
Python :: text to image python 
ADD CONTENT
Topic
Content
Source link
Name
4+6 =