Page 1 of 1
Converting EPS to PNG leaving black boarder around png
Posted: 2016-11-20T13:50:47-07:00
by Maddox
When I am trying to convert a series of images from RGBA .eps to png and maintain the source file name. I am getting a black outline on output png. And I am not sure what is causing this.
The command that I am using is below:
convert -density 300 -colorspace RGB "C:\Users\Matt\Logos\*.eps" -background transparent -gravity center -scale 600x600 -extent 600x600 -set filename:original %t -colors 256 %[filename:original].png
Everything else seems to be working fine, but I am left with this strange barely visible boarder.
Any idea on whats causing this or how to fix it would be greatly appreciated.
Here are the output files:
http://imgur.com/a/klQ3C
Thanks!
Re: Converting EPS to PNG leaving black boarder around png
Posted: 2016-11-20T14:13:26-07:00
by Bonzo
And your IM version is?
Re: Converting EPS to PNG leaving black boarder around png
Posted: 2016-11-20T14:34:15-07:00
by Maddox
Bonzo wrote:And your IM version is?
ImageMagick 7.0.3-0 Q16 x64
Re: Converting EPS to PNG leaving black boarder around png
Posted: 2016-11-20T15:02:10-07:00
by fmw42
Can you provide your input EPS file? We cannot test your command without it. Also what is your platform (presumed Windows from your syntax)? Please always provide your IM version and platform with any questions, since syntax may vary.
P.S. Why are you using linear RGB. That would make the image darker. You should be using -colorspace sRGB with current versions of IM.
The "border" around the figure is aliasing probably from the scaling. You would need to extract the alpha channel and blur it a bit to antialias the border edges of your figure. -scale is rather coarse. Perhaps you should try -resize.
Re: Converting EPS to PNG leaving black boarder around png
Posted: 2016-11-20T17:42:02-07:00
by Maddox
Thanks for the response fmw42
Here is the link to one of the eps files I am trying to convert
https://we.tl/uhixSjOCvw
Sorry for not providing my IM Version and platform. I'm running it on Windows 7 and ImageMagick 7.0.3-0 Q16 x64
So I tried the resize command vs the scale command and it seemed to help although the black border is still there. The sRGB vs RGB input definitely helped the color output. I was wondering what was going on there.
I will try to figure out how to extract the alpha channel and blur it slightly to get ride of that black border. Haven't tried this before so if anyone could point me in the right drirection many thanks!
Re: Converting EPS to PNG leaving black boarder around png
Posted: 2016-11-20T18:41:40-07:00
by fmw42
For a single image (windows syntax, I think), try
Code: Select all
magick -density 300 -colorspace sRGB 130.eps ^
-background transparent -gravity center -resize 600x600 -extent 600x600 ^
( +clone -alpha extract -blur 0x0.5 -level 50x100% ) ^
-alpha off -compose copy_opacity -composite ^
-set filename:original "%t" -colors 256 "%[filename:original]_3.png"
Try also -blur 0x1. See which looks better. You can also change the 50 in -level 50x100%.
Re: Converting EPS to PNG leaving black boarder around png
Posted: 2016-11-27T13:24:09-07:00
by Maddox
Thanks fmw42, this works great for individual images, but what would I need change to convert a whole batch of eps files? Just changing the format to *.eps extension doesnt seem to do the trick.
Any advice or something I'm missing here?
magick -density 300 -colorspace sRGB "C:\Users\Maddox\Logos\*.eps" -background transparent -gravity center -resize 600x600 -extent 600x600 ( +clone -alpha extract -blur 0x0.5 -level 50x100% ) -alpha off -compose copy_opacity -composite -set filename:original "%t" -colors 256 [filename:original].png"
Thanks again
Re: Converting EPS to PNG leaving black boarder around png
Posted: 2016-11-27T13:27:07-07:00
by fmw42
You could try mogrify, but I am not sure it handles parenthesis processing. If not, then you will have to write a script loop over each eps image.