Questions tagged [lockbits]

Part of .NET's System.Drawing Namespace - Bitmap.LockBits Method

Locks a Bitmap into system memory

Docs: https://learn.microsoft.com/en-us/dotnet/api/system.drawing.bitmap.lockbits?view=netframework-4.7

95 questions
-1
votes
2 answers

Locate pixel by color return point

I need to locate the points/cordinates (x,y) of the first pixel it finds with the specified color. I have used the GetPixel() method, but it's a bit too slow and were looking into LockBits. How ever I can't figure out if this actually could solve…
KLIM8D
  • 582
  • 1
  • 8
  • 25
-1
votes
1 answer

LockBits seems to result in wrong stride when copying byte array to bitmap

I'm trying to copy a simple byte array to an 8bit indexed bitmap. Using the exact same code as shown in countless answered questions on many forums, I still get the wrong result. The data I'm trying to write to image files is 360 bytes, setup as…
AntonEagle
  • 19
  • 2
-1
votes
2 answers

Pixel Output Incorrect

I am trying to get all the pixels from a set image using LockBits and iterating through every pixel via for. But i am getting incorrect pixels. I exhilarate more in a second. Code: Bitmap bmp = new Bitmap(ImagePath); pictureBox1.Image =…
rguarascia.ts
  • 694
  • 7
  • 19
-2
votes
1 answer

C#, "?" and ":" operators

I not found any solution for my problem so i ask, how ? and : operators works when i have multiple statemants? What i want to do, i have pixel on the middle pixel[pos] and pixels around, its look like: 0 0 0 0 x 0 0 0 0 x is a center pixel. Im…
user9687180
-2
votes
1 answer

c#.NET - Extracting raw pixel data with lockbits

I'm making a program to automatically perform certain edits on images. One of the functions is converting "white" pixels to "white" and transparent. Initially, all is well. I have managed to convert a 24bppRGB image to a 32bppRGB image with the…
1 2 3 4 5 6
7