attilam Posted August 28, 2018 Share Posted August 28, 2018 Hello, I'm trying to resize a bunch of images to 50% size (so no absolute values, every image has to be 50% of its original size), but it seems like neither the Batch Job dialog, nor the Macro recorder can deal with this. The Batch Job dialog completely disregards percentages, and the Macro recorder just stores the final resolution _after_ multiplying by percent. Have I missed anything or is this just not possible in Photo? Thanks, Attila Quote Link to comment Share on other sites More sharing options...
Polygonius Posted August 28, 2018 Share Posted August 28, 2018 You can macro your doc-settings. Just type "/2" behind W or H (Take care that the Keep-relation-symbol is on). Save that macro and run it as batch. EDIT: NOPE, that saves ABSOLUT values. You can instead macro that stunt via the the transform panel "/2" behind H and W. That is RELATIVE/perrcentage. But than you have to crop the empty space and cropping will also macro as "absolut"value, not relative. Hm, i do not really know. Quote OSX 12.5 / iMac Retina 27" / Radeon Pro 580X / Metall: on! --- WWG1WGA WW! Link to comment Share on other sites More sharing options...
attilam Posted August 28, 2018 Author Share Posted August 28, 2018 Thanks, yeah, that that's what I came up with too In the end I solved it with ImageMagick in a shell script: find . -type f -exec file {} \; | awk -F: '{if ($2 ~/image/) { cmd="mogrify -resize 50% " $1; print(cmd); system(cmd) }}' Quote Link to comment Share on other sites More sharing options...
John Rostron Posted August 28, 2018 Share Posted August 28, 2018 You can do it in a macro if you use Filter > Distort > Equations. Off the top of my head you just need the two lines: X=x/2 Y=y/2 John Quote 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 More sharing options...
Polygonius Posted August 28, 2018 Share Posted August 28, 2018 Hi John, But this will only resize the selected layer, not the whole file, does it? The problem is the cropping of the WHOLE file???? You can macro the cropping, but this is ABSOLUT???? Quote OSX 12.5 / iMac Retina 27" / Radeon Pro 580X / Metall: on! --- WWG1WGA WW! Link to comment Share on other sites More sharing options...
John Rostron Posted August 28, 2018 Share Posted August 28, 2018 I have only resized flat files using this macro technique, and it does work. You might have to add a Clip Canvas after the resizing (as part of the macro). I do not know what would happen with a layered file. Why not try it and see? Can I re-iterate that using Equations in a macro does not enforce absolute dimensions (unlike Document > Resize or Transform). Indeed, this is the only known way to apply resizing within a macro. John Quote 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 More sharing options...
Polygonius Posted August 28, 2018 Share Posted August 28, 2018 52 minutes ago, John Rostron said: You might have to add a Clip Canvas after the resizing (as part of the macro). Thats the point i struggle. What exactly is clip canvas (not the same as crop????)? And does it work percentage or just absloute? How to find? Quote OSX 12.5 / iMac Retina 27" / Radeon Pro 580X / Metall: on! --- WWG1WGA WW! Link to comment Share on other sites More sharing options...
walt.farrell Posted August 28, 2018 Share Posted August 28, 2018 1 hour ago, Polygonius said: Thats the point i struggle. What exactly is clip canvas (not the same as crop????)? And does it work percentage or just absloute? How to find? Suppose you have an image, and for simplicity assume it just has the background layer. Now suppose you were to unlock that layer (allowing it to be transformed), select the Move tool, open the Transform studio, and change the width to 1/2 of whatever it currently is (with the aspect ratio locked). You should see that you now have a canvas where the transformed image is in the upper left quadrant (roughly), and 3/4 of the canvas is transparent (if you have that option enabled) or white. Now try Document > Clip Canvas. You should now have your transformed image occupying the whole canvas, which has shrunk to the size needed to contain the image pixels. So, in a way, when you use it after a transform operation that shrinks the image, it performs a kind of crop, but only of the parts of the canvas that don't contain part of the image. However, when you use it at other times, it can seem to do other things. E.g., if you perform an actual crop, and then use Clip Canvas you undo the crop. In either case, it is (I think) basically making the canvas just small enough to hold all the non-transparent image pixels. That means shrinking the canvas if you've transformed the image smaller, or enlarging the canvas if you've done a crop but not yet rasterized the image to "finalize" the crop and make it destructive. Quote -- 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 More sharing options...
h_d Posted August 29, 2018 Share Posted August 29, 2018 The Filters-Distort-Equations route suggested by @John Rostron works for me with one significant modification. Somewhat counter-intuitively, the equations are as follows: x=x*2 y=y*2 (Dividing the dimensions by 2 halves the depth and height of the image visible in the document window, giving a quarter of the original image.) Your macro would then need to clip the canvas. I've attached a .afmacro file which shrinks images to 50%. It can be incorporated into a batch process if needed. Make backups before using, and use at your own risk. Half size.afmacro Quote Affinity Photo 2.0.3, Affinity Designer 2.0.3, Affinity Publisher 2.0.3, Mac OSX 13, 2018 MacBook Pro 15" Intel. Link to comment Share on other sites More sharing options...
John Rostron Posted August 29, 2018 Share Posted August 29, 2018 8 minutes ago, h_d said: The Filters-Distort-Equations route suggested by @John Rostron works for me with one significant modification. Somewhat counter-intuitively, the equations are as follows: x=x*2 y=y*2 (Dividing the dimensions by 2 halves the depth and height of the image visible in the document window, giving a quarter of the original image.) Your macro would then need to clip the canvas. I've attached a .afmacro file which shrinks images to 50%. It can be incorporated into a batch process if needed. Make backups before using, and use at your own risk. @h_d, you are quite right. I was writing that message on my tablet, without access to AP on my desktop. I have been confused by that paradox before. One of the mods did explain it to me. As I recall, the expression x=x*2 is interpreted as meaning: for the new pixel at position x, look at the pixel in current position 2*x. It does make writing such equations something of a black art. John Quote 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 More sharing options...
h_d Posted August 29, 2018 Share Posted August 29, 2018 7 minutes ago, John Rostron said: I have been confused by that paradox before. I started off with x=x/0.5 and worked outwards... John Rostron 1 Quote Affinity Photo 2.0.3, Affinity Designer 2.0.3, Affinity Publisher 2.0.3, Mac OSX 13, 2018 MacBook Pro 15" Intel. Link to comment Share on other sites More sharing options...
h_d Posted August 29, 2018 Share Posted August 29, 2018 For extra points, the attached macro exposes the a parameter of the equations x=x*(1/a) and y=y*(1/a) and then clips the canvas, to give a sliding image scaler: Original: Scaled to 0.25 (25%) Hope this helps someone! Image Scaler.afmacro John Rostron 1 Quote Affinity Photo 2.0.3, Affinity Designer 2.0.3, Affinity Publisher 2.0.3, Mac OSX 13, 2018 MacBook Pro 15" Intel. Link to comment Share on other sites More sharing options...
John Rostron Posted August 29, 2018 Share Posted August 29, 2018 4 minutes ago, h_d said: x=x*(1/a) and y=y*(1/a) As a matter of interest, why not just write: x=x/a and y=y/a John h_d 1 Quote 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 More sharing options...
h_d Posted August 29, 2018 Share Posted August 29, 2018 1 minute ago, John Rostron said: As a matter of interest, why not just write: x=x/a and y=y/a Because I'm an English graduate? John Rostron and R C-R 1 1 Quote Affinity Photo 2.0.3, Affinity Designer 2.0.3, Affinity Publisher 2.0.3, Mac OSX 13, 2018 MacBook Pro 15" Intel. 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.