Page 1 of 1
How to add transparent channel
Posted: 2012-03-13T02:59:57-07:00
by VanGog
Hello,
I make a conversion of a few pdf files to images (gif or png) by this command
Code: Select all
convert -density 300 doc.pdf[84-93] -quality 100%% "d.png"
and I would like to convert white color to transparent) and to add an alpha channel with 50% of transparency.
Just note: I am going to place this image over table in Excel document, so numbers which are in table, will be still visible. I hope you can help me to find solution.
Re: How to add transparent channel
Posted: 2012-03-13T09:47:13-07:00
by fmw42
So do you want white converted to 50% transparency or everything at 50% transparency or something else. Please clarify.
Re: How to add transparent channel
Posted: 2012-03-13T10:49:48-07:00
by VanGog
I don't know how to describe. I have two maps. One is PNG and I have already edited it. I did this:
1) converted background to layer
2) selected white color and deleted it
3) set transparency to whole layer
The same I need to do with the PDF map (it is different map, but the thing I want to do is same).
Re: How to add transparent channel
Posted: 2012-03-13T11:33:09-07:00
by fmw42
try this with the IM internal logo: image.
convert logo: logo.pdf
convert logo.pdf -alpha set -channel a -evaluate set 50% +channel logo2.png
or
convert logo.pdf -transparent white \
\( +clone -channel a -separate +channel -negate -fill "gray(50%)" -opaque black \) \
-compose over -alpha off -compose copy_opacity -composite logo3.png
or
convert logo.pdf -transparent white \
\( +clone -channel a -separate +channel -negate -fill "gray(50%)" -opaque white \) \
-compose over -alpha off -compose copy_opacity -composite logo4.png
Do any of the above do what you want?
Re: How to add transparent channel
Posted: 2012-03-13T13:23:21-07:00
by VanGog
Thanks but this is not the effect I need. The last two command completely remove colors, and the first one makes the image very low contrast. Can you do this:
- select white color
- delete it (empty places should stay in image instead pixels with color).
- select layer and make it 50% transparent.
But I can do it in different way too. I think it will be faster to convert the pdf to image and then to edit it manually.
Re: How to add transparent channel
Posted: 2012-03-13T14:26:38-07:00
by VanGog
I gave you bad instruction, sorry. I realized that I need just to delete the white color, not to set the transparency (for the visibility would be bad). I think your first command is OK. But I have this problem.
I used this command to conversion of the pdf:
Code: Select all
convert.exe -density 400 -quality 100%% icaoa2010anadstavba.pdf map_CR.jpg
And I cannot finish it because I have no more memory.
So I used
Code: Select all
convert.exe -density 300 -quality 100%% icaoa2010anadstavba.pdf map_CR.jpg
To convert it. But then I must to crop the map and resize it to 2764x1651. During the resize the quality gets down so the text is bad readable and the lines are bad visible. Is it possible to resize the image in vectors before coversion to raster? I don't know the exact size because I must crop it. I already have one image cropped and resized but it is in my computer.
The image pdf original is here:
http://www.aecr.cz/download.php?file=up ... stavba.pdf
So now the convertion and resize has higher priority.
Re: How to add transparent channel
Posted: 2012-03-13T17:39:18-07:00
by fmw42
IM will convert to raster, as I understand it, before doing anything else. But I will defer to the IM developers to correct this if I am wrong.
Re: How to add transparent channel
Posted: 2012-03-14T13:04:50-07:00
by VanGog
Finally, I did help myself. I converted the file to raster and then I did coversion to vectors by hand. I know this is stupid, But I was just trying what it will do if I will resize the vectors.... and the quality was not much good when I resized the vectors. So I had three vector layers with three colors and then I had add just a little sharp glow to the layer with characters so it looks a little bit sharper. My problem was that I have the maps - one is little size in raster and it is good readable but it seems not to be precise, So I found the second map in vectors, but after resize, it was not so good to read it. So finally I removed the white color and have now two maps and I must test which is more precise.