I hate to effectively "bump" this thread, but what I see here is something I've been looking for for a long time, selection expansion/contraction. You say that you have an "outside selection" option for the outline, but you don't know how to edit the selection to expand. I thought about it this way, I don't know coding so I don't know how to translate this, but here goes. Expanding a selection: If a pixel is adjacent to a selected pixel, it then becomes a selected pixel. Re-iterate this as many times as the user inputs. New expanded selection is made. Similarly, this works for contraction: If a selected pixel is adjacent to a non-selected pixel, it then becomes an unselected pixel. Re-iterate as needed. New contracted selection is made. I would like to take this on myself if nobody wanted to, but I have no idea where to read up on this kind of thing.