Is creating a Color object for each pixel while using Bitmap.LockBits still faster than using Bitmap.GetPixel for each pixel?
Or maybe creating that Color is the main overhead of Bitmap.GetPixel as compared to the LockBits method?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Color is a struct, not an object. Overhead is negligible.
GetPixel() is so expensive because it has to lock and unlock the bitmap for each individual pixel. With LockBits() you can do it only once for the entire bitmap.