Home > front end >  How can I load a jpeg image from a buffer?
How can I load a jpeg image from a buffer?

Time:12-27

I want to store a jpeg image in a RC_DATA resource, but not a single image in one single RC_DATA. There are many things in that RC_DATA, all muxed together. At runtime I load that RC_DATA in a bufer and extract all the object, including this Jpeg. Now I have this image in a memory buffer and I need to load it in a TJpegImage or TBitmap. How can I do that ? I saw that those classes doesn't have some methods to achieve this...

CodePudding user response:

Copy the JPEG bytes from your buffer into a TMemoryStream (or, use a TCustomMemoryStream to point directly at the JPEG bytes to avoid making a copy). And then you can pass that stream to TJPEGImage.LoadFromStream().

  • Related