Code: Select all
//small test: just a really small image to debug and check pixel values
using (MagickImage spotImage = new MagickImage(@"C:\test\small-test.TIF"))
{
spotImage.ColorSpace = ColorSpace.CMYK;
using (PixelCollection pc = spotImage.GetPixels())
{
foreach (Pixel p in pc)
{
int chan1 = p.GetChannel(0);
int chan2 = p.GetChannel(1);
int chan3 = p.GetChannel(2);
int chan4 = p.GetChannel(3);
if (chan1 == chan2 && chan2 == chan3 && chan3 == chan4 && chan1 == 0)
{
p.SetChannel(0, 0);
p.SetChannel(1, 100);
p.SetChannel(2, 100);
p.SetChannel(3, 0);
pc.Set(p);
}
}
spotImage.Write(@"C:\test\test.png");
}
I got this "how to", from the following link:
http://stackoverflow.com/questions/3070 ... magick-net
I also created a few vars after the pc.Set(p) to check if the channels were updated, and they were correctly update to the values i defined.
Is there something i'm missing ? I also checked Object Reference on Visual Studio and what i'm doing seems to be correct.
Thanks in advance.