Kronpano Posted December 1, 2019 Share Posted December 1, 2019 At the moment it is AFAIK impossible to write image size independent macros if you want to use "resize canvas/document" because these operations work on pixels. Problem: Affinity photo should be 360 aware but it isn't really - local adjustment filters and tonemapping leave visible seams. Workaround: One easy way to get around that is to increase the canvas width by 20% (<- this is the problem), use equations to fill the right and left border, make the adjustment and resize the width of the canvas back to the original size - shrink width by 16.66% (<-again a problem) At them moment this can't really be done independent of the image size because a size increase/decrease will be calculated to pixels - so there will be a fixed pixel number in the macro Solutions: The easiest solution would be if Affinity Photo would support resize by percent properly - by that I mean also in macros support expressions in input fields also in macros -> if you put "*1.2" in an input field this expression will also be used in the macro support variables in macros - reading image size into variables which can be used in later operations To give an example - I have written a macro which increases a 360 panorama by 10% on each side and fills the properly BUT it will only work properly with a 10000 x 5000 px panorama (my main publishing size). Would be really good for Affinity photo if the macro capabilities got better - it can really speed up a workflow and make repetitive tasks a lot easier but for that it needs to be possible to do pretty much everything independent of the image size and in a way - that's where percentages come in really handy. 10kBy5kPlus10%eachSide.afmacro Quote Link to comment Share on other sites More sharing options...
fde101 Posted December 2, 2019 Share Posted December 2, 2019 I agree there doesn't seem to be a way to do this with macros, but do note that you can do this directly in the various resize dialogs using expressions like "+=20%" - just in case you had missed that... Quote Link to comment Share on other sites More sharing options...
walt.farrell Posted December 2, 2019 Share Posted December 2, 2019 This probably can be done, but it will require that you use Filters > Distort > Equations... in your macro to perform the resizing operation. For an example: For more information on using Equations, there are some topics in the Tutorials forum. Quote -- Walt Desktop: Windows 11 Pro, version 22H2, 64GB memory, AMD Ryzen 9 5900 12-Core @ 3.00 GHz, NVIDIA GeForce RTX 3090 Laptop: Windows 11 Pro, version 22H2, 32GB memory, Intel Core i7-10750H @ 2.60GHz, Intel UHD Graphics Comet Lake GT2 and NVIDIA GeForce RTX 3070 Laptop GPU. Affinity Photo 1.10.6 (.1665) and 2.1.0 and 2.1.0. beta/ Affinity Designer 1.10.6 (.1665) and 2.1.0 and 2.1.0 beta / Affinity Publisher 1.10.6 (.1665) and 2.1.0 and 2.1.0betaiPad Pro M1, 12.9", iPadOS 16.6.1, Apple Pencil 2, Magic Keyboard Affinity Photo 1.10.7 and 2.1.0 and 2.1.0 beta/ Affinity Designer 1.10.7 and 2.1.0 and 2.1.0 beta/ Affinity Publisher 2.1.0 and 2.1.0 beta Link to comment Share on other sites More sharing options...
carl123 Posted December 2, 2019 Share Posted December 2, 2019 18 hours ago, Kronpano said: One easy way to get around that is to increase the canvas width by 20% (<- this is the problem), The attached macro should do that It adds a transparent canvas width of 10% to each side of the document Tested on 2000px - 20000px width documents In multiples of 500px (e.g. 2500px, 3000px, 3500px etc) you "should" get accurate resizing results but due to rounding (up/down) in the macros and equation filter, the resize can be 2-4 pixels off if you use totally random widths to start with. It works at the layer level, not the document level so either start with a jpg/png file etc or merge (flatten?) all layers into one in your document first. To run just select the layer then run the macro add-10%-each-side.afmacro Kronpano 1 Quote Link to comment Share on other sites More sharing options...
Kronpano Posted December 2, 2019 Author Share Posted December 2, 2019 OK, thanks for that. I see - I did pretty much the same BUT I didn't think of using a "dummy" layer, then resizing the canvas, clipping it and throw away the dummy. So close and yet so far. Thanks again. Will try to incorporate it into my macro. If I can't get there are you happy to share the equation?? Quote Link to comment Share on other sites More sharing options...
Kronpano Posted December 2, 2019 Author Share Posted December 2, 2019 Grrr - will try again tomorrow Having problems centring the expanded pixels Still hoping I will get there Quote Link to comment Share on other sites More sharing options...
walt.farrell Posted December 2, 2019 Share Posted December 2, 2019 6 hours ago, carl123 said: It adds a transparent canvas width of 10% to each side of the document When you say "each side" do you mean "right and left sides"? That's what I get, but I wasn't sure if you meant to include all 4 sides. Quote -- Walt Desktop: Windows 11 Pro, version 22H2, 64GB memory, AMD Ryzen 9 5900 12-Core @ 3.00 GHz, NVIDIA GeForce RTX 3090 Laptop: Windows 11 Pro, version 22H2, 32GB memory, Intel Core i7-10750H @ 2.60GHz, Intel UHD Graphics Comet Lake GT2 and NVIDIA GeForce RTX 3070 Laptop GPU. Affinity Photo 1.10.6 (.1665) and 2.1.0 and 2.1.0. beta/ Affinity Designer 1.10.6 (.1665) and 2.1.0 and 2.1.0 beta / Affinity Publisher 1.10.6 (.1665) and 2.1.0 and 2.1.0betaiPad Pro M1, 12.9", iPadOS 16.6.1, Apple Pencil 2, Magic Keyboard Affinity Photo 1.10.7 and 2.1.0 and 2.1.0 beta/ Affinity Designer 1.10.7 and 2.1.0 and 2.1.0 beta/ Affinity Publisher 2.1.0 and 2.1.0 beta Link to comment Share on other sites More sharing options...
carl123 Posted December 3, 2019 Share Posted December 3, 2019 Yes, just "right and left sides" which was the OP's requirement. More specifically the ability to do this as a percentage value on any size image rather than a hardcoded pixel value which will only work on images of the same dimensions Quote Link to comment Share on other sites More sharing options...
Kronpano Posted December 3, 2019 Author Share Posted December 3, 2019 Yes, left and right side. The whole idea is to overcome Affinity photos inability to treat 360 panoramas properly. A 360 panorama is usually a file with a 2:1 ratio - 360 degrees around and 180 degrees up/down - so a full sphere. The problem are the right and left "edges" of the file. When looking at a panorama (example here on kuula ) the right and left side need to fit together seamlessly otherwise there will be a vertical line visible in the panorama. General changes in brightness, colours... don't affect that BUT local changes (like clarity, local contrast, tonemapping) cause a problem because if I apply them to the original image the edges have no neighbour - so the left edge will be treated differently from the right edge and when I put them together there is a visible seam. This can be prevented by by extending the original image (basically give each edge neighbours) - this is possible because the 360 panorama can just be wrapped around so it will fit seamlessly. My macro I provided in the post at the top does just that - BUT it is size dependent. Now I had a go with the macro @carl123 posted yesterday and I am not sure it helps. Yes - it adds 10% to each side - so that problem is solved BUT once I have done that (manually or in a macro) I have "lost" my original width of the panorama and don't know how far to shift the image to extend the right/side because the width w is now the extended width. Let me explain my macro Assume a 10000x5000px panorama Extend the canvas by 20% centred - this will result in a 12000x5000 canvas with the original panorama in the middle and 10% transparent on each side Duplicate that layer and shift it to the right by 10000px - this will seamlessly fill the right hand side 10% extension Duplicate the layer and shift it to the left by 10000px - the same for the left hand side 10% extension Merge them all down and you are done You will end up with a 12000x5000px document which has no seams in itself Apply any local adjustment and the "original" edges will be treated the same because they have the "proper" neighbours Once you are done with the adjustments you can just resize the canvas back (centred) to 10000x5000px and you will have again a 360 panorama with no seams. This is what Affinity photo should probably do in the first place since it claims to be 360 aware so all of that is only to get around the limitations the program shouldn't have in the first place. I have raised that problem about 18 month ago and after a long silence it was confirmed here that it will NOT be solved. A solution provided by @James Ritson relies on as far as I can see on resizing the pixels (squashing and expanding like equation x/0.9 and x/(1/0.9) ) which will deteriorate the image quality since the final expansion is not working on the original pixels but the squashed ones. So please give us either a % resize that can be used in macros or even better - a macro scripting language (like Mathmap for GIMP) so you can work with variables and stuff and not just one line equations which can't be saved and edited properly. Not sure it makes sense to anybody who is not working with panoramas but I hope my explanation makes sense. Cheers. Quote Link to comment Share on other sites More sharing options...
Kronpano Posted December 3, 2019 Author Share Posted December 3, 2019 OK, I think I am giving up Just thought I had it - using distort -> affine Extend the canvas to really wide (like 20000x100) and then use distort -> affine with 120% and clip the canvas again Should result in a 10000 scaled to 120% should be 12000 pixels wide NOOOOO it is 12002 pixels wide - internal rounding problem I would guess but that that is out of my control and again - probably size dependent. Same happens with all my equations - they are all 2 pixels to wide - grrrr Quote Link to comment Share on other sites More sharing options...
carl123 Posted December 3, 2019 Share Posted December 3, 2019 I'm due a coffee break so give me 10 minutes to have a look at this. (I think I understand what the second part of your process is - if so it should be doable) Quote Link to comment Share on other sites More sharing options...
Kronpano Posted December 3, 2019 Author Share Posted December 3, 2019 @carl123 - would you be happy to share the equation you have used to calculate and centre 10% extended canvas? I have tried clamp, round, floor in my equation but I ended up with 12001 - still one pixel too wide Quote Link to comment Share on other sites More sharing options...
Kronpano Posted December 3, 2019 Author Share Posted December 3, 2019 The second part - once the canvas has the correct size of EXACTLY 120% (not a pixel more or less) is just x+w/1.2 and x-w/1.2 for duplicated layers and merging them down. But to get the exact 120% confounds me. Quote Link to comment Share on other sites More sharing options...
carl123 Posted December 3, 2019 Share Posted December 3, 2019 Ok, from what I understand after the 20% canvas resize you need to shift copies of the image left and right to fill in the transparent areas. I can only test on normal images as I don't have one of your 360 panoramas to see if this works on them. So you will need to let me know what happens if it's incorrect To run just select the layer then run the macro (There is no need to run the previously supplied macro first) PS Macro may take a minute or 2 to run on very large documents 360-panorama-macro.afmacro Kronpano 1 Quote Link to comment Share on other sites More sharing options...
Kronpano Posted December 3, 2019 Author Share Posted December 3, 2019 OK, so I can use a macro in a macro I used you add10% macro and did the rest in this ExtendPanorama macro and it works fine - only ran a couple of tests. Still would like to know how to solve the 1 or 2 extra pixel problem. ExtendPanorama.afmacro Quote Link to comment Share on other sites More sharing options...
Kronpano Posted December 3, 2019 Author Share Posted December 3, 2019 Yes, that does the same mine does - but I have to call your add-10% macro in mine since I have been unable to fix the extra pixel problem. Thank you for all the help. P.S.: Any hint on how to solve the extra pixel problem?? Quote Link to comment Share on other sites More sharing options...
carl123 Posted December 3, 2019 Share Posted December 3, 2019 42 minutes ago, Kronpano said: I have tried clamp, round, floor in my equation but I ended up with 12001 - still one pixel too wide I'm afraid you went down the wrong track when analyzing one of my old macros. It has nothing to do with clamp, round, or floor - it's a lot simpler than that I wrote down the important specific value I needed in the equation formula but not all of it so I just need to recreate it fully and will post back shortly. Quote Link to comment Share on other sites More sharing options...
carl123 Posted December 3, 2019 Share Posted December 3, 2019 Ok, my first equation used the Polar Coordinate System not the Cartesian Value (1.1999) as shown in the screenshot below Quote Link to comment Share on other sites More sharing options...
Kronpano Posted December 3, 2019 Author Share Posted December 3, 2019 Thanks for that!!! I had a play with polar but didn't come up with that formula. Doesn't really seem intuitive but hey - it works. Still a shame that the cartesian calculations seem to be out by a pixel - if I do floor(x/1.2) - which I would expect to increase my image to 120% I end up with an extra pixel. Should have done x/1.1999 all along In a way the 1.1999 in your solution is also just solving a problem that shouldn't be there - some internal rounding errors?? Thanks for all the help - now I can use Affinity photo a bit more for my intended purpose - post-processing panoramas. Quote Link to comment Share on other sites More sharing options...
neoDIRECT Posted December 13, 2019 Share Posted December 13, 2019 It would be very helpful to increase the canvas size by percentage. On Photoshop I used it often when I had a lot of products (often with different resolution) - so it is not possible to set the same padding for all in a batch job. In that programme was also an option to set the size relatively that allows you to add the same padding in pixels for all images after resizing. But in AP you can not use Resize document in macro. So you have to do all the steps in a few parts and sometimes quite strange ways Regards, Dominik Quote Link to comment Share on other sites More sharing options...
JonnyPanic Posted March 28, 2021 Share Posted March 28, 2021 On 12/2/2019 at 1:39 PM, walt.farrell said: This probably can be done, but it will require that you use Filters > Distort > Equations... in your macro to perform the resizing operation. For an example: For more information on using Equations, there are some topics in the Tutorials forum. Can someone please add the macro as a macros (with an S) file so it can be imported onto an iPad. thanks! Quote Link to comment Share on other sites More sharing options...
walt.farrell Posted March 28, 2021 Share Posted March 28, 2021 2 hours ago, JonnyPanic said: Can someone please add the macro as a macros (with an S) file so it can be imported onto an iPad. thanks! Perhaps @carl123 would consider doing that carl123 1 Quote -- Walt Desktop: Windows 11 Pro, version 22H2, 64GB memory, AMD Ryzen 9 5900 12-Core @ 3.00 GHz, NVIDIA GeForce RTX 3090 Laptop: Windows 11 Pro, version 22H2, 32GB memory, Intel Core i7-10750H @ 2.60GHz, Intel UHD Graphics Comet Lake GT2 and NVIDIA GeForce RTX 3070 Laptop GPU. Affinity Photo 1.10.6 (.1665) and 2.1.0 and 2.1.0. beta/ Affinity Designer 1.10.6 (.1665) and 2.1.0 and 2.1.0 beta / Affinity Publisher 1.10.6 (.1665) and 2.1.0 and 2.1.0betaiPad Pro M1, 12.9", iPadOS 16.6.1, Apple Pencil 2, Magic Keyboard Affinity Photo 1.10.7 and 2.1.0 and 2.1.0 beta/ Affinity Designer 1.10.7 and 2.1.0 and 2.1.0 beta/ Affinity Publisher 2.1.0 and 2.1.0 beta Link to comment Share on other sites More sharing options...
carl123 Posted March 28, 2021 Share Posted March 28, 2021 2 hours ago, JonnyPanic said: Can someone please add the macro as a macros (with an S) file so it can be imported onto an iPad. thanks! Done Selectively resize image height from 1000px to 100.afmacros Quote Link to comment Share on other sites More sharing options...
JonnyPanic Posted March 28, 2021 Share Posted March 28, 2021 Can i also get the 360-panorama-macro.afmacro as a macroS file... Thank you! Quote Link to comment Share on other sites More sharing options...
walt.farrell Posted March 28, 2021 Share Posted March 28, 2021 1 hour ago, JonnyPanic said: Can i also get the 360-panorama-macro.afmacro as a macroS file... Thank you! You should post in the topic where the macro was offered, and ask the author. Quote -- Walt Desktop: Windows 11 Pro, version 22H2, 64GB memory, AMD Ryzen 9 5900 12-Core @ 3.00 GHz, NVIDIA GeForce RTX 3090 Laptop: Windows 11 Pro, version 22H2, 32GB memory, Intel Core i7-10750H @ 2.60GHz, Intel UHD Graphics Comet Lake GT2 and NVIDIA GeForce RTX 3070 Laptop GPU. Affinity Photo 1.10.6 (.1665) and 2.1.0 and 2.1.0. beta/ Affinity Designer 1.10.6 (.1665) and 2.1.0 and 2.1.0 beta / Affinity Publisher 1.10.6 (.1665) and 2.1.0 and 2.1.0betaiPad Pro M1, 12.9", iPadOS 16.6.1, Apple Pencil 2, Magic Keyboard Affinity Photo 1.10.7 and 2.1.0 and 2.1.0 beta/ Affinity Designer 1.10.7 and 2.1.0 and 2.1.0 beta/ Affinity Publisher 2.1.0 and 2.1.0 beta Link to comment Share on other sites More sharing options...
Recommended Posts
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.