Jump to content
der-mathias

Resize Canvas depending on image size + macro

Recommended Posts

Hi, I would like to create a macro that resizes the canvas based on the actual image size.

The canvas should be increased by 10pixels on each side, no matter what the image size is.

How can this be done?

 

Idea behind: create a macro, that makes borders/ frames around my images, but these images can have different dimensions/ orientations..

 

Thanks

 

Mathias

Share this post


Link to post
Share on other sites

I have not tried this, but the obvious route is:

Document > Resize Canvas

Clik on the centre of the nine squares (to indicate you wish to centre your old document within the new).

In the width box enter w+20

In the height box, enter h+20

Press Enter

This should do what you want. You should be able to record it as a macro.

John


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

Hi John,

no it doesn't because there is no "hight" and "width" in the resizing canvas dialog (it just says "size" I know it is the same, but it is not working like this...). And I tried with "w+10" or "h+10" but is not affecting the canvas-size :-(

 

Mathias

Share this post


Link to post
Share on other sites

Instead of w+10 in one box and h+10 in the other, try +=10 in both boxes.


Alfred online2long.gif
Affinity Designer/Photo/Publisher 1.7.3.481 • Windows 10 Home (4th gen Core i3 CPU)
Affinity Photo for iPad 1.7.3.155 • Designer for iPad 1.7.3.1 • iPadOS 13.3 (iPad Air 2)

Share this post


Link to post
Share on other sites

Hi, thanks for the answer. I tried this one before. It works, but NOT in a macro with different image sizes/orientations... :-(

This +=10 recalculates the values for "size" but these values are static now (in the macro), so an image with totally different dimensions will get a canvas-size that is absolutely off...

 

Mathias

Share this post


Link to post
Share on other sites
11 minutes ago, Alfred said:

Instead of w+10 in one box and h+10 in the other, try +=10 in both boxes.

If the width/height fields are synced (lock icon) you need just to add the value in one field and it will be applied to both then.


☛ Affinity Designer 1.7.3 ◆ Affinity Photo 1.7.3 ◆ OSX El Capitan

Share this post


Link to post
Share on other sites

Hi v_kyr,

 

no it doesn't...

With an actual canvas size of 1000x667 pixels, actor in the center and synced (lock icon) --> changing value 1000 to +=10 will give me 1010, but 667 will become 673,7 pixels... :-(

 

Mathias

Share this post


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

If the width/height fields are synced (lock icon) you need just to add the value in one field and it will be applied to both then.

No, my guess is that this will scale them both proportionally (maintain the aspect ratio).

N.B. I think that the increment in each case should be 20 (10 each side, centred).

John


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
3 minutes ago, v_kyr said:

Works for me here on OSX.

 

On OSX (10.12.6) not ...

 

2 minutes ago, John Rostron said:

No, my guess is that this will scale them both proportionally (maintain the aspect ratio).

N.B. I think that the increment in each case should be 20 (10 each side, centred).

John

 

Yes...it should be 20, but the effect is still the same...

 

It does not work with different dimensions/ orientations of images in a macro ... 

 

Mathias

Share this post


Link to post
Share on other sites

We've had a similar conversation before, here, and if I remember correctly a macro implementation was given. (Actually, several, but probably the last one given is best.)


-- Walt

Windows 10 Home, version 1909 (183623.476),
   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.7.3.481 and 1.8.0.526 Beta   / Affinity Designer 1.7.3.481 and 1.8.0.526 Beta  / Affinity Publisher 1.7.3.481 and 1.8.0.531 Beta

Share this post


Link to post
Share on other sites
20 minutes ago, walt.farrell said:

We've had a similar conversation before, here, and if I remember correctly a macro implementation was given. (Actually, several, but probably the last one given is best.)

Yes I recall that we had that theme before, but couldn't find that thread again. xD


☛ Affinity Designer 1.7.3 ◆ Affinity Photo 1.7.3 ◆ OSX El Capitan

Share this post


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

Instead of w+10 in one box and h+10 in the other, try +=10 in both boxes.

From what I can tell, Document > Resize Canvas accepts only the "Sizing expression examples" & "Mathematical constants" expressions listed in the Expressions for field input section of Affinity Photo help (so mostly useless things like +=pi*2 or just *1.2 also work fine) but none of the "Relational expression examples" or "Document Variables" work, not even the explicit document forms like spreadwidth or spreadheight.

 

For the ones that do work, fractional px values are not a problem (subject to rounding up or down considerations) because Document > Resize Canvas does round to the nearest pixel. (File > New is slightly different in this respect in that it apparently always rounds dimensions down to the nearest whole pixel value.)

 

Of course, as we have discovered this is of no use for macros because they only store the absolute value an expression creates & not the expression itself, so we have to resort to something like the method involving creating & manipulating a fill layer as discussed in the topic @walt.farrell linked to.

 

Regarding that, the macro provided by @owenr can be generalized a bit by making the "Set effect radius" step adjustable so the 50 (or whatever) default value can be adjusted when the macro is run. I thought the same would be true for the border color by also making the "Set effect color" step adjustable, but that does not seem to work, possibly because the last "Add Fill" step 'bakes in' the current (foreground?) color set when the macro was recorded. It would be nice if the "Add Fill" macro step provided an adjustment for its color but it does not, & all attempts to set a foreground or background color in the macro result in a 'can't record' notice.

 

So if some person cleverer than I am has a solution for that, I would be very interested in hearing what it is.


Affinity Photo 1.7.3, Affinity Designer 1.7.3, Affinity Publisher 1.7.3; 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.3.155 & Affinity Designer 1.7.3.1 for iPad; 6th Generation iPad 32 GB; Apple Pencil; iPadOS 13.1.2

Share this post


Link to post
Share on other sites

Hey guys, the given macros in the other posts are not working for me, like R C-R said.

 

... I get so many "can't record" messages while trying other things...thats really annoying.

 

Btw. "change macro" doesn't really gives me the opportunity to change anything. I can check or uncheck things, I would be much better to have something like a scripting-language...

Share this post


Link to post
Share on other sites
2 minutes ago, der-mathias said:

Hey guys, the given macros in I would be much better to have something like a scripting-language...

So would many others of us!

John


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
2 minutes ago, der-mathias said:

Hey guys, the given macros in the other posts are not working for me, like R C-R said.

Do you mean not at all or just not setting the frame color to anything other than black?


Affinity Photo 1.7.3, Affinity Designer 1.7.3, Affinity Publisher 1.7.3; 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.3.155 & Affinity Designer 1.7.3.1 for iPad; 6th Generation iPad 32 GB; Apple Pencil; iPadOS 13.1.2

Share this post


Link to post
Share on other sites
42 minutes ago, der-mathias said:

I get so many "can't record" messages while trying other things...thats really annoying.

I (& probably others) have asked for a list of either steps that can or cannot be recorded (whichever is easier/shorter) but while one of the staff said they would research that, nothing as yet has come of it. So for now we are on our own with the only alternative being to see what does & does not work. >:(

 

46 minutes ago, der-mathias said:

Btw. "change macro" doesn't really gives me the opportunity to change anything. I can check or uncheck things, I would be much better to have something like a scripting-language...

Well, I don't think there is actually anything provided identified as "change macro" but the "Edit Macro" option leaves a lot to be desired, not the least of which is I have yet to find a way just to save the edit to the original macro instead of creating a new one, ideally with a slightly different name so I can tell which is the original I want to delete. It would also be nice if besides unchecking a step there was a way to delete it completely, but no such luck.

 

What sort of works is to make simpler macros that do less & then make a new macro that calls the appropriate ones as some of its steps, but unless one keeps separate documentation of what each one does & its name, that quickly becomes a nightmare to manage.

 

A scripting language would be ideal & it is something the developers have said they might consider for a future (probably 2.x or 3.x) version, but for the immediate future I think the best we can hope for is a few more recordable steps & better documentation.


Affinity Photo 1.7.3, Affinity Designer 1.7.3, Affinity Publisher 1.7.3; 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.3.155 & Affinity Designer 1.7.3.1 for iPad; 6th Generation iPad 32 GB; Apple Pencil; iPadOS 13.1.2

Share this post


Link to post
Share on other sites

Well personally I can imagine a lot of improvements which would make sense for the overall macro handling here ...

  • include File open/save/place/export capabilities
  • recognition of drag & drop layer movements and repositioning
  • inclusion of custom text messagebox pop up panels (text... ok, text ... continue/stop etc.)
  • single step execution and halt/stop points
  • edit/deletion of intermediate recorded steps
  • various things which arent yet recordable
  • if a scripting lang will ever be implemented, calling/executing selected/loaded scripts from macros and vice versa
  • documentation
  • did I already said documentation? :)
  • ...thousand other things...

☛ Affinity Designer 1.7.3 ◆ Affinity Photo 1.7.3 ◆ OSX El Capitan

Share this post


Link to post
Share on other sites

I don't think directly recording drag & drop layer movements would be practical because different documents can have much different layer structures. So for example, if you recorded moving the lower of two child layers of the third from the top parent layer in some document, that step would not have any meaning in another document that did not have at least three parent layers & the third from the top one did not have at least two child layers. The same problem occurs for most places you could drag & drop a layer to, since different documents would not necessarily have an equivalent place in its layer hierarchy to move the layer to.


Affinity Photo 1.7.3, Affinity Designer 1.7.3, Affinity Publisher 1.7.3; 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.3.155 & Affinity Designer 1.7.3.1 for iPad; 6th Generation iPad 32 GB; Apple Pencil; iPadOS 13.1.2

Share this post


Link to post
Share on other sites

Macros are usually developed from scratch working on an initial one layer loaded or flattened image. So everything else here via layer drag & drop is meant to be recorded for own via the by the macro itself created layers. - See how things work in PS actions for similarities here.


☛ Affinity Designer 1.7.3 ◆ Affinity Photo 1.7.3 ◆ OSX El Capitan

Share this post


Link to post
Share on other sites
2 minutes ago, v_kyr said:

Macros are usually developed from scratch working on an initial one layer loaded or flattened image.

??? I don't think even one in ten of the macros I have seen others post or personally tried to develop into something generally useful on my own necessarily involves single layer documents. Consider for example the macro provided by @owenr linked to earlier in this topic & what he said about the extra steps he added to make it more robust.

19 minutes ago, v_kyr said:

So everything else here via layer drag & drop is meant to be recorded for own via the by the macro itself created layers.

I am not sure what that sentence is supposed to mean or its relevance. Can you explain what you mean in a bit more detail?


Affinity Photo 1.7.3, Affinity Designer 1.7.3, Affinity Publisher 1.7.3; 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.3.155 & Affinity Designer 1.7.3.1 for iPad; 6th Generation iPad 32 GB; Apple Pencil; iPadOS 13.1.2

Share this post


Link to post
Share on other sites

It means you load an image then you start recording and apply adjustment layers, masks etc. as needed for the tasks you want to accomplish. You also rearrange those how you need them via drag & drop etc. Let's say your macro is ready now and it's something like resembling a lomo effect or whatever, you load in an image and apply/run your macro on that one. Though in order for a macro with predefined steps and without any consequent layer namings etc. it will mostly need to be performed on a single layer (background) loaded file here, in order to get not puzzled with the order of creating and rearranging layers then etc. - That's the way recorded layer drag & drop in actions/macros do work mostly. If instead your file already has a bunch of predefined different layers and you want to run a macro with drag & drop operations on that, it can get puzzled due to layer orderings and thus one mostly need to flatten first such files before executing such a macro which uses a bunch of drag & drop layer rearrangements.


☛ Affinity Designer 1.7.3 ◆ Affinity Photo 1.7.3 ◆ OSX El Capitan

Share this post


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

It means you load an image then you start recording and apply adjustment layers, masks etc. as needed for the tasks you want to accomplish.

As I said, most of the user-created macros I have seen posted in these forums are intended for general use on files that can have any arbitrary number of layers and/or ones where flattening them would be unacceptable or undesirable. Quite a bit of discussion has been devoted to ways of accomplishing this, often by targeting layers in some unambiguous generalizable way (like by layer name or relative position in the layer hierarchy) & the shortcomings of the existing macros implementation in this respect (among others).

 

32 minutes ago, v_kyr said:

You also rearrange those how you need them via drag & drop etc

But that's the point: there is no unambiguous way to record which of these layers the macro should drag from one position in the layer hierarchy & drop it at some other position that is not dependent on a specific layer hierarchy, including whichever ones your macro might create. That is why (inadequate as it is) we get those pop up windows when recording asking us to choose a layer based on some generalizable criteria like the nth position from the top, or telling us there is no unambiguous way to choose that layer.

 

So maybe I am still missing something, but I do not see any way of "recognizing" drag & drop steps that could somehow work around this limitation.


Affinity Photo 1.7.3, Affinity Designer 1.7.3, Affinity Publisher 1.7.3; 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.3.155 & Affinity Designer 1.7.3.1 for iPad; 6th Generation iPad 32 GB; Apple Pencil; iPadOS 13.1.2

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

×

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.