Page 1 of 1

Background Removal Save File

Posted: 2017-08-22T13:32:07-07:00
by Pqdy
Hello all and thank you for your time and consideration.

OS: Windows 10
Version: ImageMagick 7.0.6-9 Q16 x64 2017-08-21 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2015 ImageMagick Studio LLC

My goal is to take a folder of PNG images, remove three colors from the background and leave transparent. Ideally I would like them saved to a new folder.

Starting Image: https://drive.google.com/open?id=0B0xHg ... jJuMzdEU3c
Desired Image: https://drive.google.com/open?id=0B0xHg ... jZHdVQtQkk

After searching through forums, tutorials, IM website, examples and the reference index I have come up with this:

C:\Users\pqdyp\Desktop\Landscapecopy>FOR %G IN (*.png) DO Magick "%G -alpha set -transparent #00FFFF -transparent #FF00FF -transparent #FF96FF Batch\%G

Resulting Error: Invalid argument or not enough arguments

It does scroll through all .png files in folder so the first part seems right. I have toyed around with it and yielded different errors. I suspect that I am not saving the output images correctly. I have tried including the full path to desired folder:

C:\Users\pqdyp\Desktop\Batch\%G

I have tried interchanging "magick" with "convert" the later leads to a list of operations usable by Image Magick being displayed.

what am I missing to make this work?

Thank you

Re: Background Removal Save File

Posted: 2017-08-22T13:42:52-07:00
by snibgo
You have a single lonely quote. Quotes usually go in pairs.

Re: Background Removal Save File

Posted: 2017-08-22T14:25:46-07:00
by Pqdy
Thank you for your reply snibgo,

Ah yes, a byproduct of my tinkering. By removing the lonely quote I am left with the error:

Magick: unable to open image 'Batch\AVLrf110.png': No such file or directory @ error/blob.c/OpenBlob/3109.
Magick: WriteBlob Failed `Batch\AVLrf110.png' @ error/png.c/MagickPNGErrorHandler/1711.

This is what led me to believe that I am not saving the files correctly. I love the learning process but I just can't seem to figure this out.

Re: Background Removal Save File

Posted: 2017-08-22T15:22:09-07:00
by snibgo
Does the directory "Batch" exist?

Re: Background Removal Save File

Posted: 2017-08-22T17:06:13-07:00
by Pqdy
Yes but as you say that, perhaps it needs to be located in the same directory as the images as I have started everything there.
When I return home I will try that.
Again thank you for your help.

Re: Background Removal Save File

Posted: 2017-08-22T17:38:19-07:00
by snibgo
If the directory "Batch" doesn't exist as a subdirectory of where you are running the command, it won't work. Create the directory first.

Re: Background Removal Save File

Posted: 2017-08-23T04:14:54-07:00
by Pqdy
Thank you so much snibgo!

Once I moved the batch folder into the same folder as the images it worked perfectly.
600+ images edited in seconds! Simply marvelous!

Thread Complete