Jump to content
You must now use your email address to sign in [click for more info] ×

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

Link to comment
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.10.5 Designer 1.10.5 and Publisher 1.10.5 (mainly Photo), now ex-Adobe CC

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

Link to comment
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

Link to comment
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.10.8 ◆ Affinity Photo 1.10.8 ◆ Affinity Publisher 1.10.8 ◆ OSX El Capitan
☛ Affinity V2.3 apps ◆ MacOS Sonoma 14.2 ◆ iPad OS 17.2

Link to comment
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.10.5 Designer 1.10.5 and Publisher 1.10.5 (mainly Photo), now ex-Adobe CC

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

Link to comment
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

Link to comment
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
Designer, Photo, and Publisher V1 and V2 at latest retail and beta releases
PC:
    Desktop:  Windows 11 Pro, version 23H2, 64GB memory, AMD Ryzen 9 5900 12-Core @ 3.00 GHz, NVIDIA GeForce RTX 3090 

    Laptop:  Windows 11 Pro, version 23H2, 32GB memory, Intel Core i7-10750H @ 2.60GHz, Intel UHD Graphics Comet Lake GT2 and NVIDIA GeForce RTX 3070 Laptop GPU.
iPad:  iPad Pro M1, 12.9": iPadOS 17.4.1, Apple Pencil 2, Magic Keyboard 
Mac:  2023 M2 MacBook Air 15", 16GB memory, macOS Sonoma 14.4.1

Link to comment
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.10.8 ◆ Affinity Photo 1.10.8 ◆ Affinity Publisher 1.10.8 ◆ OSX El Capitan
☛ Affinity V2.3 apps ◆ MacOS Sonoma 14.2 ◆ iPad OS 17.2

Link to comment
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.

All 3 1.10.8, & all 3 V2.4.1 Mac apps; 2020 iMac 27"; 3.8GHz i7, Radeon Pro 5700, 32GB RAM; macOS 10.15.7
Affinity Photo 
1.10.8; Affinity Designer 1.108; & all 3 V2 apps for iPad; 6th Generation iPad 32 GB; Apple Pencil; iPadOS 15.7

Link to comment
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...

Link to comment
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.10.5 Designer 1.10.5 and Publisher 1.10.5 (mainly Photo), now ex-Adobe CC

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

Link to comment
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?

All 3 1.10.8, & all 3 V2.4.1 Mac apps; 2020 iMac 27"; 3.8GHz i7, Radeon Pro 5700, 32GB RAM; macOS 10.15.7
Affinity Photo 
1.10.8; Affinity Designer 1.108; & all 3 V2 apps for iPad; 6th Generation iPad 32 GB; Apple Pencil; iPadOS 15.7

Link to comment
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.

All 3 1.10.8, & all 3 V2.4.1 Mac apps; 2020 iMac 27"; 3.8GHz i7, Radeon Pro 5700, 32GB RAM; macOS 10.15.7
Affinity Photo 
1.10.8; Affinity Designer 1.108; & all 3 V2 apps for iPad; 6th Generation iPad 32 GB; Apple Pencil; iPadOS 15.7

Link to comment
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.10.8 ◆ Affinity Photo 1.10.8 ◆ Affinity Publisher 1.10.8 ◆ OSX El Capitan
☛ Affinity V2.3 apps ◆ MacOS Sonoma 14.2 ◆ iPad OS 17.2

Link to comment
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.

All 3 1.10.8, & all 3 V2.4.1 Mac apps; 2020 iMac 27"; 3.8GHz i7, Radeon Pro 5700, 32GB RAM; macOS 10.15.7
Affinity Photo 
1.10.8; Affinity Designer 1.108; & all 3 V2 apps for iPad; 6th Generation iPad 32 GB; Apple Pencil; iPadOS 15.7

Link to comment
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.10.8 ◆ Affinity Photo 1.10.8 ◆ Affinity Publisher 1.10.8 ◆ OSX El Capitan
☛ Affinity V2.3 apps ◆ MacOS Sonoma 14.2 ◆ iPad OS 17.2

Link to comment
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?

All 3 1.10.8, & all 3 V2.4.1 Mac apps; 2020 iMac 27"; 3.8GHz i7, Radeon Pro 5700, 32GB RAM; macOS 10.15.7
Affinity Photo 
1.10.8; Affinity Designer 1.108; & all 3 V2 apps for iPad; 6th Generation iPad 32 GB; Apple Pencil; iPadOS 15.7

Link to comment
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.10.8 ◆ Affinity Photo 1.10.8 ◆ Affinity Publisher 1.10.8 ◆ OSX El Capitan
☛ Affinity V2.3 apps ◆ MacOS Sonoma 14.2 ◆ iPad OS 17.2

Link to comment
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.

All 3 1.10.8, & all 3 V2.4.1 Mac apps; 2020 iMac 27"; 3.8GHz i7, Radeon Pro 5700, 32GB RAM; macOS 10.15.7
Affinity Photo 
1.10.8; Affinity Designer 1.108; & all 3 V2 apps for iPad; 6th Generation iPad 32 GB; Apple Pencil; iPadOS 15.7

Link to comment
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

Terms of Use | 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.