Jump to content
danmerey

[By Design] Merge Down Layers in AF corrupts/blures image in some cases: example attached, solution offered

Recommended Posts

@GabrielM Thank you!
I've tested the pants off of this so if you need anything else, please don't hesitate.
I also just want to make sure you know I'm on Mac... so this is a universal issue eve though I ended up reply to a PC thread.

Which brings me to the last thought: Is it too much to ask to haul this back out of the "Solved" section until re-solved? ;)

23 hours ago, R C-R said:

Are you testing with a beta or the retail Affinity Photo app?

All my stuff was done in the MAS version. I only mentioned the Beta because I couldn't open Walt's files.
Now that it's in the Dev's hands, I don't think I need to keep on with example files... The point has been taken.

Share this post


Link to post
Share on other sites
4 hours ago, >|< said:

You're doing the merge upside down! It's obvious that to test merging down into a scaled layer, you should be merging down into a scaled layer, not merging into an unscaled layer.

While I do think an example .afphoto file would have helped me, please don't underestimate my ability to overlook the obvious. :$

Anyway, with your help I can now duplicate the results @JimmyJack & others were describing. From what I can (now!) tell, it seems limited to documents where, due to scaling/resizing, the raster layers to be merged have dissimilar dpi values. Is anybody seeing this happen when they are the same, or due to rasterizing layers they are the same as the document dpi?


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
23 minutes ago, R C-R said:

From what I can (now!) tell, it seems limited to documents where, due to scaling/resizing, the raster layers to be merged have dissimilar dpi values. Is anybody seeing this happen when they are the same, or due to rasterizing layers they are the same as the document dpi?

In my test file (above), unfortunately named no-blurring.afphoto, you can cause blurring if you move the bottom layer .1px in the X and Y directions using the Transform panel, and then Merge Down the top layer into the bottom layer.

One interesting point that I cannot yet explain: After moving the bottom layer, it is at X and Y coordinates .1px/.1px and has a size of 2250 x 3300px. If I Rasterize the bottom layer, then I do not have a problem with the Merge Down into that layer. It's what happens during the Rasterization and the Merge that I can't explain.

Rasterizing the bottom layer (X/Y = .1px/.1px, W/H = 2550/3300 px) gives me a layer that is positioned at X=0, Y=0, and has the same size.

On the other hand, if I don't rasterize it, and I Merge Down, it blurs. And it gives me a single layer positioned at X=-.9px, Y=-.9px and W=2551, H=3301.

So the merging operation increased the pixel size by 1px in each dimension, and did so by adding the pixel along the left/top edges. The rasterization operation simply seems to have shifted the image .1px up and left to bring its coordinates to 0.. I don't know why rasterization didn't affect the layer the same as the Merge did.


-- Walt

Windows 10 Home, version 1903 (18362.239), 16GB memory, Intel Core i7-6700K @ 4.00Gz, GeForce GTX 970
Affinity Photo 1.7.2.471 and 1.7.3.476 Beta   / Affinity Designer 1.7.2.471 and 1.7.3.476 Beta  / Affinity Publisher 1.7.2.471 and 1.7.3.475 Beta

Share this post


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

From what I can (now!) tell, it seems limited to documents where, due to scaling/resizing, the raster layers to be merged have dissimilar dpi values.

No.

2 hours ago, R C-R said:

Is anybody seeing this happen when they are the same

Yes

2 hours ago, R C-R said:

or due to rasterizing layers they are the same as the document dpi?

This is the point. Rasterizing changes the result.
BUT, without rasterizing...... Attached: Two layers each 72 dpi. Document 72 dpi (not that it should matter, imo).
Merge black into teal. See what happens.
Why on earth would the hight and width both be fractional afterwards? (rhetorical question)

2 hours ago, walt.farrell said:

I don't know why rasterization didn't affect the layer the same as the Merge did.

Exactly!

with love:
welcome-to-the-jc27bb.jpg.7550e5314333c98773f494583a655d43.jpg

example.afphoto

Share this post


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

BUT, without rasterizing...... Attached: Two layers each 72 dpi. Document 72 dpi (not that it should matter, imo).
Merge black into teal. See what happens.
Why on earth would the hight and width both be fractional afterwards? (rhetorical question)

