Skip to content

Instantly share code, notes, and snippets.

@alamsal
Created May 20, 2015 15:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alamsal/eefc08e5b9bc7c6a853a to your computer and use it in GitHub Desktop.
Save alamsal/eefc08e5b9bc7c6a853a to your computer and use it in GitHub Desktop.
Tiler tools boundary clean up / An alternate to PIL Mogrify
import sys
from PIL import Image
imageFullPath = sys.argv[1]
rasterImage = Image.open(imageFullPath)
width,height = rasterImage.size
rasterImage = rasterImage.convert('RGBA')
pix = rasterImage.load()
for i in range(0, width):
for j in range(0, height):
if(pix[i,j][0] == 0):
pix[i,j] = (255,255,255,0)
rasterImage.save(imageFullPath,'PNG')
# run BoundaryCleanup.py fileName
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment