' Function handles converting images to an 32 bit RGB pixel format Private Function ConvertImageToRGBFormat(img As Image) As Image If Not img.PixelFormat = System.Drawing.Imaging.PixelFormat.Format32bppRgb Then Dim temp As Bitmap = New Bitmap(img.Width, img.Height, System.Drawing.Imaging.PixelFormat.Format32bppRgb) Dim g As Graphics = Graphics.FromImage(temp) g.DrawImage(img, New Rectangle(0, 0, img.Width, img.Height), 0, 0, img.Width, img.Height, GraphicsUnit.Pixel) g.Dispose() Return temp End If Return img End Function
Posted: March 20, 2023
Return to the snippets listing