Recommended Posts

Hey guys,

is there any way of select areas by shape. I know you can use the magic wand and select the same colour in an image but I want to select the same shape from an image.

An example would be triangles, circles, rectangles, squares, diamonds and the likes. 

All the best,

Frank

Share this post


Link to post
Share on other sites

"Vector graphics are computer graphics images that are defined in terms of 2D points, which are connected by lines and curves to form polygons and other shapes."

 

Raster graphic image processing applications has zero concept of polygon or line. You can't select shapes that way.

Share this post


Link to post
Share on other sites

You could draw a filled shape on a New Layer > Select it with the Magic Wand > Switch to your image > Copy > Paste in New Layer ... and the shape will be on it's own layer

 

shapes.png

 

shapes-2.png

 

BoltBait has a pretty comprehensive list of shapes to compliment the default Paint.net ones

 

 

  • Upvote 1

Share this post


Link to post
Share on other sites
3 hours ago, old banshee said:

Sorry what is vector apps?

Vector apps are image editors that permit the user to create vector images.
Paint.NET is not a vector app! Its images are saved in Raster (Bitmap) formats.

 

Vector vs Bitmap (Raster) Images:
https://youtu.be/fy9Pby0Gzsc

https://youtu.be/XI0rf2r-dx8

The shapes in BoltBait's Package are vector graphics in XMAL format.
After the image is saved, it is converted into a Raster (Bitmap) and is no longer scaleable.

 

Edited by HyReZ

Share this post


Link to post
Share on other sites

welshblue has given you the solution. Ignore the answers referencing vector apps and just follow what welshblue posted:

 

1. Add a new layer to your image.

2. Render the required shape to the new layer. It's easier if you use the "filled shape" option in the toolbar.

3. Select the shape with the magic wand.

4. Activate the image layer and the selection is made.

Share this post


Link to post
Share on other sites

Additionally, selections can be copied (Edit/Copy Selection) then pasted into a text program such as 'notepad' and saved as an '.xml'  '.json' (Edit by Rick: it's actually JSON, not XML) file.
They can then be re-used at a later date by copying the .xml text in notepad then using 'Edit/Paste Selection'. They remain 'vectors' until committed to the canvas - as I understand.

 

@E.E.R. - I couldn't find this in the documentation - but I didn't search for long ;-)

 

@old banshee - well worth reading through the docs though (press F1 while Pdn is open).

Share this post


Link to post
Share on other sites

Ok Here is what I want to do I should have posted this before.

The image shows all the areas with letters in so you can see the shapes that are the same. Take A for instance, if I wanted to select all the A shaped areas one would use the magic wand tool and select all the spaces marked A holding the ctrl key down as one does so. On could then fill all the shapes with a colour and then one would be able to select all the A spaces by colour with the magic wand.

What I was asking was could I select all the A areas by there shape without colouring the spaces or selecting the areas one at a time.

Thanks again for all you responses. 

Frank

 

 

Untitled.jpg

Share this post


Link to post
Share on other sites

@E.E.R - I should have looked harder...who would expect it to be in a logical place!😉

 

@Old Banshee (Frank)
You cannot select directly by shape but you could select all shape-A's, for instance, then save that selection for later use. (See E.E.R's links).
Your method of colouring the selections as objects and saving on another layer my be just as good for one image.

Share this post


Link to post
Share on other sites

I was expecting the problem to be something like that rather than layer-by-layer shape selection. Right now, what @Red ochre is your best route for this issue.

 

Theoretically, someone could write up a plugin that converts shapes based on searching pixels by pixels, and if it found, then that area is colored. I have pictured it in my head, and it seems do-able. It's comparison by pixels through pixels, so doable in principle. If they're of different areas, theoretically object size filtering would solve your problem, or it becomes closer to the solution. @MJW has written a plugin just for this, but it doesn't address colored background. I have written that for G'MIC, but you'd need to reduce the number of color in say that image. Either do some processing to filter out the colors, and then use @MJW plugin or reduce number of colors and use Object Size Filtering under G'MIC QT.

 

I have attempted it, well, I guess then theory doesn't really work out, and manual solution seem to be the fastest.

 

P7va3Tt.png

Edited by Reptillian

Share this post


Link to post
Share on other sites
7 hours ago, old banshee said:

And the reason why222.thumb.jpg.736cd81bf363a154660b16833477a078.jpg I want to do this for those interested is I need to fill shapes with other shapes.

Thanks for all your help, 

Frank

Could you PM me the original shape image uncompressed, I believe I thought of a theoretical solution using coding and I want to code it.

 

For anyone else reading this, I believe two for loops (current pixel, and relative pixel) and comparison should solve this.

Edited by Reptillian

Share this post


Link to post
Share on other sites

Alright, another attempt. Using this test code for code[local] or code[global] filter in g'mic-qt plugin.

repeat $! l[$>] 
to_rgb
rgb2hsv channels 0 tones 2 
k. 
erode 5 
dilate 5 
+area_fg 0,0
f. i>ia?0:i
store. area
+gradient2rgb ,
+f. i>0
compose_channels. +
f. i>0
negate.
inpaint_pde.. .
rm.
rv +blend shapemedian0
blend[^-1] shapeaverage0
blend average
n. 0,255
rgb2hsl sh. 1 f. i>0?1 rm. hsl2rgb
$area
n. 0,360
+f. i0#1>0?1 . a[^0] c hsv2rgb. blend interpolation,.5
endl done

Can't say I have been successful though.

 

VOfI3LZ.png

 

It's a difficult problem. The code use gradient angle and find the angle of each shape. I don't what to do on the area part, but it converts area into hsv format. Then I blended them to filter out the shape. Perhaps, I think I should do more work here. It does look promising I must admit. The next step is to try to do multiple variable to filter out shapes by if else statements.

 

It is possible to do thinning here too. I'll find out what to do.

Edited by Reptillian

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.