Replace all pixels on a image with an specific color
Posted: 2017-04-06T06:18:52-07:00
Hello everyone.
I have an image, that is just an empty square.
The image is a TIFF Grayscale, an negative of an specific CMYK color.
This CMYK color, is composed by (example):
0% C
30% M
20% K
0% Y
I know i can't create an CMYK color on the .NET interface, however, i've found the following calculation:
R = 255 * (1-C) * (1-K)
G = 255 * (1-M) * (1-K)
B = 255 * (1-Y) * (1-K)
This way, i could convert the CMYK color to RGB.
Does MagickNET offers some interface to do this convertion (instead of manually doing all calculations) ?
PS: The values for the CMYK color come from a txt file, so they'll always be there.
Basically what i'm trying to achieve, is an faster way to scan trough all image pixels and replace all pixels that aren't white with this specific color.
Also, i'm worried about one last thing: i want to combine the final image with another existent image, but without losing any of its data.
Can i just use the Combine() method of MagickNET, or do i have to replace the specified pixels (that aren't white pixels) in the destination image with pixels from source image(the one with specific color) ?
Thanks in advance.
I have an image, that is just an empty square.
The image is a TIFF Grayscale, an negative of an specific CMYK color.
This CMYK color, is composed by (example):
0% C
30% M
20% K
0% Y
I know i can't create an CMYK color on the .NET interface, however, i've found the following calculation:
R = 255 * (1-C) * (1-K)
G = 255 * (1-M) * (1-K)
B = 255 * (1-Y) * (1-K)
This way, i could convert the CMYK color to RGB.
Does MagickNET offers some interface to do this convertion (instead of manually doing all calculations) ?
PS: The values for the CMYK color come from a txt file, so they'll always be there.
Basically what i'm trying to achieve, is an faster way to scan trough all image pixels and replace all pixels that aren't white with this specific color.
Also, i'm worried about one last thing: i want to combine the final image with another existent image, but without losing any of its data.
Can i just use the Combine() method of MagickNET, or do i have to replace the specified pixels (that aren't white pixels) in the destination image with pixels from source image(the one with specific color) ?
Thanks in advance.