JakubCech Posted December 18, 2019 Posted December 18, 2019 Hello, so here is the problem: I have set of files: OldImage0001.jpg, OldImage0002.jpg etc. going to OldImage0252.jpg lets say (252 files) Then I have Mask0001.jpg, Mask0002.jpg etc. going to Mask0252.jpg And finally NewImage0001.jpg, NewImage0002.jpg etc. going to NewImage0252.jpg lets say (252 files) How do I do this: Open OldImage0001.jpg put over NewImage0001.jpg and mask it with Mask0001.jpg - merge everything and produce FinishedImage0001.jpg. Then let this to be done over all 252 image groups? Thank you. Quote
v_kyr Posted December 18, 2019 Posted December 18, 2019 Hello and welcome in the forum, I don't think you will have overall much success here with APh's batch/macro processing. Instead you should look after some tools suited for a usage in more advanced script processing. For example ImageMagick could do what you are after in a shell or batch script or the like. Where an associated script file would then loop over (iterate via an increasing number counter) for the given amount of files and build the needed related string filenames ("OldImage/Mask/NewImage"+nnnn+".jpg"), which are then used (passed over) to an related ImageMagick call. Plain sh/bash for loop ... Quote #!/bin/bashfor i in {1..252}do echo "Number is now $i"done ... with leading zeros like in your above sketched case ... Quote #!/bin/bashfor i in {1..252}do zeronum=$(printf "%04d" $i) echo "Zeronum is $zeronum"done ... that loop will then print out $zeronum as ... Quote 0001 ... 0010 ... 0100 ... 0252 Quote ☛ 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
v_kyr Posted December 19, 2019 Posted December 19, 2019 On a Unix based system (OSX, Linux) and thus with a shell/bash script and the ImageMagick convert tool, the following would perform these tasks ... #!/bin/bash ### Let's use a for loop to iterate 252 times for i in {1..252} do ### Use a variable 'znum' to hold the leading zero numbers representation, aka 0001 - 0252 znum=$(printf "%04d" $i) ### Build vars and assign the right strings for the corresponding JPG filenames to use oldimage="OldImage$znum.jpg" newimage="NewImage$znum.jpg" mask="Mask$znum.jpg" finishimage="FinishedImage$znum.jpg" ### Call the ImageMagick convert tool to process the images convert $newimage $oldimage $mask -composite $finishimage done Quote ☛ 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
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.