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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T12:22:20+00:00 2026-05-18T12:22:20+00:00

I need to convert 16-bit XRGB1555 into 24-bit RGB888. My function for this is

  • 0

I need to convert 16-bit XRGB1555 into 24-bit RGB888. My function for this is below, but it’s not perfect, i.e. a value of 0b11111 wil give 248 as the pixel value, not 255. This function is for little-endian, but can easily be modified for big-endian.

public static Color XRGB1555(byte b0, byte b1)
{ 
    return Color.FromArgb(0xFF, (b1 & 0x7C) << 1, ((b1 & 0x03) << 6) | ((b0 & 0xE0) >> 2), (b0 & 0x1F) << 3); 
}

Any ideas how to make it work?

  • 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-18T12:22:21+00:00Added an answer on May 18, 2026 at 12:22 pm

    You would normally copy the highest bits down to the bottom bits, so if you had five bits as follows:

    Bit position: 4 3 2 1 0
    Bit variable: A B C D E
    

    You would extend that to eight bits as:

    Bit position: 7 6 5 4 3 2 1 0
    Bit variable: A B C D E A B C
    

    That way, all zeros remains all zeros, all ones becomes all ones, and values in between scale appropriately.

    (Note that A,B,C etc aren’t supposed to be hex digits – they are variables representing a single bit).

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

Sidebar

Related Questions

I need to convert integer value into char array on bit layer. Let's say
I need to convert different files formats into .png grayscale (8 or 16 bit)
I have a need to convert an Int32 value to a 3-byte (24-bit) integer.
edited everything I need to convert words into binary numbers. With a bit help
I need to be able to convert 8-bit or 16-bit grayscale pixel data into
I need to convert a signed decimal number into a 32 bit little-endian binary
I need to convert Java long datatype (64-bit) data into legacy c++ app unsigned
I need to convert an enumeration member (its value, not the identifier) to a
I need to convert an unsigned 64-bit integer into a string. That is in
I need to convert both 32-bit and 64-bit unsigned integers into floating-point values in

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.