Skip to content

Instantly share code, notes, and snippets.

@naveen17797
Created February 9, 2020 01:57
Show Gist options
  • Save naveen17797/fc807ae9291a03e769e816817ce3835f to your computer and use it in GitHub Desktop.
Save naveen17797/fc807ae9291a03e769e816817ce3835f to your computer and use it in GitHub Desktop.
from PIL import Image
from PIL import ImageFilter
import numpy as np
img = Image.open('65.png').convert('RGBA')
CROP_LOCATIONS = {
# L, T, R, B
"FIRST_QUADRANT": (0,0,360,360),
"SECOND_QUADRANT": (360,0,720,360),
"THIRD_QUADRANT": (0,360,360,720),
"FOURTH_QUADRANT": (360,360,720,720)
}
print( CROP_LOCATIONS )
img = img.crop(CROP_LOCATIONS["FOURTH_QUADRANT"])
#print(img.getpixel((0,1)))
#data = np.asarray(img)
#search_val = True
# print( len( np.where(data == search_val)[0].tolist() ) )
img.save('greyscale.png')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment