Page 1 of 1
Applying transparency to area outside of clipping path
Posted: 2009-02-12T14:01:11-07:00
by quantum
Dealing with a Photoshop .eps file:
I am trying to make the area of an image outside of the clipping path (there is only one path in the file) to be transparent and convert this to a .gif file. However, the closest I have achieved is:
convert -size 512x512 c:\image.eps -clip -trim -auto-orient -thumbnail 150x150 c:\image.gif
which results in a trim along flat horizontal/vertical lines closest to the clipping path. However, the clipping path is actually a complex polygon, which leaves portions of the area outside of the clipping path still present.
I've searched this forum, google, etc.. for solutions but have been unsuccessful.
Any ideas??
Re: Applying transparency to area outside of clipping path
Posted: 2009-02-12T17:11:17-07:00
by anthony
The clipping path is very similar to a SVG path, and is applied in that same way.
It may be that it needs an extra attribute known as a fill-rule for the path to be defined correctly.
Can you describe what attributes the path should have in terms described by
http://www.imagemagick.org/Usage/draw/#paths
and the 'fill rules'.
Also an example image will always be helpful so that we can test out and try things.
Either we need to set a different default 'fill-rule' OR your images 'path' is not defined correctly.
NOTE: A good path in the image should fill the same regardless of the fill-rule used.
Re: Applying transparency to area outside of clipping path
Posted: 2009-02-13T10:45:28-07:00
by quantum
Thanks for the quick response. I am not sure of how to describe the path other than in layman's terms, that is to say that the path is used to knock out a portion of the image (the main object/subject of an image) from the image background. It is created manually in Photoshop.
Here is a link to a sample file:
http://www.iquantum.com/download/Bottle.eps
Re: Applying transparency to area outside of clipping path
Posted: 2009-02-13T11:27:58-07:00
by fmw42
quantum wrote:Thanks for the quick response. I am not sure of how to describe the path other than in layman's terms, that is to say that the path is used to knock out a portion of the image (the main object/subject of an image) from the image background. It is created manually in Photoshop.
Here is a link to a sample file:
http://www.iquantum.com/download/Bottle.eps
This gives some errors, but does seem to make a thumbnail with transparent background as gif.
convert -size 512x512 bottle.eps -thumbnail 150x150 bottle_small.gif
Unknown device: bmpsep8
Unrecoverable error: undefined in .uninstallpagedevice
Operand stack:
defaultdevice
Unknown device: bmpsep8
Unrecoverable error: undefined in .uninstallpagedevice
Operand stack:
defaultdevice
convert: Postscript delegate failed `/var/tmp/magick-ifiIq614': No such file or directory @ ps.c/ReadPSImage/742.
convert: bottle.eps: unknown field with tag 40961 (0xa001) encountered. `TIFFReadCustomDirectory' @ tiff.c/TIFFWarnings/526.
To show the background is transparent overlay on blue background:
convert -background lightblue bottle_small.gif -flatten bottle_small_blue.gif
Using IM 6.4.9-4 Q16 Mac OSX Tiger
Re: Applying transparency to area outside of clipping path
Posted: 2009-02-13T12:31:09-07:00
by quantum
I am using IM 6.4.9-3 Q16 (downloaded 6.4.9-4 but -version reports 6.4.9-3) on Windows Server 2003. Tried the same exact commands and did not see any errors but the background is white (not transparent) with both.
Am I missing something?
Re: Applying transparency to area outside of clipping path
Posted: 2009-02-13T12:54:26-07:00
by magick
Try this command:
- convert -colorspace rgb Bottle.eps -thumbnail 150x150 bottle_small.gif
Re: Applying transparency to area outside of clipping path
Posted: 2009-02-13T13:17:59-07:00
by fmw42
magick wrote:Try this command:
- convert -colorspace rgb Bottle.eps -thumbnail 150x150 bottle_small.gif
For me this now works without the error messages and gives a transparent background.
convert -size 512x512 -colorspace rgb Bottle.eps -thumbnail 150x150 bottle_small.gif
Note the background will look white if you just display the image in a browser with a white background. That was why I overlaid it on a blue background in my other example.
Re: Applying transparency to area outside of clipping path
Posted: 2009-02-13T13:20:38-07:00
by quantum
magick wrote:Try this command:
- convert -colorspace rgb Bottle.eps -thumbnail 150x150 bottle_small.gif
That was it! Is this a Windows specific issue with colorspaces?
Re: Applying transparency to area outside of clipping path
Posted: 2009-02-13T13:23:28-07:00
by fmw42
quantum wrote:magick wrote:Try this command:
- convert -colorspace rgb Bottle.eps -thumbnail 150x150 bottle_small.gif
That was it! Is this a Windows specific issue with colorspaces?
Probably not. Perhaps the eps had the image as CMYK and it needed to be converted to RGB. Magick can explain properly, though.