Jump to content

Recommended Posts

I have a problem with Affinity Photo. I straightened the horizon line of an image. This of cause resulted in some white edges.I have watched a Tutorial of a guy on YouTube who used the Free Hand Selection Tool to mark (roughly) the area around the white spot, then he selected Edit -> Fill -> Impainting -> Apply and the white area was gone. I tried the same, but no effect. Can anybody tell me what is going wrong?

Bildschirmfoto 2017-08-27 um 12.34.04.png

Bildschirmfoto 2017-08-27 um 12.34.20.png

Bildschirmfoto 2017-08-27 um 12.34.51.png

Bildschirmfoto 2017-08-27 um 12.35.06.png

Share this post


Link to post
Share on other sites

Don't ask me why because I don't know, but I find that rasterizing the layer (by right clicking on it in the Layers panel & choosing that option from the popup menu) makes this work much better, although the results vary considerably depending on how much of the non-transparent area is included in the selection & if it is similar enough to the transparent part to be filled in to look convincing.


Affinity Photo 1.7.2, Affinity Designer 1.7.2, Affinity Publisher 1.7.2; macOS High Sierra 10.13.6 iMac (27-inch, Late 2012); 2.9GHz i5 CPU; NVIDIA GeForce GTX 660M; 8GB RAM
Affinity Photo 1.7.2.153 & Affinity Designer 1.7.2.6 for iPad; 6th Generation iPad 32 GB; Apple Pencil; iOS 12.3.1

Share this post


Link to post
Share on other sites

The trou

13 minutes ago, R C-R said:

Don't ask me why because I don't know, but I find that rasterizing the layer (by right clicking on it in the Layers panel & choosing that option from the popup menu) makes this work much better, although the results vary considerably depending on how much of the non-transparent area is included in the selection & if it is similar enough to the transparent part to be filled in to look convincing.

 

The trouble is, you can't set Preserve Alpha, so it is using the bit outside the edges. Transparent in this case

 

I don't know how to set that for a layer.

 

 


Windows PCs. Photo and Designer, latest non-beta versions.

Share this post


Link to post
Share on other sites

You are right though. Rasterising helps a lot.

 

It must be something to do with the way Affinity keeps clipped area outside the canvas. ?


Windows PCs. Photo and Designer, latest non-beta versions.

Share this post


Link to post
Share on other sites

Thanks for your answers. I tried what you had suggested and this worked. However, I do not understand why this works. The image is already a raster image (JPEG) instead of a vector graphic... Odd.

 

One addendum: When you straighten the image in Lightroom and then edit it in Photo to get rid of the edges, the inpainting fill works like a charm. Here the rasterization step is not necessary.

Share this post


Link to post
Share on other sites

Dave shared this tip a couple of weeks ago:

https://forum.affinity.serif.com/index.php?/topic/41825-how-to-fill-in-corners-after-rotating/&do=findComment&comment=227167

Scroll in that string to where you see Dave re-posted with a correction to the steps to take.

BONUS: He even made a macro for the process and posted the link so you can download it.


♥  WIN 10 AD & AP  ♥  Lenovo Legion Y520 15.6" Laptop

Share this post


Link to post
Share on other sites

I had more or less given up using the inpainting method of filling corners of rotated images, it just didn't work very well. But Dave's macro is brilliant - thanks.

Just one small point, I had trouble getting Affinity to load the macro until I noticed the file extension was set to ".afmacros" instead of ".afmacro". Renamed it and all was well.

Share this post


Link to post
Share on other sites
1 hour ago, Jeff Wallis said:

Just one small point, I had trouble getting Affinity to load the macro until I noticed the file extension was set to ".afmacros" instead of ".afmacro". Renamed it and all was well.

 

A *.afmacros file contains a collection of macros (usually more than one!) but a *.afmacro file always contains a single macro. You can only open *.afmacros files via the Library panel, and you can only open *.afmacro files via the Macros panel.

 

 


Alfred online2long.gif
Affinity Designer/Photo/Publisher 1.7.1.404 • Windows 10 Home (4th gen Core i3 CPU)
Affinity Photo for iPad 1.7.1.143 • Designer for iPad 1.7.1.1 • iOS 12.4 (iPad Air 2)

Share this post


Link to post
Share on other sites

