Mobile app version of vmapp.org
Login or Join
Cofer715

: Cut a freeform shape and create border in Gimp? I've got an image of several irregular shapes on white background. (.=white) ...................... ...................... .....11.....22222..... ....111.......22222...

@Cofer715

Posted in: #Borders #Gimp

I've got an image of several irregular shapes on white background.

(.=white)
......................
......................
.....11.....22222.....
....111.......22222...
...111................
.....1................
......................


I want to create several other files, each containing one shape from the original image, placed on the transparent background.

(.=transparent)
......
...11.
..111.
.111..
...1..
......


So far the solution is easy: use Free Select Tool on each shape, Copy, create a new file, in Advanced Options select "Fill with Transparency", Paste, Image -> Autocrop Image.

Here's where my complications arises. These output shapes will be placed on another picture, quite colorful, and if these files are created like this, they are visible very poorly due to colors meshing. I'd like to create a border around each shape that is exact shape of my freeform selection. How can I do that?

A simple answer - use a paintbrush and trace the line again - isn't satisfying because my hand won't repeat exact same shapes, so the border will be jaggy.

A border tool isn't adequate because it creates a simple-minded rectangular border, while I want a free-form shape one. Various Edge-Detect filters seem to make out the shapes, but then they mangle the colors on them.

Thanks for your help!

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Cofer715

1 Comments

Sorted by latest first Latest Oldest Best

 

@Sent7350415

To get a clean transparent background:


Layer>Transparency>Add alpha channel (if there is not one already)
Select the background with the fuzzy selector and a low threshold. Increase the threshold just to include background irregularities such as JPEG artefacts.
Select>Grow by two pixels.
Color>Color to Alpha and remove the white. You should end up with your shapes cleanly cut out.


Then do a rectangular selection around the shapes and copy/paste each to new files (typically, Edit>Copy and File>Create from clipboard or Edit>Paste as new image).

To add an outline, in each shape image obtained:


Layer>Transparency>Alpha to selection (this create a selection from the shape)
Select>To path (makes a path from the selection)
Select>None (important!)


Then:


If you want the outline to straddle the edge of the shape, use Edit>Stroke path in "line" mode
If you want the outline completely inside the shape:


Set the alpha-lock on the layer
Edit>Stroke path and give a width double of what you want



If you want to add the very same outline to all shapes, once the background has been removed you can use the procedure above one the initial image to add the outline to all the shapes in one go.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme