-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Converting SIPSorceryMedia.Abstractions.RawImage to IronSoftware.Drawing.AnyBitmap #47
Comments
SIPSorceryMedia.Abstractions.RawImage contains all necessary info about an image in AV_PIX_FMT_BGR24 format (format in FFmpeg context) So 8 bits for B, 8 bits for G, 8 bits for R (=> 24 bits for one pixel), it's size (width and height) and it's stride As an example, This AV_PIX_FMT_BGR24 format is the same as this one PixelFormat.Format24bppRgb in According the library, you must use an equivalent:
About stride, read this: https://learn.microsoft.com/en-us/dotnet/api/system.drawing.bitmap.-ctor?view=dotnet-plat-ext-7.0#system-drawing-bitmap-ctor(system-int32-system-int32-system-int32-system-drawing-imaging-pixelformat-system-intptr) |
Trying to convert AV_PIX_FMT_BGR24 to 32-bit color with the format BGRA:
But getting blueish color in image and taking to long to convert too. Any suggestions please. |
Solution:
public static unsafe Image ConvertRawImageToImageSharp (SIPSorceryMedia.Abstractions.RawImage rawImage)
Thanks to ChatGPT-4 |
It is possible to convert SIPSorceryMedia.Abstractions.RawImage to System.Drawing.Bitmap as follows:
System.Drawing.Bitmap bmpImage = new System.Drawing.Bitmap(rawImage.Width, rawImage.Height, rawImage.Stride, System.Drawing.Imaging.PixelFormat.Format24bppRgb, rawImage.Sample);
Now I want to convert SIPSorceryMedia.Abstractions.RawImage to IronSoftware.Drawing.AnyBitmap.
Any help in this regard.
The text was updated successfully, but these errors were encountered: