r/C_Programming • u/UsualLonely4585 • May 30 '26
NEED HELP!!!
So i am learning C and programming in general , i am thinking of making a simple image viewer nothing fancy . i would prefer to use SDL if possible but i dont know how to approach it can you guys help
0
Upvotes
View all comments
Show parent comment
2
u/Product_Relapse May 30 '26
In SDL if you use SDL image you can initialize for image formats like png, create an SDL texture from a path to an image, create an SDL rect with matching dimensions (unless image skewing / resizing is desired), then use Sdl_rendercopy to render the texture to the renderer using the rect dimensions and position. Textures must be destroyed with destroy texture when done using them. I do this in a cleanup routine.
This is how I do it in my SDL2 project. Apart from that, UI and tooling / features for your viewer is on you