Jump to content
John Rostron

Photo: Error in Distort > Equations

Recommended Posts

From previous experience, the y parameter in Distort > Equations goes from top to bottom, as with most graphic programs. I have always assumed this in constructing equations and macros. Recently I have been doing some experiments. This is the base image I have started with, allowing around 25 pixels underneath the rasterized text:

5a855b7d7bf10_ArtisticText75h.png.8958286787251a4a6c0e315701eb060d.png

I then use y=y+20 and get:

5a855be69242d_ArtisticTextplus20.png.3376b1ee3b99617a9b0befc741507976.png

and then using y=y-20 to get:

5a855c3a47169_ArtisticTextminus20.png.edd45b50e86ad04baf155265d6f2500f.png

which both behave as if the y-origin is at the bottom.

I then try multiplying and dividing by a fraction. Firstly y=y*0.7 to get:

5a855c9922e76_ArtisticTexttimes0.7.png.db5ecc23e2b3e390ef3410bee337e92f.png

Then y=y/0.7 to get:

5a855cb5a7694_ArtisticTextdivide0.7.png.88e375dca876baa595777d64665700ea.png

These seem to behave in the opposite way to what one would expect. Multiplying by a fraction 0.7 enlarges the image and dividing by 0.7 shrinks the image (leaving a gap at the bottom). These both behave as if the y-origin was at the top.

I have tried these in both the current version of Photo and the most recent Beta with the same results.

Resolved: it is not a bug.

I have posted a Tutorial summarising the resolution of this as a Tutorial.

John

 

Edited by John Rostron
Resolved

Windows 10, Affinity Photo 1.8,5 Designer 1.8.5 and Publisher 1.8.5 (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
36 minutes ago, shojtsy said:

Results are consistent with the origin being at the top, and y being further and further negative going down.

That would apply to the first two (+ and -) but not the bottom two. Having a negative scale is not really helpful!

John


Windows 10, Affinity Photo 1.8,5 Designer 1.8.5 and Publisher 1.8.5 (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
On 2/23/2018 at 3:26 PM, Andy Somerfield said:

It maps from Destination to Source - not Source to Destination..

ie. For *output* pixel x=25, apply equation x=x*2 to read from *input* pixel 50..

Hope this helps,

A
 

It helps in trying to apply a consistent formulation, but it is not intuitive. I just have to remember that Affinity Equations involving simple arthmetic work the opposite way that I would expect them to.

For *output* pixel x=25, apply equation (input:x)=(output:x)*2 to read from *input* pixel 50.

And how come more complex equations involving trigonometric functions seem to work?

If I use x in an equation for y, is this seen as input x or output x? For example, I use the following equations:

x=x+y*(h-y)/h
y=y+x*(w-x)/w

which transforms this:

GridPattern640.png.56476be657b40dcf6666ccbccea6d756.png

into this:

GridPattern640DQ.png.f77a06937c10f56b55f23d9983057715.png

which is more-or-less (but not quite) what I would expect.

John

Edited by John Rostron
Added some graphical examples

Windows 10, Affinity Photo 1.8,5 Designer 1.8.5 and Publisher 1.8.5 (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

Since the equations are used to determine what the input x and input y are, the x and y occurring within them will surely refer to output x and output y. I don't think they went and implemented an equation system solver!

Share this post


Link to post
Share on other sites
26 minutes ago, shojtsy said:

Since the equations are used to determine what the input x and input y are, the x and y occurring within them will surely refer to output x and output y. I don't think they went and implemented an equation system solver!

That doesn't seem to be the way Andy described it a few posts above. He described it as (I think) output = f(input).


-- Walt

Windows 10 Home, version 2004 (19041.388),
   Desktop: 16GB memory, Intel Core i7-6700K @ 4.00GHz, GeForce GTX 970
   Laptop:  8GB memory, Intel Core i7-3625QM @ 2.30GHz, Intel HD Graphics 4000 or NVIDIA GeForce GT 630M
Affinity Photo 1.8.5.703 and 1.9.0.734 Beta   / Affinity Designer 1.8.5.703 and 1.9.0.734 Beta  / Affinity Publisher 1.8.5.703 and 1.9.0.742 Beta.

Share this post


Link to post
Share on other sites
2 hours ago, walt.farrell said:

That doesn't seem to be the way Andy described it a few posts above. He described it as (I think) output = f(input).

He said "For *output* pixel x=25, apply equation x=x*2 to read from *input* pixel 50.."

Since 50=25*2, so he meant  InputX = OutputX * 2.
 

Share this post


Link to post
Share on other sites
51 minutes ago, shojtsy said:

He said "For *output* pixel x=25, apply equation x=x*2 to read from *input* pixel 50.."

Since 50=25*2, so he meant  InputX = OutputX * 2.
 

No, you are misunderstanding the = in this sentence it's NOT a numerical equals, walt.farrell is correct

output at x = function() where that function may or may not include the value of x, but it indicates which source pixel to use.

 

So x_output = 2*x_output says that for each output pixel x use the input pixel at 2x. That's all, no equation to solve. 


Patrick Connor
Serif Europe Ltd

Latest releases on each platform 

 

Share this post


Link to post
Share on other sites
13 minutes ago, Patrick Connor said:

No, you are misunderstanding the = in this sentence it's NOT a numerical equals, shojtsy is correct

output = function() where that function may or may not include the value of x to work out which source pixel to use.

 

So x_output = 2*x_output says that for each output pixel x use the input pixel at 2x. That's all, no equation to solve. 

You wanted to say "x_input = 2*x_output" I suppose :)

Share this post


Link to post
Share on other sites
54 minutes ago, Patrick Connor said:

I have corrected the post 

 

You corrected the reference to @walt.farrell, but you forgot to correct the assignment example which currently says "x_output = 2*x_output". I think you meant to write "x_output = 2*x_input".


Alfred online2long.gif
Affinity Designer/Photo/Publisher for Windows • Windows 10 Home (4th gen Core i3 CPU)
Affinity Photo for iPad 1.8.4.186 • Designer for iPad 1.8.4.4 • iPadOS 13.7 (iPad Air 2)

Share this post


Link to post
Share on other sites

I have slept on this and will try again. 

On the dialog x=foo y=bar means the output pixel (x, y) has its colour value calculated by evaluation of foo and bar. Once evaluated that value represents the source pixel to use,  so source(foo, bar) 

foo is the x_input pixel calculated by evaluation of foo in terms of x_output. In this example x_input = foo = 2*x_output

So shojtsy was correct I just didn't see it, sorry. 


Patrick Connor
Serif Europe Ltd

Latest releases on each platform 

 

Share this post


Link to post
Share on other sites

By George, I think I've got it! I was thinking that Equations represented some kind of geometrical transform but it doesn't.  I now understand it, though it made my head hurt working it out. No wonder @Patrick Connor had to sleep on it!

Given the equations:

x=F(x,y)

y=G(x,y)

Then for a pixel at (x,y), AP evaluates the pixel value at (F(x,y), G(x,y)), and applies this value to the pixel at (x,y). Simples!

 

John


Windows 10, Affinity Photo 1.8,5 Designer 1.8.5 and Publisher 1.8.5 (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

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

Please note the Annual Company Closure section in the Terms of Use. These are the Terms of Use you will be asked to agree to if you join the forum. | 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.