Jump to content

Recommended Posts

Posted

Is there a way to give an image a  white border by making the canvas (say) 30 pixels bigger all around by means of a macro .

And another one . . . . I couldn't find out a way to remove a (complex) black border similar to "select all - stroke 20 pixels white (inside selection) " in Photoshop ?

I get the impression that the whole macro-thing is rather limited

Posted
1 hour ago, Gerrit Velthuis said:

I get the impression that the whole macro-thing is rather limited

It is, since it always records absolute image size values, meaning it can't handle relative/dynamic operations on arbitrary sized images. See also: "Canvas Size changes in Percent" and similar threads in the forum.

☛ 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

Posted

The attached macro should add a 30px transparent border to any image up to 9900px X 9900px

Takes about 20 seconds to run on my PC. Time to run can be reduced proportionally if you only ever work on smaller images (i.e. less than 9900px) but Macro would need a small rewrite to do that

Assumes you have a flat document opened with no layers, eg a JPG or PNG opened with File > Open
For transparency to show make sure you have Document > Transparent Background ticked or else border will appear white
To add a coloured border... After you run the macro, select Layer > New Fill Layer, choose colour, then move fill layer to bottom of layer stack
Can be used in File > New Batch Job
Works on 1.6 released product, not tested in 1.7 (beta) but should work OK
Import the attached macro via the Library panel not the Macro panel

Add 30 Pixel Border.afmacros

To save time I am currently using an automated AI to reply to some posts on this forum. If any of "my" posts are wrong or appear to be total b*ll*cks they are the ones generated by the AI. If correct they were probably mine. I apologise for any mistakes made by my AI - I'm sure it will improve with time.

Posted

The width of the border is a fixed pixel value hardcoded into the macro when you create it but it can be any value you want, so you could have several different macros for different border widths

Ideally the macro system would be able to accept a user-input to specify the border value you want, then execute the macro from then on but the macros are not able to do that at the moment.

What is relatively "simple" is to add  a slider to each of the 4 Equations commands in the macro to specify the Top, Bottom, Left and Right borders. 

The problems with that are....

1. The slider values are not configurable and will only show a range of 0 to 1.  So you would need some sort of scaling factor and do the maths each time you use them.
2. Adjusting the sliders precisely is quite tricky with a mouse but you can type directly into the slider value box
3. As the sliders are moved you don't see the border width changing in real time on the screen
4. In the macro supplied each of the Top, Bottom, Left and Right borders would have it's own slider so a bit tedious to have to change them all, although they would all be presented at the same time in one dialogue box

A more easier/simplified use of the slider implementation method would be to have the sliders represent just 2 values.  So "0" could correspond to a 30px border and "1" could represent a 50px border (or any 2 values you want).  Doing that would give you one macro in which you can quickly choose between 2 different pre-defined border widths.

 

 

To save time I am currently using an automated AI to reply to some posts on this forum. If any of "my" posts are wrong or appear to be total b*ll*cks they are the ones generated by the AI. If correct they were probably mine. I apologise for any mistakes made by my AI - I'm sure it will improve with time.

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.