Not a rhetorical question: why does this not happen with one change to your file, that being to merge black with a layer identical to the teal one except that its width is one 1 px narrower so it is an even number of pixels wide? That's what I did in with the purple layer in example 2.afphoto, created at 510 x 511 px, not scaled/resized to those dimensions or rasterized. I also tested with the orange layer at 510 px square, but it seems that odd numbered widths are the critical factor, at least for this kind of fractional change.

This sort of suggests there is some sort of internal rounding error or some such ... or not. :S


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

For what very little it is worth, I have been experimenting with variations of the example.afphoto @JimmyJack posted, all using pixel layers I created at 72 dpi (so nothing is resized/scaled) prior to the Merge Down step. My tests were far from exhaustive, but for all my 'all 72 dpi' tests it looks like odd integer widths are what causes the fractional values. Moreover, it only seems to occur when a smaller layer is merged down into a larger one that has an odd integer width -- in this case the smaller layer can have an odd integer width without causing the issue.

That last condition is particularly weird because in my tests the two layers do not overlap so (I think) there should be no difference regardless of which layer is above the other in the Layers panel.

Merge down test 3.afphoto


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, R C-R said:

That's what I did in with the purple layer in example 2.afphoto, created at 510 x 511 px, not scaled/resized to those dimensions or rasterized.

and....

8 hours ago, R C-R said:

For what very little it is worth, I have been experimenting with variations of the example.afphoto @JimmyJack posted, all using pixel layers I created at 72 dpi (so nothing is resized/scaled) prior to the Merge Down step.

Have you not read the posts in this thread? It's the resizing/scaling that triggers the problem. 

8 hours ago, R C-R said:

....it looks like odd integer widths are what causes the fractional values. Moreover, it only seems to occur when a smaller layer is merged down into a larger one that has an odd integer width -- in this case the smaller layer can have an odd integer width without causing the issue.

Odd/even values are irrelevant to what I'm/we're talking about here.
As well as small into large or large into small.

I have no idea what you're trying to say with your small/big even/odd experiment.
Is it that blurring happens even withOUT resizing? That's even worse. (I can't make that happen).

8 hours ago, R C-R said:

.... the two layers do not overlap so (I think) there should be no difference regardless of which layer is above the other in the Layers panel.

RIGHT!!! Finally. :4_joy:
(and that's just one part of it....)

Share this post


Link to post
Share on other sites
49 minutes ago, JimmyJack said:

I have no idea what you're trying to say with your small/big even/odd experiment.
Is it that blurring happens even withOUT resizing? That's even worse. (I can't make that happen).

That is indeed what I'm saying. In my "Merge down test 3" file above, try Merging down the "BLACK 118W x 71H" layer with the "ORANGE 510W x 115H" one. Now undo that, move Black down one position so it is just above the "TEAL 511px" layer & doing the merge down again. Undo that & continue the process, merging down either of the two small layers (Black or Yellow) with any of the others, for example merging down Yellow into Teal, Yellow into Purple, & so on.

After each merge down, note the widths & heights shown in the Transform panel. Do you not sometimes get fractional values & other times not?


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:

That is indeed what I'm saying. In my "Merge down test 3" file above, try Merging down the "BLACK 118W x 71H" layer with the "ORANGE 510W x 115H" one. Now undo that, move Black down one position so it is just above the "TEAL 511px" layer & doing the merge down again. Undo that & continue the process, merging down either of the two small layers (Black or Yellow) with any of the others, for example merging down Yellow into Teal, Yellow into Purple, & so on.

After each merge down, note the widths & heights shown in the Transform panel. Do you not sometimes get fractional values & other times not?

Did all that. Only fractional result was merging anything down into teal. That leads me to believe that teal was most likely (unwittingly) resized somewhere along the line... maybe changed from 510 to 511 in transform panel (?).

I made my own 511 and everything is fine. I suggest you make a new 511 and see what happens. 

Share this post


Link to post
Share on other sites
5 minutes ago, JimmyJack said:

Did all that. Only fractional result was merging anything down into teal. That leads me to believe that teal was most likely (unwittingly) resized somewhere along the line... maybe changed from 510 to 511 in transform panel (?).

