Remove Background & Anti Aliasing.

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

Remove Background & Anti Aliasing.

Post by UnixNewbie »

Hello

May I preface this post by stating I am extremely new to ImageMagik.

I want to batch convert a large number of .psd to .psd and .png - and remove the background to leave the background transparent in the process.

A friend who is handy at this sort of thing helped me to create this script:

#!/bin/sh
SOURCE=$1
PNG_NAME=$(basename $SOURCE .psd)
echo "Converting $SOURCE..."
mkdir ../converted_images > /dev/null 2>&1
convert -background transparent "$SOURCE" -flatten ../converted_images/$SOURCE
convert -background transparent "$SOURCE" -flatten ../converted_images/$PNG_NAME.png


The issue is with anti-aliasing - the resultant images have jaggedy edges around the object.

If anyone could repost this script with suggested changes in the script I would really appreciate it - I am still not at a level where I would know where to put the extra commands.
Again - I haver only been learning this stuff for a few weeks now so please excuse any glaring inconstancies - we all have to start somewhere! Many thanks in advance.

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
UnixNewbie
Posts: 7
Joined: 2015-11-20T05:09:45-07:00
Authentication code: 1151

Re: Remove Background & Anti Aliasing.

Post by UnixNewbie »

I assume this is the method: http://tech.natemurray.com/2007/12/conv ... arent.html

Am unable to modify the code to make it work.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Remove Background & Anti Aliasing.

Post by fmw42 »

Perhaps you should post and example input image and your output image to some place such as dropbox.com and post the URL here so we can see exactly what you are trying to do.
Post Reply