Skip to main content
gamedev.net
🔒 Locked

Image resizing using SDL

Started by valsar 1 reply 12.4k views
Original Post
valsar
valsar
Does anyone know of a way to resize an image using SDL? What I'm looking for specifically is a way to stretching an image. I'm making a 2d rpg and I'm using the chipsets that people use for rpgmaker. Basically each tile on the chipset is 16x16 and I'm looking for a way with code to resize it so I can keep using different images without having to resize the actual images I download. I'm using C++ and VS2003 if you wanted to know.
Lazy Foo
Lazy Foo
You can do it at runtime using SDL_gfx, specifically SDL_rotozoom.

or better yet do it before runtime using Irfan View. Doing it at runtime just waste CPU power. If you need constant scaling, you're better off using hardware accelerated OpenGL.
Learn to make games with my SDL 2 Tutorials
NQ
NQ
I would just like to clarify what LazyFoo said;

1. If you want to resize it to a specific size and then use it like that in many places: use SDL_rotozoom to pre-process them and store them in their altered state as new surfaces. Then use those to blit the resized version.

2. If you want to resize it at runtime to an arbitrary size: then SDL_rotozoom is most likely too slow for you and you would have to look into using OpenGL instead. OpenGL does this without missing a step.

But even if you want to do it at runtime, then try rotozoom first and check if you can manage with the loss of speed. Maybe it won't bother you.
----------------------~NQ - semi-pro graphical artist and hobbyist programmer

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.