Private int Y1 = 0 // picture box 1 mouse click y position Private int X1 = 0 // picture box 1 mouse click X position The code listed below contains a bare bone example on how to create a pixel image editor using the C# programming language on Microsoft Visual Studio 2022. I would suggest looking at that rather than what I have posted if performance is a concern. Marc's post notes LockBits and using that to modify the image directly in memory. The darker it is, the more the diff.): public static Bitmap Diff(Bitmap src1, Bitmap src2, int x1, int y1, int x2, int y2, int width, int height)īitmap diffBM = new Bitmap(width, height, PixelFormat.Format24bppRgb) Ĭolor col1 = src1.GetPixel(x1 + x, y1 + y) Ĭolor col2 = src2.GetPixel(x2 + x, y2 + y) Ĭolor newcol = Color.FromArgb(dif, dif, dif) ![]() It takes two images and produces a third greyscale image showing the differences between the two images as a greyscale tone level. ![]() ![]() A sample code routine (I use this for simple merge and compare functionality.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |