Page 1 of 1

Convert PNG to TIFF with Transparency and CMYK

Posted: 2012-11-30T02:20:49-07:00
by Faria
Hi Guys,

I am trying hard to convert PNGs to TIFFs using a Batch File. However, the resulting files lack transparency.

S:\*.*\mogrify -path H:\*.*\blau -format tiff H:\*.*\Raw\*.png
pause
S:\*.*\mogrify -fuzz 20%% -fill blue -opaque black H:\*.*\blau\*.tiff
S:\*.*\mogrify -colorspace cmyk H:\*.*\blau\*.tiff
S:\*.*\mogrify -fuzz 60%% -transparent white H:\*.*\blau\*.tiff

The TIFFs have a white background afterwards which I have verified using PhotoShop. What is wrong here? How can I get the resulting files to not lose transparency?

Re: Convert PNG to TIFF with Transparency and CMYK

Posted: 2012-11-30T11:22:27-07:00
by fmw42
use colors that include the alpha channel. see http://www.imagemagick.org/script/color.php

example rgba(....)

Re: Convert PNG to TIFF with Transparency and CMYK

Posted: 2012-12-04T00:58:26-07:00
by Faria
But theres nothing like CMYKa, is it?
Imagemagick doesnt support RGBA? If i try -colorspace rgba i get an error

Edit:

Tried SRGB... I can see a Black part on the right side now?

Edit Edit:

Here comes the tricky thing: If I do it with convert and only 1 pic at a time it works...!! WHY?!

Code: Select all

convert -transparent white objekt.jpg objekt.tiff

Re: Convert PNG to TIFF with Transparency and CMYK

Posted: 2012-12-04T11:51:35-07:00
by fmw42
But theres nothing like CMYKa, is it?
Yes, you can specify CMYKA colors. But there is no rgba or cmyka colorspace. The alpha is not specified in the colorspace conversion.

See http://www.imagemagick.org/script/color.php

However, for some reason it does not show that. However, you should be able to use the color converter link and get CMYKA values or specify CMYKA values.

This should work if you specify colors as rgba(...)

S:\*.*\mogrify -fuzz 20%% -fill blue -opaque black H:\*.*\blau\*.tiff



I am not sure here why you want to change colorspace?
S:\*.*\mogrify -colorspace cmyk H:\*.*\blau\*.tiff


This won't work as the -transparent will start over creating a new alpha channel
S:\*.*\mogrify -fuzz 60%% -transparent white H:\*.*\blau\*.tiff

Re: Convert PNG to TIFF with Transparency and CMYK

Posted: 2012-12-04T12:10:24-07:00
by Faria
I tried to specify the alpha channel the whole day...

The point is, that if I do it with convert it works without any problems on my desktop... by changing to my network drive it wont work at all! (with mogrify AND convert...)

And I have to change it to cmyk afterwards... maybe I posted a script with a test... ^^


Ahhhh and the color changing from blue to black works perfectly, the TRANSPARENCY doesnt work =(

Re: Convert PNG to TIFF with Transparency and CMYK

Posted: 2012-12-06T02:01:36-07:00
by Faria
I tried now:

Code: Select all

*.*\ImageMagick\mogrify -path \\*.*\blau -format tiff -fuzz 20%% -fill "rgba( 0, 0, 255, 1.0)" -opaque black -fuzz 20%% -transparent white \\*.*\Raw\*.png


*.*\ImageMagick\mogrify -fuzz 60%% -transparent "rgba( 255, 255, 255, 1.0)" *.*\*.tiff





Doesnt work at ALL!! >.< what am I doing wrong... There is no transparency afterwards... even if I try it with 0.0 in the alpha channel

Re: Convert PNG to TIFF with Transparency and CMYK

Posted: 2012-12-06T11:03:20-07:00
by fmw42
post a link to your image, so we can test with it.

also try replacing black in the first command with "rgba(0,0,0,1)"

using -transparent is not going to do what you want as it will destroy your alpha channel and make a new one

Re: Convert PNG to TIFF with Transparency and CMYK

Posted: 2012-12-07T00:43:16-07:00
by Faria
Hi,

I'm not allowed to post one of these pictures as they contain personal information of our clients.. =(


well... but how can I achieve transparency without using -transparent?


with -fill "rgba( 0, 0, 255, 0.0)" -opaque "rgba( 0, 0, 255, 1.0)"?

Re: Convert PNG to TIFF with Transparency and CMYK

Posted: 2012-12-07T11:48:21-07:00
by fmw42
with -fill "rgba( 0, 0, 255, 0.0)" -opaque "rgba( 0, 0, 255, 1.0)"?
That should work to make opaque blue into transparent blue without changing any existing transparency. You may have to add -alpha on -channel rgba before that, but not sure without testing.

I don't recall that you have identified your version of IM or platform. So if you have an old version of IM it may have a bug.

The following works for me.

# create transparency for white
convert logo: -transparent white logo1.png

# add transparency for some shades of blue
convert logo1.png -alpha on -channel rgba -fuzz 30% -fill "rgba(0,0,255,0)" -opaque "rgba(0,0,255,1)" logo2.png


Test that and see if it works for you.