Displaying an image from an SD card?

Hi peeps!

First of all I want to mention that I’m entirely new to this Gadgeteer business, my background lies predominately in Arduino and Processing, so C# is doing my head in a bit right now.

Anyhow, I have a need to display a bitmap, created on a computer, on a screen (I have the T43 for now), and I simply cannot figure out how. I obviously have the required pieces (SD card reader, mainboard and screen), and down the line I’m planning to be able to modify for instance position of the image based on input from rotary encoders, or potentiometers.

If it makes any difference I’m running the FEZ Spider 1.0 mainboard.

I haven’t been able to find any examples which could help me in my quest, so if anyone could either direct me to one or drop some helpful hints on how to just get an image displayed I’d be very grateful!

Cheers!

Welcome to the forum!

This should be relatively easy.

  1. You will need to read the image into a byte array.
    https://www.ghielectronics.com/docs/96/sd-card-module
    see fileGetContents method

  2. Having a byte array you should be able to construct Bitmap object
    Bitmap Constructor (Byte[], BitmapImageType) | Microsoft Learn

  3. Draw Bitmap on the display.
    https://www.ghielectronics.com/docs/213/display-t43-module
    read about Flush method of the Bitmap object.

Thank you for your reply, unfortunately I was unable to get any of that to work, likely because of my own inability to understand C#. I wish I had time to start from the basics, but alas not.

In the end I managed to get it working by more or less copypasting code from this post: https://www.ghielectronics.com/community/forum/topic?id=4716

Now next steps, which hopefully should be a bit easier.

Coming from an Arduino background I could see how much Gadgeteer as a platform could benefit from a slew of good examples, written, annotated and free for people to copy/paste to get an idea how to get things running in their project. I would’ve assumed, at least having some programming background, that it would be easier than it actually was.

Oh well :slight_smile:

Dated but a great resource for both C# and the NETMF environment: https://www.ghielectronics.com/downloads/FEZ/Beginners%20guide%20to%20NETMF.pdf
,
Tutorials with slew of code snippets: https://www.ghielectronics.com/docs/37/netmf-and-gadgeteer-tutorial-index

Another out-of-date, but good starting place: https://www.ghielectronics.com/docs/21/first-netmf-project

All the above links are found under support->NETMF

A great place for working code examples, worth a good browse: Codeshare under Community

PS - we have updating the documentation on our high priority list !!