Implementing a simple gallery using C and SDL3.

Hello everyone!

I'm trying to implement a simple gallery (picture gallery) using C and SDL3. The current phase of the project is just the idea. I have defined the following struct to store each of the images

struct Image{
  int width;
  int height;
  unsigned char* pixel;
  struct Image* prev;
  struct Image* next;
};

Each image is going to be represented as a node, and the nodes will be linked together by forming a doubly linked list (so we can traverse back and forth, like a real gallery). My question stands on how I can read and write the pixels for each image.

I have found some pieces online regarding the way the images are stored (digital images are stored), such as BMP or DIBs, but yet again, I don't quite understand (that is because I have little to no experience with digital images), but I really would like to know to deepen my knowledge. Any tips, libraries, repositories, documentations, or example approaches would be very helpful.

Thank you for your time!

Posted Nov 14, 2025, 1:53 PM UTC

58
Loading comments…