Jump to content

Recommended Posts

Posted

Hi,

I often need to inpaint certaint areas from an image.

i created a test with ideal conditions. Using a fresh photo I add a black symbol, 100% black, sharpest possible edges with unavoidable blurriness of 1px at edge.

now the process to select the symbol, grow it by 2-4px, and you start to notice a first hurdle:

  1. any  pixel based selection tools like brush or AI selection create unnecessary blurry edges
  2. if you boost contrast on alpha you see that semitransparency reaches wide into the selection. Colors of semitransparent areas are mostly too dark, even in case you add a white backfill layer.
  3. when you try to directly inpaint the area, you get very bad results with black patches.
  4. my usual workflow is trying to 
    1. Grow the selection
    2. delete any semitransparent areas
    3. grow again
    4. Inpaint
  5. unfortunately Affinity bytes back and creates semitransparent inpaint.

it takes much to much effort to get usable results with inpainting. You need to manually erase any content to avoid color spill coming through, and need to achieve binary alpha values (no semitransparency) to avoid getting semitransparent results.

this issue affects all platforms.

in case Affinity things no bug, please explain the workflow to reliably inpaint objects wich are easy to spot due to high contrast.

all gets worse when you try to inpaint the right bracket which needs more careful approach for the blossom area.

my solution is using the patch tool instead and only use inpaint to improve the edge area as final touch.

1 starting point

IMG_2595.thumb.png.e95f344d64f8beb2f11b5212b7375293.png

2 AI selection looks good at first sightIMG_2596.thumb.png.38486351cdeb4fe7fc69781cf82dfe97.png

3 second look shows soft blurry edges and unexpected superfluous semitransparency

IMG_2597.thumb.png.7ced1c46692070b89abd368cdde78f1e.png

4 detail of semitranscy outsideIMG_2598.thumb.png.8f615aafa5a6f2e25b377082a936dd7a.png

5 a curves adjustment shows by boosted transparency how far the transpancy issue goes IMG_2599.thumb.png.5e22f78ceaed626031168592b051348b.png

6 inpainting in this state produces garbage, too much transparency 

IMG_2600.thumb.png.76477ebb9d5620374809e681995ed4f3.png

7 growing selection trying to cut into fully opaque areas

IMG_2601.thumb.png.1c517b756594ed318f8fa6137a52c5c2.png

8 I manually erased inside the selection to remove any semitransparency with limited success

IMG_2602.thumb.png.f78083ab7b01e9957c490f4c8b91f26f.png

9 agai bad result of inpaint

IMG_2603.thumb.png.d9410edec81633f61e92a4ab368ca2a7.png

10

IMG_2604.thumb.png.7f6f9754f4d87826ff2681475f4c258e.png

10 slightly better, edge area still bad.

IMG_2605.thumb.png.2f66594e6fa298a8052af7d354a85c31.png

Mac mini M1 A2348 | MBP M3 

Windows 11 - AMD Ryzen 9 5900x - 32 GB RAM - Nvidia GTX 1080

LG34WK950U-W, calibrated to DCI-P3 with LG Calibration Studio / Spider 5 | Dell 27“ 4K

iPad Air Gen 5 (2022) A2589

Special interest into procedural texture filter, edit alpha channel, RGB/16 and RGB/32 color formats, stacking, finding root causes for misbehaving files, finding creative solutions for unsolvable tasks, finding bugs in Apps.

I use iPad screenshots and videos even in the Desktop section of the forum when I expect no relevant difference.

 

Posted

File saved with history 

inpaint issues semitransp.afphoto

Mac mini M1 A2348 | MBP M3 

Windows 11 - AMD Ryzen 9 5900x - 32 GB RAM - Nvidia GTX 1080

LG34WK950U-W, calibrated to DCI-P3 with LG Calibration Studio / Spider 5 | Dell 27“ 4K

iPad Air Gen 5 (2022) A2589

Special interest into procedural texture filter, edit alpha channel, RGB/16 and RGB/32 color formats, stacking, finding root causes for misbehaving files, finding creative solutions for unsolvable tasks, finding bugs in Apps.

I use iPad screenshots and videos even in the Desktop section of the forum when I expect no relevant difference.

 

Posted

Side note : as always since years, during the shown process Photo stops working after editing a few minutes. 
the merged pixel layer thumbnail did not render and stays empty, and in-canvas rendering was wrong.

i need to go to Home Screen and open again the files.

this eliminates all UI choices for fill tool.

so again

  1. open filters
  2. Choose „color“ category
  3. scroll to fill
  4. choose fill
  5. change mode to inpaint
  6. wait 10 seconds to get a preview

this happens dozens of times every day, with any possible edits.

Mac mini M1 A2348 | MBP M3 

Windows 11 - AMD Ryzen 9 5900x - 32 GB RAM - Nvidia GTX 1080

