Skip to content

Instantly share code, notes, and snippets.

@maifeeulasad
Created April 8, 2019 04:00
Show Gist options
  • Save maifeeulasad/94708b1676e524fbc533be6a83df58b4 to your computer and use it in GitHub Desktop.
Save maifeeulasad/94708b1676e524fbc533be6a83df58b4 to your computer and use it in GitHub Desktop.
#!/usr/local/bin/python3
from PIL import Image
# Open Paddington
img = Image.open("input_file_name.jpg")
#increase for high resulation
si=16
# Resize smoothly down to 16x16 pixels
imgSmall = img.resize((si,si),resample=Image.BILINEAR)
# Scale back up using NEAREST to original size
result = imgSmall.resize(img.size,Image.NEAREST)
# Save
result.save('output_file_name.jpg')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment