Page 1 of 1

Help with transparency to a newbie

Posted: 2018-07-20T18:34:31-07:00
by hrqmonteiro
Hi i'm using this code i found on the net which uses ImageMagick:

Image

And on this field who generates that background, if i clear it the whole background becames full transparent, but what i wanted to do is to set the image to match my terminal, which uses the color #000 with 70% opacity. Is there a way to do it? I tried to fint through the search engine but every code i tried (some like this: \( -alpha set -channel A -evaluate set 60% \) -draw "image over 169,555 875,109 'img1.png'") but it didnt work, can someone help me please?

Re: Help with transparency to a newbie

Posted: 2018-07-20T19:12:46-07:00
by fmw42
You can specify the color as hex with alpha values by adding two more characters or better you can use rgba(r,g,b,a) values in your command. See http://www.imagemagick.org/script/color.php

________________

Please, always provide your IM version and platform when asking questions, since syntax may differ. Also provide your exact command line and if possible your images.

See the top-most post in this forum "IMPORTANT: Please Read This FIRST Before Posting" at http://www.imagemagick.org/discourse-se ... f=1&t=9620

If using Imagemagick 7, then see http://imagemagick.org/script/porting.php#cli


For novices, see

http://www.imagemagick.org/discourse-se ... f=1&t=9620
http://www.imagemagick.org/script/comma ... essing.php
http://www.imagemagick.org/Usage/reference.html
http://www.imagemagick.org/Usage/
https://github.com/ImageMagick/usage-markdown

Re: Help with transparency to a newbie

Posted: 2018-07-20T19:19:25-07:00
by hrqmonteiro
fmw42 wrote: 2018-07-20T19:12:46-07:00 You can specify the color as hex with alpha values by adding two more characters or better you can use rgba(r,g,b,a) values in your command. See http://www.imagemagick.org/script/color.php

________________

Please, always provide your IM version and platform when asking questions, since syntax may differ. Also provide your exact command line and if possible your images.

See the top-most post in this forum "IMPORTANT: Please Read This FIRST Before Posting" at http://www.imagemagick.org/discourse-se ... f=1&t=9620

If using Imagemagick 7, then see http://imagemagick.org/script/porting.php#cli


For novices, see

http://www.imagemagick.org/discourse-se ... f=1&t=9620
http://www.imagemagick.org/script/comma ... essing.php
http://www.imagemagick.org/Usage/reference.html
http://www.imagemagick.org/Usage/
https://github.com/ImageMagick/usage-markdown
I'm using ImageMagick 7 and writing like this really dont work, and i've looked through this page you sent before posting in here, where do i find a way to do it on ImageMagick 7? Can you be more specific? As i said i would like to set 70% transparency, thats all

Re: Help with transparency to a newbie

Posted: 2018-07-20T19:30:24-07:00
by hrqmonteiro
Can't someone just say to me which line i write after the background to make it 70% transparent, please?

Re: Help with transparency to a newbie

Posted: 2018-07-20T19:36:34-07:00
by fmw42
hrqmonteiro wrote: 2018-07-20T19:30:24-07:00 Can't someone just say to me which line i write after the background to make it 70% transparent, please?
what i wanted to do is to set the image to match my terminal, which uses the color #000 with 70% opacity

Hex #000 is black and the same as rgb(0,0,0). But you want to have it with 70% opacity.

Code: Select all

"rgba(0,0,0,0.7)"
keep the quotes in on Unix.

Re: Help with transparency to a newbie

Posted: 2018-07-20T19:42:49-07:00
by hrqmonteiro
fmw42 wrote: 2018-07-20T19:36:34-07:00
hrqmonteiro wrote: 2018-07-20T19:30:24-07:00 Can't someone just say to me which line i write after the background to make it 70% transparent, please?
what i wanted to do is to set the image to match my terminal, which uses the color #000 with 70% opacity

Hex #000 is black and the same as rgb(0,0,0). But you want to have it with 70% opacity.

Code: Select all

"rgba(0,0,0,0.7)"
keep the quotes in on Unix.
Didn't work

Image

Re: Help with transparency to a newbie

Posted: 2018-07-20T19:50:21-07:00
by hrqmonteiro
Man i just wanted it to match the colors... wouldnt it be possible?...

Re: Help with transparency to a newbie

Posted: 2018-07-20T19:52:11-07:00
by fmw42
If the background is not transparent enough, then change to

Code: Select all

"rgba(0,0,0,0.3)"
Note that if you are saving to JPG, JPG does not support transparency. You will need to save to PNG or TIFF.

Try these two simple commands. Do either give the background you want?

Code: Select all

convert rose: -gravity center -background "rgba(0,0,0,0.7)" -extent 150x150 result1.png
convert rose: -gravity center -background "rgba(0,0,0,0.3)" -extent 150x150 result2.png

If that does not work, then please clarify exactly what you want changed and where.

Re: Help with transparency to a newbie

Posted: 2018-07-20T19:52:38-07:00
by fmw42
hrqmonteiro wrote: 2018-07-20T19:50:21-07:00 Man i just wanted it to match the colors... wouldnt it be possible?...
Are you sure you know exactly what the color is that you want to match?

Re: Help with transparency to a newbie

Posted: 2018-07-20T20:02:08-07:00
by fmw42
I cannot read your screen snap very well. Did you use

rgbo(0,0,0,0.7) with an O after rgb

or

rgba(0,0,0.0.7) with an A after rgb

O is incorrect. A is correct.