Jump to content

Feature request: save and load selection path


ChrisBe

Recommended Posts

Hello

 

There is one feature I miss in this nice program: the ability to save and load selection paths.

I mean I want to be able to save the "outline" of the selection, not the pixels themselves.
That is very useful when working on similar pictures.

 

I know there are some workarounds, but:

  1. They are not very simple.
  2. The reconstituted selection has no smoothed edges.
    That make it almost useless.

Found workarounds: https://forums.getpaint.net/index.php?/topic/18043-save-selection-how/
https://www.youtube.com/watch?v=aA86AeyzeIk

 

By the way, in these workarounds, it seems the pixels are not smoothed because of an incapacity of the magic wand.
 

I believe this feature should be integrated in the application, not in a plugin, as it is a very basic feature.

 

Thank you

 

Link to comment
Share on other sites

Hi @ChrisBe

Welcome to the forum.

 

Lets see if I can clarify your situation.

 

Any >selection path> would have to be saved as a separate .png file to maintain the transparency you are looking for.

To think the outline can maintain smoothed edges is impossible. How else could it make an outline unless it finds a blank cell.

The way I would do it is import the saved png to the new image, size if required then invert selection to get the same identical outline.

You are assuming the image is identical for the save path to work as well. That rarely happens.

Post some examples if you would like more help. Some other members might have other ideas as well. B)

PaintNetSignature.png.6bca4e07f5d738b2436f83d0ce1b876f.png

Link to comment
Share on other sites

Plugins and workarounds can't preserve the full fidelity of the selection, especially since the Magic Wand can only produce pixelated selections.

 

I've filed a bug to track this feature. It could be done pretty easily. It's just a matter of fitting it in with other priorities.

 

 

  • Upvote 3

The Paint.NET Blog: https://blog.getpaint.net/

Donations are always appreciated! https://www.getpaint.net/donate.html

forumSig_bmwE60.jpg

Link to comment
Share on other sites

@Rick Brewster:
It would be nice the Magic Wand has smoothed edges, even for the general use.
By the way, we can stock selections in layers as well.

 

@AndrewDavid:
For information, the workaround I follow is this one:

 

Save selection procedure:
. Create a new layer.
. draw the needed selection.
. fill the selection as black, using the Can of Paint.
. Select all (Control+A).
. Copy (Control+C).
. Paste as a new image (Control+Alt+V).
    -> please note the edges are smoothed.
. Save the new image, as any format (transparency is useless).

 

Re-recreate the selection:
. open the original image.
. import a file as a layer, using the selection image.
. uncheck the base layer (the pixels of the original image).
. be sure to select the selection layer.
. Use the Magic Wand, in global mode, to select the black pixels (they follow the original selection edges).
    -> please note the new selection's edge is "pixelized" (not smoothed).
. check the base layer (the pixels of the original image).
. uncheck the selection layer.
    -> now we have an ordinary selection on our image.
. the selection layer can be deleted if not needed any more.

 

Link to comment
Share on other sites

Rick, that will be very useful.

 

Chris,

You have almost nailed it. Here's a slightly different procedure that will give you much smoother edges:

1. Like you do now, fill the selection with black on a new layer and copy the layer to the clipboard. 

2. Use the Alpha Mask plugin on a new image. Make sure the "Paste from clipboard" option is selected.

Xkds4Lh.png

Link to comment
Share on other sites

It would be nice the Magic Wand has smoothed edges, even for the general use.

 

I tried to do this, I really did :) But it was way too complicated, performance was atrocious, and the results just weren't good. Paint Bucket and Magic Wand are based on the same code, and the Paint Bucket does support feathering (although it uses the antialiasing button in the toolbar). So, why doesn't Magic Wand support non-pixelated selections?

 

It's easy to go from a geometric representation to a rasterized one. For instance, if geometric data within a pixel happens to fill up 60% of its area then you can convert that into an alpha value of 60% (which is 255*0.6 = 153). Going in the opposite direction, however, is very ambiguous. Reconstructing a good looking geometry from pixel data doesn't give you an unambiguous idea as to how the geometry should be shaped. Should it be a square? A triangle? Some kind of ziggy zaggy thing? It ends up being a major guessing game based on the shape of the other surrounding geometry. You can probably just force it to follow the contours of the pixelated geometry that it's probably next to, at which point you also have to worry about combining it with the contour of another nearby pixelated geometry that happens to be <=1px away. And that is REALLY expensive; geometry union operations are slow and we're talking about the Magic Wand which produces phenomenally intricate selections.

 

So, tl;dr, getting this to look good and perform well just didn't work out when I was stabbing away at this problem in 2013. So I had to cut it.

 

That's not to say it's impossible. Ultimately I just didn't have the stamina for it -- I was already pretty exhausted by all the other work going into 4.0 (it was a 5 year project).

  • Upvote 1

The Paint.NET Blog: https://blog.getpaint.net/

Donations are always appreciated! https://www.getpaint.net/donate.html

forumSig_bmwE60.jpg

Link to comment
Share on other sites

@Rick Brewster

Maybe a (leveled) transparent selection would be nice enough.

Let's imagine a 5x1 B&W picture that is a line of these pixels:
100 120 140 160 180 200 220
We apply the Magic Wand with a tolerence of 60 on the middle pixel (brighness 160).
Then we obtain a selection "bitmap" with this transparency:
0 33 66 100 66 33 0

This way, the edges are smoothed in some way, although the selection is pixel-aligned.


@Djisves
Thank you for your suggestion, I will try it.

 

Link to comment
Share on other sites

Selections are based on geometry, not pixels. That would not be simple to achieve, it would actually be a complete rewrite of how selections operate in Paint.NET.

The Paint.NET Blog: https://blog.getpaint.net/

Donations are always appreciated! https://www.getpaint.net/donate.html

forumSig_bmwE60.jpg

Link to comment
Share on other sites

  • 2 weeks later...
On 13/07/2017 at 7:09 PM, Rick Brewster said:

Selections are based on geometry, not pixels. That would not be simple to achieve, it would actually be a complete rewrite of how selections operate in Paint.NET.

 

I understand.

Then I return to my first suggestion: the ability to save and load selections (to a file as a specific format, not as a picture file).

 

Maybe it could be achieved easily by serializing the geometry instance.

I mean using the BinaryFormatter (personally I wrote a more versatile serializer for my needs).
Or maybe to a standard Xaml file (I noted Inkscape can export to this format), but I suspect it would require more work.

Link to comment
Share on other sites

No need to worry about the technical aspect of the implementation (the "how", in other words). I've already got that figured out. JSON should work great here.

The Paint.NET Blog: https://blog.getpaint.net/

Donations are always appreciated! https://www.getpaint.net/donate.html

forumSig_bmwE60.jpg

Link to comment
Share on other sites

1 hour ago, Rick Brewster said:

No need to worry about the technical aspect of the implementation (the "how", in other words). I've already got that figured out. JSON should work great here.

 

Great news !

Thank you.

Link to comment
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.

×
×
  • Create New...