I did not change anything in the Transform panel for any of the layers but the teal & black layers are the original ones from your example.afphoto file -- I modified that file for my tests. I assumed (in hindsight I suppose incorrectly) that the teal layer was not resized from your "Attached: Two layers each 72 dpi" comment. That was based in part on noticing that changing the width or height even by a single pixel in the Transform panel changes the context toolbar from "72dpi" to "72x72dpi" or the like for other dpi's, & is usually truncated because not enough width is available to display the entire dpi string.

So I was also assuming that the two values & the x indicate that a layer has been resized so it is no longer composed of square pixels & therefore cannot be resolved into a 'pixel perfect' document layer, even when its extent is perfectly aligned to the document pixel boundaries, if that makes any sense.

Regardless, I will be very interested in what the developers have to say about 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

Just to  stirthepot.gif again, I have tentatively decided once again that there is no bug when merging down involves a resized layer, or at least that if there is a bug it is not that the resultant layer sometimes is blurred & has a fractional width or height; & moreover that it is the intended & possibly unavoidable result.

My reasoning, such as it is, is that while an Affinity Photo document can include layers with different pixel resolutions (equivalent to different dpi values in the context toolbar), any given layer can have only one pixel resolution/dpi property. Thus, when a 'pixel perfect' raster layer is resized, even though it may still be perfectly aligned to the document pixel boundaries, its content may not be, like when changing only its width or height. This can cause blurring due to anti-aliasing (because the layer's pixels are being stretched or shrunk & no longer fit perfectly into square pixels), so it may be blurred even before it is merged with any other layer, & the post-merge blurring is just a consequence of that (because the result is just one layer, which can have only one pixel resolution).

The examples with solid color layers don't show this pre-merge blur (because anti-aliasing a color with itself, such as it is, has no visible effects) but using layers like in this Merge down test 4.afphoto example will show the pre-merge anti-alias blurring if resized along the x or y axis & the resultant post-merge blur & fractional dimensions of the merged layer.

So what do you all think? Am I still overlooking something obvious or not thinking straight, or does this make at least some sense?


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

Dear developers,

I wanted to love this program. This bug made me look for alternatives.

You want to compete with Photoshop? Fix it.

This is a program-defining bug.

Right now, "Affinity Photo is just like Photoshop except YOU CAN'T MERGE LAYERS". 

That's all I remember about the software, which is a shame, because it has a ton of good things going for it. I would rather be able to say "Affinity Photo is just like Photoshop but it doesn't ask for your firstborn." But I can't say that, because of this thing.

Will check in next year to see if it's fixed yet. It's unusable for me until then. :(

I'm angry because I care, not because I hate you. I love you all, and I want you to be more lovable.

Share this post


Link to post
Share on other sites

Dear developers,

I had reasonably no hope for this problem to be solved in the 1.7 version. Presumably thousands of other stuffs to fixe before this surreal dead-line.

Probably now hundreds of new stuffs  to work on now thousand of impatient users shake the beast and feed the forum with new requests.

So this cordial reminder.

I've just done one new test on the 1.7 version I've just downloaded. The PROBLEM remains.:61_sob:

This is not a minor one. And what really worries me at the moment is that I've just checked the whole forum.

https://forum.affinity.serif.com/index.php?/topic/53609-merging-layers-causing-blurring/

https://forum.affinity.serif.com/index.php?/topic/56935-blur-image-issue-after-merging-layers/

https://forum.affinity.serif.com/index.php?/topic/46138-image-blur-when-merging-image-together/

https://forum.affinity.serif.com/index.php?/topic/46290-resolution-loss-when-merging-layers/

https://forum.affinity.serif.com/index.php?/topic/26598-loss-of-detail-when-merging-down-in-ap-and-delays-in-merging/

The problem is known for years (this last and current topic being the one that characterized it with the more precision. Actually it even suggest an answer [ if needed :) ] : bottomLayer.rasterise()  . Just before the mess) 

I hardly understand. It's definitely  one of this feature that suggests Affinity is not a solution, but a problem (I haven't opened Affinity Photo for a month).

More than ever, I'm eager to read from you. There must be a missing plot, a functional one (the technical solution being there), something I can't grasp, to justify this situation.

Don't be a stranger.

A sad user full of hopes.   

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

×