Quantcast
Channel: magick Discussions Rss Feed
Viewing all articles
Browse latest Browse all 3693

New Post: Setting RGB color values of an image

$
0
0
You should use the Opaque method of MagickImage to do this. You could use the WritablePixelcollection but the Opaque method will be much faster. Your code only changes the pixel at 1x1 so that is probably why you think it is not working.

This will get you the result you are expecting:
using (MagickImage image = new MagickImage(@"E:\Development\DOTNET\PCXEditor\RGBEditor\18975253ee.pcx"))
{
  MagickColor target = new MagickColor(128, 118, 118);
  MagickColor fill = new MagickColor(100, 105, 110);

  image.Opaque(target, fill);

  image.Write(@"E:\Development\DOTNET\PCXEditor\RGBEditor\1897525311-changed.pcx");
}
Note: This example only works with the Q8 version of Magick.NET because that version has pixels in the 0-255 range

Viewing all articles
Browse latest Browse all 3693

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>