LG34WK950U-W, calibrated to DCI-P3 with LG Calibration Studio / Spider 5 | Dell 27“ 4K

iPad Air Gen 5 (2022) A2589

Special interest into procedural texture filter, edit alpha channel, RGB/16 and RGB/32 color formats, stacking, finding root causes for misbehaving files, finding creative solutions for unsolvable tasks, finding bugs in Apps.

I use iPad screenshots and videos even in the Desktop section of the forum when I expect no relevant difference.

 

Posted

I tried again using flood selection. Same problem of semitransparency.

only if I grow by 8px, the edge seems large enough for inpaint to avoid providing semitransparent results.

in more critical Images, there is no chance to get that large edges all around, and manually adjusting edge width is cumbersome.

the main problem is that all selections tools (no refine used) create unwanted semitransparent edges 30 pixel deep into areas that are 100% black and show stronges possible contrast to outside areas. Why is Affinity unable to take a full black area as one uniform object?

Mac mini M1 A2348 | MBP M3 

Windows 11 - AMD Ryzen 9 5900x - 32 GB RAM - Nvidia GTX 1080

LG34WK950U-W, calibrated to DCI-P3 with LG Calibration Studio / Spider 5 | Dell 27“ 4K

iPad Air Gen 5 (2022) A2589

Special interest into procedural texture filter, edit alpha channel, RGB/16 and RGB/32 color formats, stacking, finding root causes for misbehaving files, finding creative solutions for unsolvable tasks, finding bugs in Apps.

I use iPad screenshots and videos even in the Desktop section of the forum when I expect no relevant difference.

 

  • Staff
Posted

Hi @NotMyFault,

My understanding  is these problems with semi-transparent areas arise as a result of the initial selection method used rather than a Fill/Inpaint problem, more specifically the AntiAliasing/Soft edges parameter creating softer, semi-opaque selections which in turn affect Inpaint. In the case of the ML object select this would be down to a limitation of the model with this image based on what areas it considers part of the object when soft edges is enabled, which may include semi-transparent areas. It is possible to achieve a 'Cleaner' Inpaint using this tool via the following steps:

  1. ML Object select the bracket
  2. Delete
  3. Select menu -> Deselect
  4. Select menu -> Select Transparency Range -> Select Partially Transparent
  5. Filters -> Fill Tool -> Inpaint -> Apply
  6. Deselect

Turning Soft edges off resulted in a poorer initial selection, so this method opts to keep soft edges enabled and to re-select using the 'Select Partially Transparent' option prior to inpaint fill.

I can't say I was finding any semi-transparency issues with the flood select using via below method, the grow/shrink was required to ensure that the black edges were not sampled via the Inpaint algorithm, but it's key that AA is toggled off.

  1. Select the flood fill tool, disable Antialiasing and set the tolerance to a low value (1%), contiguous off
  2. Flood Select the bracket
  3. Select menu -> Grow/Shrink
  4. Increase value to ~8px radius to avoid black edges being sampled by Fill inpaint
  5. Delete
  6. Filters -> Fill Tool -> Inpaint -> Apply
  7. Deselect

I could equally do this with the selection brush provided 'Soft edges' was disabled to prevent it from creating a semi-transparent selection.

Posted

Thank you for your nice and extensive reply. It clears up a little bit  insofar semitransparent edges are incompatible with inpainting. 
 

I can’t follow this conclusion:

29 minutes ago, NathanC said:

My understanding  is these problems with semi-transparent areas arise as a result of the initial selection method used rather than a Fill/Inpaint problem,

Using soft edges is a key functionality and feature of selections, so if any tool is unable to work with semitransparent areas it is a bug or restriction of the tool, not the selection.

The confusion is amplified by the usual tutorials (and you post) who always recommend to use

32 minutes ago, NathanC said:

Select menu -> Select Transparency Range -> Select Partially Transparent

This implicitly says „use semitransparency“. It is illogic to say you can’t create selections with soft edges (equals semitransparent areas), and the recommended to use this command. 
 

in principle you would need add the step after 7: erase selected area to achieve fully transparent areas, then select fully transparent areas.

the next issue is that this works only for otherwise fully opaque layers, otherwise you would need even more steps to intersect (restrict) the selection.

the whole process is painful complex and needs improvement.

Mac mini M1 A2348 | MBP M3 

Windows 11 - AMD Ryzen 9 5900x - 32 GB RAM - Nvidia GTX 1080

LG34WK950U-W, calibrated to DCI-P3 with LG Calibration Studio / Spider 5 | Dell 27“ 4K

iPad Air Gen 5 (2022) A2589

Special interest into procedural texture filter, edit alpha channel, RGB/16 and RGB/32 color formats, stacking, finding root causes for misbehaving files, finding creative solutions for unsolvable tasks, finding bugs in Apps.

I use iPad screenshots and videos even in the Desktop section of the forum when I expect no relevant difference.

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

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.

Loading...
×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.