Jump to content

Super Sampling?


Go to solution Solved by Rick Brewster,

Recommended Posts

Is there any chance of Super Sampling coming back?

 

It's removed in 5.0 because Adaptive is supposedly better quality.

 

Unfortunately, Adaptive creates a lot of artifacts near the edge of a transparent image when resizing, pixels that look transparent, but are just slightly off 100% transparent.

 

This makes it much harder to work with magic wands from there on, as it doesn't select the almost but not quite transparent pixels when using 0% toleracy.

 

It also causes problems when importing these images into programs that rely on 100% transparency. For example, if importing an image that has been enlarged in Adaptive mode into Tabletop Simulator, you'll get selection outlines around the almost but not quite transparent pixels, because they aren't exactly transparent.

 

Super Sampling was by far the best Algorhythm for the edges of images with transparent backgrounds. I often used other methods to increase the image size, but then used Super Sampling to increase the older image by the same size, and applied its alpha mask because the edges were superior.

 

I still have an older version running on an older PC, and I currently see myself forced to do any resizing on the older PC, because none of the current options come close to how Super Sampling did it.

 

See the example below. The left image is the original image. The right image has been increased to 200% using Adaptive. Then I used the magic wand at 0% tolerancy. The outline of the left image is smooth, while the outline of the right image has these almost transparent artifacts around it.

 

adaptive-example.png

  • Upvote 2
Link to comment
Share on other sites

46 minutes ago, Thels said:

I still have an older version running on an older PC, and I currently see myself forced to do any resizing on the older PC, because none of the current options come close to how Super Sampling did it.


For reference, could you post a copy of your original image and the 200% resized image, as you did above, but using the older version of paint.net and Super Sampling please.

Link to comment
Share on other sites

Super Sampling won't be coming back; I actually found some pretty nasty bugs in it that I was unable to find solutions for. The code was written a long time ago, had a lot of crazy optimizations in it, and it was simply unsalvageable.

 

However, Super Sampling was only ever active when reducing the size of an image. When enlarging, bicubic was used (when SS was selected). So what you were seeing was not super sampling anyway.

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

@Thels On the left is the nearest I could find to your bowling ball on a transparent background.

On the right is the same image resized by 200% with Bicubic resampling and then the transparent area selected using the Magic Wand with 50% tolerance.

image.thumb.png.79faad62862bab1d99e294f747363a5f.png

It looks OK to me.

You get a similar result if you use Adaptive resampling.

 

  

7 hours ago, Thels said:

Adaptive creates a lot of artifacts near the edge of a transparent image when resizing, pixels that look transparent, but are just slightly off 100% transparent.
 

This makes it much harder to work with magic wands from there on, as it doesn't select the almost but not quite transparent pixels when using 0% toleracy.


If you really want to use 0% tolerance Magic Wand selection in the remainder of your editing, then clean up the near transparent fuzz around the resized ball by Magic Wand selecting with 50% tolerance (or whatever % works for you) then pressing Delete. Now you will have fully transparent pixels right up to the edge of the ball.


 

 

Edited by Tactilis
Link to comment
Share on other sites

Posted (edited)
On 3/29/2023 at 5:39 PM, Rick Brewster said:

However, Super Sampling was only ever active when reducing the size of an image. When enlarging, bicubic was used (when SS was selected). So what you were seeing was not super sampling anyway.

Are you sure on that? I went onto the PC with the old Paint.net and compared. The edges of Super Sampling are definitely different from the edges of Bicubic. If you look at the attachment, the Super Sampling image is 264x264, whereas the Bicubic image is 262x262. Zooming in, the edges definitely look different.

 

Also, the result of Bicubic changed. On the old Paint.net, I don't get any artifacts around the edges. On the new Paint.net, I do get artifacts. Not nearly as much as Adaptive, but they're there. Lanczos also has heavy artifacting going on (it looks similar to Adaptive). Only Bilinear, Fant and Nearest Neighbor do not. Bilinear is the one that resembles the old Super Sampling results for edges the closest, but it doesn't come as close in quality.

