I need BMP image with transparent backgorund to pass the image to Evolis card printer, but BMP cannot accept transparent background, so i found using PNG with transparent with (300 dpi and 24 bpp) convert to BMP via UWP APP
Loading
I need BMP image with transparent backgorund to pass the image to Evolis card printer, but BMP cannot accept transparent background, so i found using PNG with transparent with (300 dpi and 24 bpp) convert to BMP via UWP APP
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Vijay Pratap SinghPosted Apr 17, 2024, 4:26 AM
Here's a step-by-step guide to achieving this:
System.Drawing.Hope this will help
Naimish MakwanaPosted Apr 17, 2024, 4:22 AM
You want to create a BMP image from a PNG image with a transparent background, using a UWP app. Here is a sample code snippet in C# that uses the
Windows.Graphics.Imagingnamespace to convert a PNG image to a BMP image:This code reads a PNG image, decodes it into a
SoftwareBitmap, and then encodes thatSoftwareBitmapinto a BMP image with a DPI of 300. The output BMP image is saved to the specified output file path.Please note that BMP does not support transparency. If the input PNG image has transparent areas, they will be filled with black in the output BMP image. Also, please ensure that you have the necessary permissions to read and write files in the specified paths.
This code is for a UWP app, so it uses the
Windows.StorageandWindows.Graphics.Imagingnamespaces, which might not be available in other types of C# applications. If you’re not developing a UWP app, you might need to use a different approach.Remember to call this method from an async method, or use
Task.Runto run it from a synchronous method. For example:Please replace
inputFilePathandoutputFilePathwith your actual file paths.Thanks