c# - How to Change the color of each pixel in a image by using Magick.Net -
i'm new magick.net. tried change color of each pixel in image there's no change in new image. here's code. tell me what's going on? lot.
using system; using system.collections.generic; using system.linq; using system.text; using system.threading.tasks; using imagemagick; namespace magicktutor { class program { static void main(string[] args) { magickimage image = new magickimage(); image.read("c:\\.....\\test1.png"); foreach (pixel p in image.getwritablepixels()) { p.setchannel(0, 65535); } image.write("c:\\.....\\test2.png"); } } }
you should call write method of writablepixelcollection class returned image.getwritablepixels() make sure pixels written image.
you doing in different way:
using (magickimage image = new magickimage()) { image.read(@"c:\.....\test1.png"); image.evaluate(channels.red, evaluateoperator.set, quantum.max); image.write(@"c:\.....\test2.png"); }
Comments
Post a Comment