Page 1 of 1

Copying name from image_A to Output file - naming convention Issue

Posted: 2015-07-22T07:55:54-07:00
by bielsen
Hello ImageMagick Community!

Recently I was looking for a tool that could combine certain attributes from two different images (in my example it was copying alpha channel from image_Alpha to image_Beauty). I've managed to solve this issue with usage of convert tool from IM and the line of code look's like this:

convert.exe image_A_Beauty.png image_A_Alpha.png -alpha Off -compose CopyOpacity -composite image_A_Output.png
convert.exe image_B_Beauty.png image_B_Alpha.png -alpha Off -compose CopyOpacity -composite image_B_Output.png
and so on...

Everything works as it should but I want to automate this process somehow. The goal of my task is to find a solution on how to save output file in a certain location, and the Output file should have the exact same name as file without alpha channel (image_A.png - without the _Beauty extension in the naming).

I'm not fluent at all in batch commands - up till now I was using not too complex commands just to automate some rendering processes in maya and in after effects :) Any help or an example is more than welcome.

I'm using ImageMagick-7.0.0-0-portable-Q16-x64 under Win7Enterprise Sp1

Thank you,
Peter

Re: Copying name from image_A to Output file - naming convention Issue

Posted: 2015-07-22T09:22:09-07:00
by fmw42
I do not think there is any simple way to do this in IM. You likely will need to learn window batch scripting so you can loop over each image and control the output name and location. However, I am not a Windows users, so do not know how to do this in Windows.

There is a new internal scripting method in IM 7, as noted in http://imagemagick.org/script/porting.php#cli, but I have not seen any examples to detail how that works.

Re: Copying name from image_A to Output file - naming convention Issue

Posted: 2015-07-22T12:50:52-07:00
by snibgo
This seems to be a question about scripting in Windows.

I think BAT is probably easiest to learn. There are plenty of resources on the web about writing BAT scripts. Alternatives include Powershell (which may already be installed on your Windows computer) and bash (which is available through Cygwin).