DrawImage method

This is how to read files from SD http://docs.ghielectronics.com/software/tinyclr/tutorials/filesystem.html

The Bitmap can be constructed with a stream.

I have not tried this…but please let us know if you do. Note that this will only work with BMP for now (for internal reasons) but will support GIF and JPEG later.

By the way, there is 4MB of QSPI flash that has not been used yet. So one day in the future, you will get an additional 4MB of storage :slight_smile:

var sd = StorageController.FromName(@"GHIElectronics.TinyCLR.NativeApis.STM32F4.SdCardStorageController\0");
var drive = FileSystem.Mount(sd.Hdc);
var file = new FileStream($@"{drive.Name}image.bmp", FileMode.Open);
var bt = new Bitmap(file);
1 Like

is it an NTSF file system?

Only FAT is supported

Nonetheless, files can be written to the SD from a PC (?)

Of course they can.

there is ‘resource1.GetBitmap’. Is there a getgif ?

Gus told you this earlier::::::

GetBitmap for now.

Actually, get bitmap does not mean BMP. It means create a bitmap object from any supported image format.

What happens when you add a gif and then try to get bitmap on that gif resource?

I added an icon as a gif to resources. It increased the size by about 3200 bytes.
I added the same icon as a bitmap. It increased the size by about 11000 bytes

Most important question - were you able to use the GIF? If so, great, it’ll save you on application space, but it’s still going to be a bitmap internally so once loaded you’re still going to use the same memory

Same RAM, not flash. Just to clarify.

yes, agreed, it’s application execution space that will remain static, even though the deployment space is smaller.

So the flash will be smaller by using a GIF (yes it did work fine). RAM is used during execution, how much RAM is available ? I could be using several icons at a time, if the RAM used is the bmp size then I may still be in trouble (??)

You have a of RAM. I will be very surprised if you use up all the RAM and it will be because you did something wrong.

Mow much RAM ?

The module ships with 32MB of RAM. Your free RAM is probably over 20MB.

Ok, no problem then