The MASM Forum

General => The Campus => Topic started by: daydreamer on March 19, 2019, 09:45:16 AM

Title: gdi compress bitmap rle?
Post by: daydreamer on March 19, 2019, 09:45:16 AM
Let's say I draw a map in paint or a program using lot of gdi app calls to make a map,I want gdi save it rle bitmap compressed,so the map becomes smaller,how do I make gdi code that saves it in rle encoded format?
Or do I need gdi+?
Title: Re: gdi compress bitmap rle?
Post by: jj2007 on March 19, 2019, 10:28:21 AM
RLE is not very efficient, but with Gdi+ you can save it as GIF or PNG.
Title: Re: gdi compress bitmap rle?
Post by: Siekmanski on March 19, 2019, 12:26:36 PM
Hi Magnus,

I think the easiest way is to use GDI+ ( as Jochen wrote ) to save the bitmaps, with these 2 functions: "GdipCreateBitmapFromScan0" and "GdipSaveImageToFile"

You can save the raw 32bit ARGB bitmap as BMP,JPG,GIF,TIF or PNG.

Here is some example code how to load and save the bitmap formats with GDI+:

http://masm32.com/board/index.php?action=dlattach;topic=6127.0;attach=6429

The code is in this file: 2D_Image_loader_saver.Asm
Title: Re: gdi compress bitmap rle?
Post by: daydreamer on March 20, 2019, 05:36:06 AM
thanks very much for your great code example Siekmanski :t