whether the ps will support the transparency

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
sabique
Posts: 2
Joined: 2011-07-12T02:05:12-07:00
Authentication code: 8675308

whether the ps will support the transparency

Post by sabique »

Dear users,

can we create a ps files with transparent back ground from any other forms of images? whether convert -transparent-color option will work for ps files also?

thank you in anticipation..
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: whether the ps will support the transparency

Post by fmw42 »

IM 6.7.1.0 Q16 Mac OSX Tiger

I have tried to convert an image to ps. It retains the transparency channel, but the transparency value is set to fully opaque. For example:

convert logo: -resize 50% -transparent white logo2t.png -- this displays properly as transparent
convert logo2t.png logo2t.ps

or

convert logo: -resize 50% -transparent white logo2tb.ps

Both ps results show full opaque transparency channel from identify -verbose:


Image: logo2tb.ps
Format: PS (PostScript)
Class: DirectClass
Geometry: 320x240+0+0
Resolution: 72x72
Print size: 4.44444x3.33333
Units: Undefined
Type: TrueColorMatte
Endianess: Undefined
Colorspace: RGB
Depth: 16/8-bit
Channel depth:
red: 8-bit
green: 8-bit
blue: 8-bit
alpha: 1-bit
Channel statistics:
Red:
min: 0 (0)
max: 65535 (1)
mean: 58927.7 (0.899179)
standard deviation: 17277.8 (0.263643)
kurtosis: 4.33324
skewness: -2.45419
Green:
min: 0 (0)
max: 65535 (1)
mean: 58129.5 (0.887)
standard deviation: 17620.4 (0.26887)
kurtosis: 3.13207
skewness: -2.18371
Blue:
min: 0 (0)
max: 65535 (1)
mean: 58860.2 (0.898149)
standard deviation: 15863.4 (0.242059)
kurtosis: 4.07364
skewness: -2.30452
Alpha:
min: 65535 (1)
max: 65535 (1)
mean: 65535 (1)
standard deviation: -0 (-0)
kurtosis: 0
skewness: 0

I get the same kind of result when converting to .pdf as well as .ps!

Note that -transparent-color is not the correct command. The correct way to make some color transparent is to use -transparent somecolor

I am not an expert on .ps files, so cannot say what is going on. Perhaps it is the the device used by the delegates.xml file. This is what I have in my delegates.xml file:

<delegate decode="ps:alpha" stealth="True" command=""gsc" -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 "-sDEVICE=pngalpha" -dTextAlphaBits=%u -dGraphicsAlphaBits=%u "-r%s" %s "-sOutputFile=%s" "-f%s" "-f%s""/>

I would think this would be correct. But I am not sure whether this is for encoding or decoding?

see http://en.wikipedia.org/wiki/Transparen ... PostScript

also see http://www.imagemagick.org/Usage/formats/#ps

One of the IM developers will have to comment further or someone more knowledgable about .ps files.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: whether the ps will support the transparency

Post by fmw42 »

P.S.

I found this to work using encapsulated postscript.

convert logo: -resize 50% -transparent white logo2t3.eps
identify -version logo2t3.eps
Image: logo2t3.eps
Format: PS (PostScript)
Class: DirectClass
Geometry: 320x240+0+0
Resolution: 72x72
Print size: 4.44444x3.33333
Units: Undefined
Type: TrueColorMatte
Endianess: Undefined
Colorspace: RGB
Depth: 16/8-bit
Channel depth:
red: 8-bit
green: 8-bit
blue: 8-bit
alpha: 1-bit
Channel statistics:
Red:
min: 0 (0)
max: 65535 (1)
mean: 58927.7 (0.899179)
standard deviation: 17277.8 (0.263643)
kurtosis: 4.33324
skewness: -2.45419
Green:
min: 0 (0)
max: 65535 (1)
mean: 58129.5 (0.887)
standard deviation: 17620.4 (0.26887)
kurtosis: 3.13207
skewness: -2.18371
Blue:
min: 0 (0)
max: 65535 (1)
mean: 58860.2 (0.898149)
standard deviation: 15863.4 (0.242059)
kurtosis: 4.07364
skewness: -2.30452
Alpha:
min: 0 (0)
max: 65535 (1)
mean: 12422.6 (0.189557)
standard deviation: 25686.5 (0.391951)
kurtosis: 0.509343
skewness: -1.58409


SImilarly,


convert logo2t.png EPS3:logo2t3b.eps

convert logo2t.png EPS3:logo2t3c.ps

Both show transparency
Post Reply