Save image from unmanage pointer
See original GitHub issueI use ffmpeg.autogen for receiving a frame from a video and want to continue to keep this frame in the picture. But I only get a pointer to the frame, how can I save it using Magic.Net? Bitmap was overloading the receive pointer to raw.
Example with Bitmap:
ffmpeg.sws_scale(
this.pSwsContext,
(byte*[])this.pDecodedFrame->data,
(int[])this.pDecodedFrame->linesize,
0,
this.Height,
(byte*[])this.scaledData,
(int[])this.scaledLinesize);
var data = new byte_ptrArray8();
data.UpdateFrom(this.scaledData);
var linesize = new int_array8();
linesize.UpdateFrom(this.scaledLinesize);
var bitmapFrame = new Bitmap(this.Width, this.Height, linesize[0], PixelFormat.Format24bppRgb, (IntPtr)data[0]);
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
c# - Creating an image from an unmanaged buffer
I need to display an image in a WPF application written in C#. The image content is generated by an external unmanaged library, ......
Read more >how can I save a raw image files from bytes and pointers?
How can I save a raw image files from bytes and pointers? ... int value = Marshal.ReadByte(pMem); int size = width*height*bpp/8; byte[] abr...
Read more >How to save InPtr to a raw file? - C# / C Sharp
I wish to save this image data pointed by the IntPtr to a raw data file. The way I now to that is:...
Read more >How to save InPtr to a raw file?
Hello gurus, I have a System.IntPtr pointing to the memory address of my image (not a ..NET image). I wish to save this...
Read more >Get RAW Image from C++ Memory Pointer
1) Get the Image · 2) convert it to jpeg · 3) save it to hard disk
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@dlemstra Thank you, again!
The storage type should be
Char
and the pixel mappingBGR
.