Batch convert .psd and make background transparent.

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
UnixNewbie
Posts: 7
Joined: 2015-11-20T05:09:45-07:00
Authentication code: 1151

Batch convert .psd and make background transparent.

Post by UnixNewbie »

Hello All,

I am looking to batch convert 300 x .psd files. The resulting output needs to be:

300 x .psd files with the alpha channel made transparent
300 x .png - flattened.

All files need to retain their original names (prefix).

Example of that I have been trying to combine something like this: $ convert file.psd -flatten file.png

with something like this: $ convert *.psd -alpha opaque *.psd

As stated - only started learning this stuff a few weeks ago so apologies if the above seems stupid!

I have navigated to the correct directory in Terminal. My question is how can I combine these operations to batch convert the files and output the ne .psd and .png with the original file prefix.

Thanks in advance.


I am very new to Unix. Using Terminal in OSX. Have installed Brew and ImageMagick:

Version: ImageMagick 6.9.2-6 Q16 x86_64 2015-11-19 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2015 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Features: Cipher DPC Modules
Delegates (built-in): bzlib freetype jng jpeg ltdl lzma png tiff xml zlib
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Batch convert .psd and make background transparent.

Post by snibgo »

The resulting output needs to be: ... 300 x .psd files with the alpha channel made transparent

convert *.psd -alpha opaque *.psd
You say you want them transparent, but you make them opaque????
snibgo's IM pages: im.snibgo.com
UnixNewbie
Posts: 7
Joined: 2015-11-20T05:09:45-07:00
Authentication code: 1151

Re: Batch convert .psd and make background transparent.

Post by UnixNewbie »

Ah sugar, there you go - first issue with being so new to this. I copied the wrong code across. I meant $ convert .psd -alpa transparent *.psd is what I mean. Sorry!
UnixNewbie
Posts: 7
Joined: 2015-11-20T05:09:45-07:00
Authentication code: 1151

Re: Batch convert .psd and make background transparent.

Post by UnixNewbie »

Ah sugar, there you go - first issue with being so new to this. I copied the wrong code across. I meant $ convert *.psd -alpha transparent *.psd is what I mean. Sorry! Thanks for taking the time to respond.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Batch convert .psd and make background transparent.

Post by snibgo »

Next problem:

Code: Select all

convert *.psd ...{etc}
This will read all the PSD files in the directory, holding them all in memory at the same time, and then write them out as ... well, I'm not sure what name it will give the single output file.

I guess you really want to change each PSD file, overwriting it. You could use one convert command per file, and name the file explicitly. Or use mogrify, but I know very little about that.

I'm not sure why you want to make each PSD file fully transparent. Nothing wrong with doing this, if that's what you really want. See http://www.imagemagick.org/script/comma ... .php#alpha
snibgo's IM pages: im.snibgo.com
UnixNewbie
Posts: 7
Joined: 2015-11-20T05:09:45-07:00
Authentication code: 1151

Re: Batch convert .psd and make background transparent.

Post by UnixNewbie »

Hi Snibgo. Thanks, will have a look and come back to you maybe. Cheers!
UnixNewbie
Posts: 7
Joined: 2015-11-20T05:09:45-07:00
Authentication code: 1151

Re: Batch convert .psd and make background transparent.

Post by UnixNewbie »

No my apologies again. I want to fully remove the background from each .psd - leaving it transparent.
Post Reply