GraphicsMagick replace all colors (except yellow) to transparent - graphicsmagick

Tried to replace all colors except yellow (with some -fuzz) to transparent without result. Didn't find anything in documentation maybe someone can help me.
Thank you.
As I know in ImageMagic there is +opaque, but I can't use this library

This should do what you want. It makes the yellow pixels transparent and then inverts the alpha channel.
gm convert input.png +matte -matte -fuzz 5% -transparent yellow -operator matte negate 1 output.png
The "+matte" removes any existing transparency that might be in the input.png, then "-matte" adds an opaque alpha channel.
Tested with GraphicsMagick-1.3.20.

Related

Hex Colors - How to Calculate from 1 Color to Another

I work on .LESS and I am looking for a method how calculate from a hex color to another.
For example: I have #000000, then I do some calculations (lighten, or darken, or mix...) somehow finally it will become #657177.
Let's say:
#header-background: #000000;
#tags: lighten(#header-background, 30%);
I have tried many percentage numbers, but I couldn't get exactly from #000000 to #657177.
Please give a hand.
Thanks!
Try using http://www.w3schools.com/colors/colors_picker.asp since you know what color you are looking for, and it can give you the percentage difference.

Is there a formula to get distinct colors in RGB representation

A color can be represented as mixture of Red,Green and Blue.
Ex: (255,51,153)=pink
Is there an any good formula to get distinct colors by changing one variable?
such as (10x,22x,2x^2). So when x=1,2,3,4,.... It will give separate colors like Red,Green,Cyan,Blue.....etc.
Perhaps you'd be more interested in using HSL/HSV colors. Define the saturation and lightness and adjust the hue to get different colors. Check out the HSL and HSV wiki to learn more. A 15 to 30 degree adjustment of hue will result in a distinctly different color without messing with saturation or lightness.
An example of hsl in CSS is as follows.
<h1 style="color:hsl(0,50%,100%);">HSL Test</h1> //this will be red
The first value at 0 is red and advancing by 120 degrees will bring you to green and another 120 will bring you to blue and the last 120 will bring you back to red since the degree system is based on the 360 degrees of a circle. So 0 and 360 are the same just 60 & 420. The next two values are percentage based from 0% to 100% to define the intensity of that property. They're hard to explain so I made a quick fiddle that demonstrates this.
So to answer your question there is a good formula to adjust color it just depends on how exactly you want to change it. In the RGB world you can make things darker by lowering values uniformly and the opposite by heightening them. You can increase the different color presences by adjusting the individual color values as expected. However if you're trying to cycle the entire color wheel then this is difficult (although entirely possible) using RGB values. The real lesson to take away is that there are a number of ways to define a specific color and with each one different ways to traverse the spectrum. HSL and HSLA are very intuitive for many people since it's values don't really have to be guessed at. Pick a specific hue off the color wheel, Remember ROYGBIV as you imagine a value from 0-359. Define a saturation based on how bold you want the color to be and then a lightness based on how bright. It's far more useful then RGB in the large majority of cases as you'll see in that fiddle. Making a subset of the entire color spectrum with javascript only takes a few lines of code.
There is a similar question here
This javascript library can help you Name the Color Javascript Lib
A Demo of the library

Why do 3 digit hex css colors convert to 6 the way they do?

I'm aware that the method to convert a 3 digit hex css color to 6 digit code is by duplicating each hex digit once, as below.
#ABC === #AABBCC
Why does it work this way? Why isn't #ABC equivalent to #A0B0C0?
From the W3C spec:
The three-digit RGB notation (#rgb) is converted into six-digit form (#rrggbb) by replicating digits, not by adding zeros. For example, #fb0 expands to #ffbb00. This ensures that white (#ffffff) can be specified with the short notation (#fff) and removes any dependencies on the color depth of the display.
You can read more about it here: http://www.w3.org/TR/css3-color/
The reason is to be able to code the full range of colors (able to do both the highest and lowest color). For example, if #RGB became #R0G0B0, then #fff would become #f0f0f0, meaning you cannot code white. Conversely, if #RGB became #RfGfBf, then #000 would be #0f0f0f, ruling out black. The system of #RGB = #RRGGBB allows for #000 = #000000 (black) and #fff = #ffffff (white), giving a full range of evenly-spaced colors.
Read more at:
Wikipedia article
W3 Website

#FFFFFF or "white" in CSS?

Is there a difference between #FFF (#FFFFFF) and white in CSS? Is one better than the other?
All are supported in the major browsers. It comes down to whichever unjustifiable, deep-seated prejudice you personally have for/against hexadecimal/the English language.
They're all guaranteed to be the same. CSS 3 Color Module (a Proposed Recommendation) defines white as #ffffff.
It later says that values like #rgb are converted to #rrggbb:
The three-digit RGB notation (#rgb) is
converted into six-digit form
(#rrggbb) by replicating digits, not
by adding zeros. For example, #fb0
expands to #ffbb00.
That means that #fff is equivalent to #ffffff (by doubling).
there is no difference. I would imagine browsers take "white" and translate it to "#FFFFFF" in the background. its just a matter of personal coding style which you will use. I prefer using hash because its easier to read and recognise as a colour
Technically, there is no real difference. See this list of supported color names by all major browsers. Of course, some will have a preference to one way or the other but for me as long as you keep it consistent it doesn't matter.
I know this question is very old, but Iam trying to explain with my explanation for the new people.
you can use #F instead of #FF only if there are two same characters followed by each other. Example:#00FF00 you can use instead #0F0. That means #F = #FF or #0 = #00 etc...

How to let gdi/gid+ object (pen\brush\rect\region etc.) semi-transparent?

I want draw multi layer in DC. each layer have some gdi/gdi+ object and semi-transparent with the underlayer.
Using the function SetROP2 with the argument R2_MASKPEN is a very simple way to get a transparent pen effect.
you need to use the ARGB system for coloring. A represents transparency, it takes a value between 0 and 255. a value of 125 is semi transparant

Resources