Yes, I'd exported within a library container. It would be neat if, when you did an import from the Macro panel, it let you open a library file and then select a macro from within it.


Dave Straker

Cameras: Sony A7R2, RX100V

Computers: Win10: Chillblast Photo with i7-3770 + 16Gb RAM + Philips 40in 4K; Surface Pro 4 i5

Favourite word: Aha. For me and for others.

Share this post


Link to post
Share on other sites
7 minutes ago, dmstraker said:

Yes, I'd exported within a library container. It would be neat if, when you did an import from the Macro panel, it let you open a library file and then select a macro from within it.

 

... I've added a feature request about this:

 


Dave Straker

Cameras: Sony A7R2, RX100V

Computers: Win10: Chillblast Photo with i7-3770 + 16Gb RAM + Philips 40in 4K; Surface Pro 4 i5

Favourite word: Aha. For me and for others.

Share this post


Link to post
Share on other sites
On 8/27/2017 at 6:00 PM, toltec said:

The trouble is, you can't set Preserve Alpha, so it is using the bit outside the edges. Transparent in this case

Setting Preserve Alpha would (I think) exclude all transparent areas from inpainting, which is not what we want.

 

@dmstraker I have a question about your macro. It seems to work fairly well but when I use "Edit Macro" just to see the included steps, this is all I see:

59a52f971e83f_davesmacrosteps.png.5613ba469bf1c1aaae0ac78fe96ed224.png

There is no inpainting step listed so I am curious how the macro does that. I also tried manually duplicating your macro's steps & no inpainting occurs unless I add an Edit menu > Inpaint step before the last (Deselect) step. That produces identical results as using the macro, so is this maybe just some kind of bug in the macro recording or editing process?


Affinity Photo 1.7.2, Affinity Designer 1.7.2, Affinity Publisher 1.7.2; macOS High Sierra 10.13.6 iMac (27-inch, Late 2012); 2.9GHz i5 CPU; NVIDIA GeForce GTX 660M; 8GB RAM
Affinity Photo 1.7.2.153 & Affinity Designer 1.7.2.6 for iPad; 6th Generation iPad 32 GB; Apple Pencil; iOS 12.3.1

Share this post


Link to post
Share on other sites
1 hour ago, R C-R said:

....

There is no inpainting step listed so I am curious how the macro does that. I also tried manually duplicating your macro's steps & no inpainting occurs unless I add an Edit menu > Inpaint step before the last (Deselect) step. That produces identical results as using the macro, so is this maybe just some kind of bug in the macro recording or editing process?

On the released version of (Windows) AP, the  Edit > Inpaint command shows up as "Delete" in the History panel.  In the current Beta it correctly lists it as "Inpainting"


Due to the fact that Boris Johnson is now our Prime Minister, punctuation, spelling and grammar will never be worried about ever again.  We now have far bigger problems to be concerned about.

Share this post


Link to post
Share on other sites
28 minutes ago, carl123 said:

On the released version of (Windows) AP, the  Edit > Inpaint command shows up as "Delete" in the History panel.  In the current Beta it correctly lists it as "Inpainting"

