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

Macro distorting proportions


Recommended Posts

Hello. I created a macro that first resizes the image to 1,000 pixels on the long side and then cuts the canvas to 660 pixels. The thing is that when I do the process manually on an image it does it fine, but when I run the macro it distorts the proportions in almost all cases. Why does that happen? I am attaching the two macros (one for vertical and one for horizontal) in case it helps. Thanks in advance.

1000x660 macro.afmacro 660x1000-macro.afmacro

Link to comment
Share on other sites

Macros record the final numeric results, and thus actions like that kind of resizing can only be applied to images of the same aspect ratio.

You will need to use the Filters > Distort > Equations function to do that kind of resizing. Luckily, other users have already provided macros for that which you could use directly or as a model :)

 

A search for these (and more): https://forum.affinity.serif.com/index.php?/search/&q=macro resize&quick=1&type=forums_topic&nodes=11

-- 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

You're welcome.

-- 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

1 hour ago, nachoespino said:

I created a macro that first resizes the image to 1,000 pixels on the long side and then cuts the canvas to 660 pixels. The thing is that when I do the process manually on an image it does it fine, but when I run the macro it distorts the proportions in almost all cases. Why does that happen? I am attaching the two macros (one for vertical and one for horizontal) in case it helps.

Why not try using File > New Batch Job... to resize the image(s) to 1000 pixels and have the Batch Job run a macro which cuts the canvas to 660 pixels.

Mac Pro (Late 2013) Mac OS 12.7.4 
Affinity Designer 2.4.1 | Affinity Photo 2.4.1 | Affinity Publisher 2.4.1 | Beta versions as they appear.

I have never mastered color management, period, so I cannot help with that.

Link to comment
Share on other sites

Assuming your goal is to resize images to 1000w or 1000h then crop to the middle 660px of the height/width
If all of your images have the same aspect ratio then you have a chance with Photo macros otherwise forget it
Use new batch job with
1000 in the width box
1000 in the height box
Leave A ticked
Run this and all your images will be 1000w or 1000h. Note that this will upsize small images in which case use min(1000,w) and min(1000,h) respectively

Now you need two macros, one for landscape, one for portrait, use the outputs from the batch job to create these
For the landscape images it just needs to crop the picture to 660 high and this should default to cutting out the centre 660px
I would then apply some unsharp mask as sharpening is generally required after resizing. Do similar for the portrait images but crop the width
Until Photo gets scripting then I think this is about it

Or you could use imagemagick which is excellent for batch work and will deal with different aspect ratios, just write some gibberish like this
magick input.tif -resize 1000x -gravity center -crop x660+0+0 -unsharp 0x0.4 output.tif
magick input.tif -resize x1000 -gravity center -crop 660x+0+0 -unsharp 0x0.4 output.tif

You can use these commands one at a time or else in a powershell file where you can find width & height and run the appropriate command. Otherwise use Python and it'll also work on Macs

Microsoft Windows 11 Home, Intel i7-1360P 2.20 GHz, 32 GB RAM, 1TB SSD, Intel Iris Xe
Affinity Photo - 24/05/20, Affinity Publisher - 06/12/20, KTM Superduke - 27/09/10

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.