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 6112463
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T14:44:53+00:00 2026-05-23T14:44:53+00:00

There are numerous tutorial on the web on how to capture and save a

  • 0

There are numerous tutorial on the web on how to capture and save a screenshot using C#.
For example, I used this website to obtain my solution:

        using (var screenshot = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height, PixelFormat.Format32bppArgb))
        using (var g = Graphics.FromImage(screenshot))
        {
            g.CopyFromScreen(Screen.PrimaryScreen.Bounds.X, Screen.PrimaryScreen.Bounds.Y, 0, 0, Screen.PrimaryScreen.Bounds.Size);
            screenshot.Save("screenshot.png", ImageFormat.Png);
        }

It works fine in most programs, but the program I want to capture uses an 8 bits indexed color table. Screenshots of that program taken with this code are strange. My question is if someone can point me in the right direction for capturing screenshots of programs with indexed color tables in C#?

To help you help me, I will describe my findings and attempted solutions below.

The screenshots captured with this code of a full screen program using an 8 bits indexed color table is mostly black(for ~88 %) and there are only 17 other colors in it. I don’t see a pattern in those 17 colors. In the program itself almost all 256 colors are used. I was hoping to find 256 colors in the black screenshots as well, which could indicate a simple one-on-one relationship, but that is not the case.

I would also like to note that screenshots taken manually are perfect(when I paste them in MS Paint for example). For that reason I tried fetching the image from System.Windows.Forms.Clipboard.GetImage() after taking a screenshot manually, but that returns a COMobject and I wouldn’t know what to do with that. Surely that must contain the information of a valid screenshot, since MS Paint knows how to extract it from that COM object. How can I extract that myself, preferably in C#?

But my main question: Can someone point me in the right direction for capturing screenshots of programs with indexed color tables with C#?

  • 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-23T14:44:53+00:00Added an answer on May 23, 2026 at 2:44 pm

    The suggested solutions did not work and I only recently solved this problem.
    I took a screenshot by sending a PrintScreen key press and release to windows, and acquired the data from the clipboard in the form of a MemoryStream and figured out how the screenshot was decoded in that stream and converted that to a bitmap. Not very appealing, but at least it works…

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

Sidebar

Related Questions

There are numerous Agile software development methods. Which ones have you used in practice
In JavaScript this was a cross-browser compatibility issue, so both were used, but there
There are numerous discussions here that have addressed issues that seem related to this
There are numerous articles on the web quoting the perils of JavaScript cryptography including
This is directly inspired by this question . There are numerous references/statements that bitwise
There are numerous libraries providing Linq capabilities to C# code interacting with a MySql
There are numerous times you have an interface that accepts similar type arguments that
In a C# Winform application (3.5) there are numerous forms each with different listview
There's a number of posts here on hashing of passwords and numerous recommendations on
There is a conversion process that is needed when migrating Visual Studio 2005 web

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.