Thank you for that! I should have been able to figure that out for myself because I did notice that when the macro ran, the progress bar said "Delete," & that manually deleting the inverted selection has no effect, but my feeble old brain could not make the necessary connections to see it. :(

 

That is what I love about these forums -- there is almost always someone who has figured out what I cannot who is willing to take the time to share it with everybody. Much appreciated!


Affinity Photo 1.7.2, Affinity Designer 1.7.2, Affinity Publisher 1.7.2; macOS High Sierra 10.13.6 iMac (27-inch, Late 2012); 2.9GHz i5 CPU; NVIDIA GeForce GTX 660M; 8GB RAM
Affinity Photo 1.7.2.153 & Affinity Designer 1.7.2.6 for iPad; 6th Generation iPad 32 GB; Apple Pencil; iOS 12.3.1

Share this post


Link to post
Share on other sites
17 hours ago, Alfred said:

 

A *.afmacros file contains a collection of macros (usually more than one!) but a *.afmacro file always contains a single macro. You can only open *.afmacros files via the Library panel, and you can only open *.afmacro files via the Macros panel.

 

 

Thanks Alfred - hardly a day goes by when I don't learn something new from this forum.

Share this post


Link to post
Share on other sites
54 minutes ago, Jeff Wallis said:

hardly a day goes by when I don't learn something new from this forum.

It is the same for me. Half (or maybe more) of what I have learned about how to use the Affinity apps & graphics apps in general has been the result of following & participating in these forums.


Affinity Photo 1.7.2, Affinity Designer 1.7.2, Affinity Publisher 1.7.2; macOS High Sierra 10.13.6 iMac (27-inch, Late 2012); 2.9GHz i5 CPU; NVIDIA GeForce GTX 660M; 8GB RAM
Affinity Photo 1.7.2.153 & Affinity Designer 1.7.2.6 for iPad; 6th Generation iPad 32 GB; Apple Pencil; iOS 12.3.1

Share this post


Link to post
Share on other sites

I tried to follow this procedure (not the macro) on an image produced from the panorama merge. I found that I had to expand the selection of the transparent areas before it would work. It then worked well. It also said 'Delete' whilst it was executing the inpainting.

 

I also tried the same using the new Beta, and it crashed out during the final inpainting stage!


Windows 10, Affinity Photo 1.7 and Designer 1.7, (mainly Photo), now ex-Adobe CC

CPU: AMD A6-3670. RAM: 16 GB DDR3 @ 666MHz, Graphics: 2047MB NVIDIA GeForce GT 630

Share this post


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

I tried to follow this procedure (not the macro) on an image produced from the panorama merge. I found that I had to expand the selection of the transparent areas before it would work.

I do not have a lot of shots suitable for a panorama merge but for the few I have, manually doing the steps of the macro (without expanding the selection) worked fine -- in fact, better than I expected. I also tried a slightly simplified manual version of the macro's steps by changing the 'Select opaque' step to 'Select fully opaque' & eliminating the 'Invert selection' step. This also worked, producing identical results in both cases.

 

Below is a before & after the Edit > Inpaint step comparison made from 7 poorly aligned portrait orientation shots (3264 px high by 2448 px wide) I took with an iPhone & stitched together using AP's pano merge function. As I hope you can see even at this small size, only the transparent areas were selected:

before.jpg.e4cf7d46ea4c2648fcd8051e178f5a98.jpg after.jpg.9852463fca5288291a4c895a5dcdf92a.jpg

 

The critical step seems to be rasterizing the Panorama before doing the selection. Did you do that?


Affinity Photo 1.7.2, Affinity Designer 1.7.2, Affinity Publisher 1.7.2; macOS High Sierra 10.13.6 iMac (27-inch, Late 2012); 2.9GHz i5 CPU; NVIDIA GeForce GTX 660M; 8GB RAM
Affinity Photo 1.7.2.153 & Affinity Designer 1.7.2.6 for iPad; 6th Generation iPad 32 GB; Apple Pencil; iOS 12.3.1

Share this post


Link to post
Share on other sites
14 hours ago, John Rostron said:

I tried to follow this procedure (not the macro) on an image produced from the panorama merge. I found that I had to expand the selection of the transparent areas before it would work. It then worked well. It also said 'Delete' whilst it was executing the inpainting.

 

Do I understand correctly? You first took the shortcut by NOT selecting the opaque areas and inverting the selection but instead you only selected the transparent areas (which also in my eyes should be equivalent)? I tried exact the same thing and this didn't work for me either. I played around with expanding the selection to include more non-transparent area of the image as I thought the inpainting algorithm need more input data. With 250px added selection I get quite odd results: the inpainted area is quite smudgy:

 

Bildschirmfoto 2017-08-30 um 08.55.12.png

 

However, it works better/fine when adding 1px to the selection.

 

Bildschirmfoto 2017-08-30 um 08.55.30.png

 

 

I added two versions of my macro for reference: docs_edge_inpainting.afmacros

Share this post


Link to post
Share on other sites
15 minutes ago, drscheme said:

 

.... You first took the shortcut by NOT selecting the opaque areas and inverting the selection but instead you only selected the transparent areas (which also in my eyes should be equivalent)? ...

 

 

For some reason they are not equivalent, strange results can occur sometimes

Always select the opaque areas and invert the selection for best (and consistent) results

PS Rasterising the layer first, before Inpainting, is crucial when certain other operations (such as cropping) has been done on the image


Due to the fact that Boris Johnson is now our Prime Minister, punctuation, spelling and grammar will never be worried about ever again.  We now have far bigger problems to be concerned about.

Share this post


Link to post
Share on other sites
59 minutes ago, drscheme said:

I added two versions of my macro for reference: docs_edge_inpainting.afmacros

I noticed in your macros that the Inpainting step was named "Fill" rather than "Inpaint" or "Delete." I assume that was because you chose Edit > Fill rather than Edit > Inpaint when you recorded the macros. Is that correct?

 

I also noticed that this enabled the gear icon for that step when editing the macro & by clicking on it & enabling the Fill color selector, running the macro gave me a choice to choose a fill color (just as it would if I invoked Edit > Fill manually & opted for the custom color choice) but that had no effect, I assume because internally the macro recorded the inpainting "fill" choice, not the custom color one. That is probably a bug.

 

Anyway, when I tested your unedited macros on a few rotated & cropped photos, the "Inpainting 1px grow" version produced partially transparent results in the inpainted areas while the "Inpainting 250px grow" version did not. But the 250px version also copied a lot of the photo into the inpainting area, producing things like floating partial heads of people in the photo above or to their sides & other similar artifacts. Using "Dave's Alpha Inpaint" macro instead (which includes the "Select opaque" & "Invert selection" steps) produced much better results -- not entirely seamless but free of major artifacts like floating heads & any partially transparent areas.

 

1 hour ago, carl123 said:
1 hour ago, drscheme said:

.... You first took the shortcut by NOT selecting the opaque areas and inverting the selection but instead you only selected the transparent areas (which also in my eyes should be equivalent)? ...

 

For some reason they are not equivalent, strange results can occur sometimes

 

I have a theory about that: Using the Select > Alpha Range "Select Fully Transparent" menu option not surprisingly excludes any partially transparent pixels. So, for rotated/cropped photos, where the edge pixels are antialiased, those antialiased pixels are excluded from the selection. (This is obvious if you zoom in until you can see individual pixel selection boundaries.) Minimally, this will create a seam where no inpainting occurs around the edges. It also can create partially transparent pixels in the inpainting area like I described above for the 1px grow macro. I am not sure why that happens but my guess is it may have something to do with sampling along partial pixel boundaries ... maybe.

 

Regardless, this would (I think) explain why in my panorama merge example I got the same results when I used the "Select Fully Transparent" shortcut as with the two step "Select opaque" & "Invert selection" version -- the panorama merge function produced 'clean' edges with no antialiased pixels, so there was no difference either way in which pixels were included.

 

While I was testing I noticed that the "Select Partially Transparent" option actually includes both fully & partially transparent pixels. So I tried using that as a shortcut instead of the fully transparent option. I have not as yet tested it with many rotated/cropped samples but so far it works with all of them, producing results identical to using Dave's macro.

 

If anyone has the time to test this with their own photos, please post your results here.


Affinity Photo 1.7.2, Affinity Designer 1.7.2, Affinity Publisher 1.7.2; macOS High Sierra 10.13.6 iMac (27-inch, Late 2012); 2.9GHz i5 CPU; NVIDIA GeForce GTX 660M; 8GB RAM
Affinity Photo 1.7.2.153 & Affinity Designer 1.7.2.6 for iPad; 6th Generation iPad 32 GB; Apple Pencil; iOS 12.3.1

Share this post


Link to post
Share on other sites

I followed the suggested recipe to the letter and it worked well without any expansion of the selection.

Panorama before and after.

 

The location is Braye Bay on Alderney, taken from Fort Albert.

 

Braye Bay 800.jpg

Braye Bay Pano 800.jpg


Windows 10, Affinity Photo 1.7 and Designer 1.7, (mainly Photo), now ex-Adobe CC

CPU: AMD A6-3670. RAM: 16 GB DDR3 @ 666MHz, Graphics: 2047MB NVIDIA GeForce GT 630

Share this post


Link to post
Share on other sites
23 hours ago, R C-R said:

I noticed in your macros that the Inpainting step was named "Fill" rather than "Inpaint" or "Delete." I assume that was because you chose Edit > Fill rather than Edit > Inpaint when you recorded the macros. Is that correct?

 

Yes. Does this make any difference?

 

23 hours ago, R C-R said:

Anyway, when I tested your unedited macros on a few rotated & cropped photos, the "Inpainting 1px grow" version produced partially transparent results in the inpainted areas while the "Inpainting 250px grow" version did not. But the 250px version also copied a lot of the photo into the inpainting area, producing things like floating partial heads of people in the photo above or to their sides & other similar artifacts. Using "Dave's Alpha Inpaint" macro instead (which includes the "Select opaque" & "Invert selection" steps) produced much better results -- not entirely seamless but free of major artifacts like floating heads & any partially transparent areas.

 

Yes, I can confirm what you described. With one photo the 1px version produced much transparency. Interestingly that did not happen when I tested this macro with another picture. But you are right that the 250px version does odd things. Always. ^^

 

23 hours ago, R C-R said:

I have a theory about that: Using the Select > Alpha Range "Select Fully Transparent" menu option not surprisingly excludes any partially transparent pixels. So, for rotated/cropped photos, where the edge pixels are antialiased, those antialiased pixels are excluded from the selection. (This is obvious if you zoom in until you can see individual pixel selection boundaries.) Minimally, this will create a seam where no inpainting occurs around the edges. It also can create partially transparent pixels in the inpainting area like I described above for the 1px grow macro. I am not sure why that happens but my guess is it may have something to do with sampling along partial pixel boundaries ... maybe.

 

Regardless, this would (I think) explain why in my panorama merge example I got the same results when I used the "Select Fully Transparent" shortcut as with the two step "Select opaque" & "Invert selection" version -- the panorama merge function produced 'clean' edges with no antialiased pixels, so there was no difference either way in which pixels were included.

 

While I was testing I noticed that the "Select Partially Transparent" option actually includes both fully & partially transparent pixels. So I tried using that as a shortcut instead of the fully transparent option. I have not as yet tested it with many rotated/cropped samples but so far it works with all of them, producing results identical to using Dave's macro.

 

I like your theory. Sounds reasonable. When I have more time to play around with it I'll share results.

Share this post


Link to post
Share on other sites
1 hour ago, drscheme said:
On 8/30/2017 at 4:44 AM, R C-R said:

I noticed in your macros that the Inpainting step was named "Fill" rather than "Inpaint" or "Delete." I assume that was because you chose Edit > Fill rather than Edit > Inpaint when you recorded the macros. Is that correct?

 

Yes. Does this make any difference?

 

Other than maybe exposing a bug in the macro process, I don't know if it does or not.

 

1 hour ago, drscheme said:

I like your theory. Sounds reasonable. When I have more time to play around with it I'll share results.

Please do. The critical factor seems to be if all the fully & partially transparent pixels are included in the selection. That is easiest to see if you zoom way in on the selection border until you can see the individual pixels it includes. That might be something you want to check when playing around with this.


Affinity Photo 1.7.2, Affinity Designer 1.7.2, Affinity Publisher 1.7.2; macOS High Sierra 10.13.6 iMac (27-inch, Late 2012); 2.9GHz i5 CPU; NVIDIA GeForce GTX 660M; 8GB RAM
Affinity Photo 1.7.2.153 & Affinity Designer 1.7.2.6 for iPad; 6th Generation iPad 32 GB; Apple Pencil; iOS 12.3.1

Share this post


Link to post
Share on other sites
On 29/08/2017 at 10:20 AM, R C-R said:

Setting Preserve Alpha would (I think) exclude all transparent areas from inpainting, which is not what we want.

 

@dmstraker I have a question about your macro. It seems to work fairly well but when I use "Edit Macro" just to see the included steps, this is all I see:

59a52f971e83f_davesmacrosteps.png.5613ba469bf1c1aaae0ac78fe96ed224.png

There is no inpainting step listed so I am curious how the macro does that. I also tried manually duplicating your macro's steps & no inpainting occurs unless I add an Edit menu > Inpaint step before the last (Deselect) step. That produces identical results as using the macro, so is this maybe just some kind of bug in the macro recording or editing process?

 

Yes, confusing isn't it. The 'Delete' is actually 'Inpaint'. It's a bug in Affinity, which I've reported and had acknowledged.


Dave Straker

Cameras: Sony A7R2, RX100V

Computers: Win10: Chillblast Photo with i7-3770 + 16Gb RAM + Philips 40in 4K; Surface Pro 4 i5

Favourite word: Aha. For me and for others.

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

×