
into this:

Why? Well, my wife wanted to paste smiley faces onto some triangles, rectangles and other shapes. The set with the outline is great, but she wanted to put faces onto triangles, rectangle's and some other shapes too. (She's a teacher, the shapes were warring, harmnony day is approachng and, and ..... it's complicated, trust me). Anyway, the borders looked a little odd.
As there were 60 of them to do (15 expressions in 4 different colours), I started thinking I'd figure out how to do some python scripting from inside GIMP, but after half an hour of futzing about, I decided that was too messy, and just decided to process the images directly. This is pretty easy actually. One of python's included batteries is the "Image" library.
I decided to tackle it thusly; modify any pixels within a specified annulus to transparent. I originally intended to check that the pixel was black before modifying it, but I forgot, and in this case, it worked just fine anyway.
Here's the code I used:
# RemoveAnnulus_01.py# Removes a dark circle from smiley faces# Replaces black pixels in a specified annulus with transparency# Doesn't do anti-aliasingimport osimport sysimport Imageimport math# Parameters to modify pixels in an annulusxMid=53 # Centre positionyMid=53 # (origin)rInner=45.0 # Inner radiusrOuter=54.0 # Outer radiusxMax=106 # (Image size)-1yMax=106inputFile=sys.argv[1] # Input image fileoutputFile=sys.argv[2] # Output file, will be overwritten if it existsthisImage = Image.open(inputFile)pixelArray=thisImage.load() # Use load method for pixel addresing modetry:reportMessage="OK"for thisX in range(0,xMax):for thisY in range(0,yMax):dX=float(xMid-thisX)dY=float(yMid-thisY)thisRad = math.sqrt((dX*dX + dY*dY))if ( (thisRad>rInner ) and (thisRadpixelArray[thisX,thisY]=(0,0,0,0)except IOError:reportMessage="Failed"thisImage.save(outputFile, "PNG")print "%s:Processing [%s] to [%s]" % ( reportMessage,inputFile,outputFile )
I've not shown the script for iterating through the 60 different files, but that's not really the point of this post. This code works with two command line arguments, the input file, and the destination file.
BTW, none of this is meant as a slight on the GIMP's scripting capabilities, I just have little experience with them, and decided to go with something more familiar.