null54

Content Aware Fill (2017-04-27)

Recommended Posts

Content aware filling replaces the contents of the selection with pixels that are the closest match in the areas outside the selection.

This allows parts of an image to be removed and blended with the background.

 

This plugin is based on the GIMP Resynthesizer plugin.

Some icons are from or based on those in the Fugue icon set by Yusuke Kamiyamane.

 

btn_donate_SM.gif

 

Compatibility: 3.5.11 and 4.0.x

Menu location: Effects > Selection > Content Aware Fill

 

ContentAwareFill.png?raw=1

 

Download:

 

ContentAwareFill.zip

 

Source Code:

 

https://github.com/0xC0000054/pdn-content-aware-fill

  • Like 5
  • Upvote 4

Share this post


Link to post
Share on other sites

OMG!  😲 This is AWESOME!! I couldn't believe how good this is.

 

To try it out, I cut a circle out of a reasonably complex scene. The two different replacements were created with different settings. Both are very believable!

 

content_aware_fill_demo.jpg

 

Thanks so much @null54. This definitely goes into my "essentials" toolbox.

Share this post


Link to post
Share on other sites

Excellent Plugin @null54 - Thank you.  I played with it and discovered that if one increases the Tolerance slightly, there will be no 'ring' left behind :star:

Share this post


Link to post
Share on other sites

I just tried this on one of my shapes pictures.  With the proper settings, I  couldn't even tell where I made the selection!

 

Excellent!  Thanks,  @null54   :star:

Share this post


Link to post
Share on other sites

I managed to get an error that crashes PDN. Seems to occur for selections that include pixels along the bottom of the image; I didn't test other sides. It's an index out-of-range error. Details:

Spoiler

File: C:\Program Files\paint.net\Effects\ContentAwareFill.dll
      Name: ContentAwareFill.ContentAwareFillEffect
      Version: 1.0.0.0
      Author: null54
      Copyright: Copyright © 2018 Nicholas Hayes (aka null54)
      Website: https://www.getpaint.net/redirect/plugins.html
      Full error message: PaintDotNet.WorkerThreadException: Worker thread threw an exception ---> System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at ContentAwareFill.Resynthesizer.PrepareNeighbors(Point position)
   at ContentAwareFill.Resynthesizer.Synthesize(Int32 pass, Func`1 abortCallback)
   at ContentAwareFill.Resynthesizer.ContentAwareFill(Func`1 abortCallback)
   at ContentAwareFill.ContentAwareFillEffect.OnSetRenderInfo(EffectConfigToken parameters, RenderArgs dstArgs, RenderArgs srcArgs)
   at PaintDotNet.Effects.BackgroundEffectRenderer.ThreadFunction() in D:\src\pdn\src\PaintDotNet\Effects\BackgroundEffectRenderer.cs:line 227
   --- End of inner exception stack trace ---
   at PaintDotNet.Effects.BackgroundEffectRenderer.DrainExceptions() in D:\src\pdn\src\PaintDotNet\Effects\BackgroundEffectRenderer.cs:line 418
   at PaintDotNet.Menus.EffectMenuBase.DoEffect(Effect effect, EffectConfigToken token, PdnRegion selectedRegion, PdnRegion regionToRender, IRenderer`1 clipMaskRenderer, Surface originalSurface, Exception& exception) in D:\src\pdn\src\PaintDotNet\Menus\EffectMenuBase.cs:line 1556

 

Edited by Joshua Lamusga

Share this post


Link to post
Share on other sites
2 hours ago, Joshua Lamusga said:

I managed to get an error that crashes PDN. Seems to occur for selections that include pixels along the bottom of the image; I didn't test other sides. It's an index out-of-range error.

 

That crash and the dialog tab order have been fixed in version 1.1.

 

 

  • Upvote 1

Share this post


Link to post
Share on other sites

Interesting. Did you release v1.1 in response, or did you upload it within the last two hours? I suspect if your answer is no, then I was served an older version.

Share this post


Link to post
Share on other sites
12 minutes ago, Joshua Lamusga said:

Did you release v1.1 in response, or did you upload it within the last two hours?

 

It was released in response.

Share this post


Link to post
Share on other sites
40 minutes ago, Zevel said:

Can you move the menu entry from "Photo" to "Selection"?

 

Done.

 

Changed the submenu from "Photo" to "Selection" and updated the PluginSupportInfo to point to the forum thread.

File version updated to 1.2.1.0.

 

 

  • Like 3
  • Upvote 1

Share this post


Link to post
Share on other sites
5 hours ago, Zevel said:

Can you move the menu entry from "Photo" to "Selection"?

 

 

I don't actually think this is a good idea.

 

All plugins work on selections.  But, the plugins in the selection submenu change their behavior based on the shape of the selection.*

 

This plugin doesn't do that.

 

I'd put it back in the photo menu as I think it is really designed for repairing photos.

 

 

 

*For example, outline selection draws an outline in the shape of the selection.

Share this post


Link to post
Share on other sites

I think either Photo or Selection makes sense. This plugin depends on the selection in a way most plugins don't. In most plugins, the same thing occurs in the selected area as would occur if there were no selections at all. The selection merely restricts the region that's affected. In this plugin, the results are determined by the pixels on the selection boundary.

  • Upvote 1

Share this post


Link to post
Share on other sites

I agree with MJW on this one.  The plugin requires a selection, and I don't see much of a difference between it's positioning and the "feather selection" one.

My vote is for selection.

 

Edited by alexo

Share this post


Link to post
Share on other sites

I originally placed the plugin on the Photo menu because that was the location of BoltBait's Seam Carving plugin, which was the closest existing "content aware" plugin.

The purpose of this plugin is to replace the contents of a selection based on the pixels outside the selection.

Which as @Ego Eram Reputo's example above illustrates is useful for more than just photographs.

 

13 hours ago, BoltBait said:

All plugins work on selections. 

 

But as @MJW has noted most plugins do not require a selection to operate, and there are not many other categories to make that requirement clear to users.

Share this post


Link to post
Share on other sites
19 minutes ago, null54 said:

@Ego Eram Reputo@MJWI originally placed the plugin on the Photo menu because that was the location of BoltBait's Seam Carving plugin, which was the closest existing "content aware" plugin.

Which ironically does not work with selections.

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now