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??
Applying transparency to area outside of clipping path
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Applying transparency to area outside of clipping path
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.
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.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: Applying transparency to area outside of clipping path
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
Here is a link to a sample file: http://www.iquantum.com/download/Bottle.eps
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Applying transparency to area outside of clipping path
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
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?
Am I missing something?
Re: Applying transparency to area outside of clipping path
Try this command:
- convert -colorspace rgb Bottle.eps -thumbnail 150x150 bottle_small.gif
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Applying transparency to area outside of clipping path
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
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?
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Applying transparency to area outside of clipping path
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.