PIL image.filter -> boundaries

pieter.cogghe at gmail.com pieter.cogghe at gmail.com
Thu Nov 29 11:10:26 EST 2007


Hi,

I'm filtering an image with a custom kernel. It works fine, except for
the boundaries. image.filter() seems to add a 1px zero-border to the
image to process the pixels at the boundaries of the image.I'd rather
have it replicate the values of the boundary pixels. Is this an option
and where can I set it?

thanks,

Pieter

ps, the code:

img = Image.open('cell.tif')
kernelX =
ImageFilter.Kernel(size=(3,3),kernel=[1,0,-1,2,0,-2,1,0,-1],scale=8)
gradientX = im.filter(kernelX)



More information about the Python-list mailing list