Compare-Resizes.png

It's a shame if Super Sampling goes the way of the Dodo. It had by far the best quality for the edges of transparent images. I tended to use AI upscaling tools to increase image sizes, but they were generally rather poor with the edges of transparent images, so I used Super Sampling for the Alpha.

 

Is there any chance another option will become available that focuses on the quality of the edges of transparent images, like Super Sampling did?

 

Here's a version with the 100% transparent areas converted to pink, so you can easily see the artifacts without first downloading and opening the image:Compare-Resizes-Pink.png

 

On 3/29/2023 at 6:24 PM, Tactilis said:

If you really want to use 0% tolerance Magic Wand selection in the remainder of your editing, then clean up the near transparent fuzz around the resized ball by Magic Wand selecting with 50% tolerance (or whatever % works for you) then pressing Delete. Now you will have fully transparent pixels right up to the edge of the ball.

I should not be needing to remove semi-transparent parts of the image to deal with the artificing. Especially not when it used to be not needed at all.

Edited by Thels
Link to comment
Share on other sites

20 minutes ago, Thels said:

Are you sure on that?

100% yes. Although, looking at the old code, it looks like a different implementation of bicubic was used, so I guess that's not as accurate as I thought. "Bicubic" would use WIC's Bicubic, whereas Super Sampling when enlarging would use my own implementation of Bicubic. Not sure why that is. The new "Bicubic"  in 5.0 is using @saucecontrol's MagicScaler library (also for Bilinear (not the low quality version), Bicubic, Adaptive, and Lanczos).

 

This might just be a bug in MagicScaler ... cc @saucecontrol ? It looks like the alpha channel is not correct here. We're getting alpha values that go e.g. 0, 0, 1, 2, 0, 0, 17 (when Color Picker-ing left-to-right) instead of a monotonic ramp from 0 to larger values.

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

BTW some simpler repro steps:

 

1. Create a 128x128 pixel image, then draw an antialiased filled circle. Here's the image I'm using:

image.png

 

2. Go to Image -> Resize, select "Adaptive (Best Quality)", then "By percentage: 200%"

image.png

3. Switch to the Magic Wand tool, set Tolerance to 0%, and the Flood Mode to Global

image.png

4. Click in the transparent region

 

5. You'll see a selection that has an "inner moat" of transparent pixels. So the image goes from transparent, to non-transparent, back to transparent (this is the bad part), and then properly to non-transparent:

image.png

 

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

  • Solution

Okay from talking with @saucecontrol, he was able to clear up some of the details.

 

1. Adaptive "Best Quality" should probably not have "Best Quality" in the name. This does have a sharpening effect, by design. Same goes for Bicubic and Lanczos.

 

2. Bilinear will produce good results without the "transparent moat" (which is a ringing artifact from the sharpening).

 

3. The old "Super Sampling" mode, for enlarging, which was actually using my own implementation of bicubic for enlarging (I'll call it "PdnBicubic"), can be reproduced using Magic Scaler. There are a few per-pixel discrepancies but they are just a +/- 1 in the RGB values due to differences in precision or rounding (MagicScaler is probably producing the more ideal result).

 

So I think what I'm going to do, for the next update (5.0.4) is this:

 

1. Rename "Adaptive (Best Quality)" to "Adaptive". @saucecontrol apparently objected to the "Best Quality" label but I missed it or forgot

 

2. Rename "Bicubic" to "Bicubic (Sharp)"

 

3. Add "Bicubic (Smooth)" which will almost identical to the old "Super Sampling" when enlarging.

 

This means you would just use "Bicubic (Smooth)" to get what you need/want in this case. I could probably put up a test build shortly, this isn't difficult from a coding standpoint.

  • Like 2
  • Upvote 4

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 month later...

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...