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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T22:23:33+00:00 2026-06-09T22:23:33+00:00

I have an Array of RGB-Byte-Informations of type Byte*. I can save it using

  • 0

I have an Array of RGB-Byte-Informations of type Byte*.
I can save it using the corona-library to an PNG-File.
However, I would like to display the Bytearray somehow on a TImage-Object without having to save and load a file every time…
I have already found the solution of memorystream

Byte* pBuffer;//data
long cbBuffer;//length of data
TMemoryStream *tmem=new TMemoryStream();
tmem->Write(pBuffer,cbBuffer);
TPngImage *saf=new TPngImage();
saf->LoadFromStream(tmem);

However this complains about missing header as the bytearray doesn’t have a header.
So, I thought about creating a blank picture and drawing the pixelinformations on there…

Graphics::TBitmap *Bitmap = new Graphics::TBitmap();  
Bitmap->Width = pVih->bmiHeader.biWidth;               
Bitmap->Height = pVih->bmiHeader.biHeight;              
for(int j=0;j<pVih->bmiHeader.biHeight;j++){
    Byte* y=(Byte*) Bitmap->ScanLine[j];
    for(int x=0;x<pVih->bmiHeader.biWidth;x++)
        y[x]=pBuffer[j*pVih->bmiHeader.biWidth+x];
}
Image1->Picture->Graphic=Bitmap;
Application->ProcessMessages();

However, this stays blank. And I don’t really like painting pixels, even with the little faster ScanLine…

So, does anybody know how to display an Bytearray of colors in an TImage-Object?
If there is a neat library you can also advice it, but I tried to use pnglib several times and I don’t seem to figure out how to use it.
I’m using C++Builder from Embarcadero’s XE2 16.

Regards,
Julian

  • 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-06-09T22:23:35+00:00Added an answer on June 9, 2026 at 10:23 pm

    In Hindsight it might have been necessary to tell that I’m receiving a pf24Bit-picture…

    And, of course, as it’s not one but 3 bytes per pixel there is a missing factor 3:

    TBitmap *Bitmap = new TBitmap();  
    Bitmap->Width = pVih->bmiHeader.biWidth;              
    Bitmap->Height = pVih->bmiHeader.biHeight;
    Bitmap->PixelFormat=pf24bit;
    for(int j=0;j<Bitmap->Height;j++){
        Byte *y=(Byte*)Bitmap->ScanLine[j];
        for(int x=0;x<Bitmap->Width*3;x++){
            y[x]=pBuffer[j*Bitmap->Width*3+x];
        }
    }
    Image1->Picture->Bitmap->Assign(Bitmap);
    

    It’s still a bit slow, but I guess I can’t have direct access to the color-bytes within the bitmap…

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

Sidebar

Related Questions

I have an array of RGB hex colors. I would like to find a
I have an array of integers which represent a RGB image and would like
I have a byte[] array received in TCP Client.The array contains a 24-bit RGB
I have an array of RGB values, whose size I can guarantee to match
I have an array that contains the RGB colour values for each pixel in
I have 1D array of pixel values and i can get red, green and
I have an RGB565 byte array which I display on my Canvas like this:
I have a Javascript array of 20 RGB color values that looks like this:
I have an array of around 200 colours in RGB format. I want to
I have a byte array with series of 0 and -1 (255). It's a

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.