Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6575229
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:21:40+00:00 2026-05-25T15:21:40+00:00

I have a loop that gets pixelcolors from an image and try to see

  • 0

I have a loop that gets pixelcolors from an image and try to see if they are the same as the Color I passed into the method as parameter.

I tried the Equals method but it doesn’t work. I also tried the ToKnown method.
It looks like that match doesn’t work beacuse the values that synthesize the two colors don’t match.

Example:

With GetPixel:

{Name=ff000000, ARGB=(255, 0, 0, 0)}

Color.Black:

{Name=Black, ARGB=(255, 0, 0, 0)}
if (pixelColor.ToArgb().Equals(startingOffsetColor.ToArgb())) { }

The code above works, but I still want to know if there is any better method or any method that can reduce any CPU overhead, because I’m using this inside a loop statement.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T15:21:40+00:00Added an answer on May 25, 2026 at 3:21 pm

    According to MSDN, the Color.Equality Operator…

    …compares more than the ARGB values of the Color structures. It also does a comparison of some state flags. If you want to compare just the ARGB values of two Color structures, compare them using the ToArgb method

    So the method that you are using is correct for comparing the raw values

    EDIT

    .ToArgb() returns an int so you can just use == for comparison, you don’t need to use .Equals() if you find it too verbose.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an array that gets processed through a foreach loop. foreach($images as $imageChoices)
I have a UITableViewController that when loaded gets data from a web-service and stores
I have a program in Python that gets a window handle via COM from
I have a perl variable $results that gets returned from a service. The value
I currently have a database that gets updated from a legacy application. I'd like
I have a process that gets a files from a directory and puts them
I have a app that gets a string from a database and it sets
I have a fairly simple web application that gets a list of items from
I have this simple problem that gets an input from the user using a
I have a loop that reads each line in a file using getline() :

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.