Jump to content
  • Advertisement
Sign in to follow this  
hahaha

Image Resize???

This topic is 4083 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Anyone know of an easy way to resize an Image in c++ and win32? The image will be a 24bit .tga. If it matters Ill be using opengl Thanks

Share this post


Link to post
Share on other sites
Advertisement
Apart from using either a library or using your own code, I don't see any way to resize an image.

Library you can use:
ImageMagick (OSS)
Intel Intergrated Performance Primitives (IPP) (200$, but damn fast on intel processors, and contains many other things)

There are tons of other possibilities - I just let you google to find some.

If you want to implement the magnification algorithm by yourself, Aramini's paper is what you search (cubic splines resampling). It's quite easy to implement - it might take some time to get something fast, but that's definitely possible. I implemented it 7 years ago, and the final implementation was nearly as fast as what Intel was doing - and that was without using any kind of SIMD code.

Share this post


Link to post
Share on other sites
There's also GDI+, which comes with Windows XP and later, and is available as a redistributable for Win98 and later. It's not hard to resize an image with the Bitmap class. There's an example of scaling in the API documentation.

On the other hand, if you're using OpenGL, then usually you don't need to scale images independently.

Share this post


Link to post
Share on other sites
There's a resize implementation in my Bitmap class. It doesn't do cubic spline resampling and it's not that fast. Having said that it does work well and should be easy enough to understand.

Share this post


Link to post
Share on other sites
Quote:
Original post by hahaha
Anyone know of an easy way to resize an Image in c++ and win32? The image will be a 24bit .tga. If it matters Ill be using opengl

Thanks



Do you want to resize the image on the fly ?
If so you can use OpenGl for it.
Load you tga file as an OpenGL texture.
Setup a quad of your desired image dimension and bind your loaded texture.


your code should look like this.


glBindTexture(GL_TEXTURE_2D, tex);
glBegin(GL_TRIANGLE_STRIP);


glTexCoord2f(0,0); //Left upper corner of your texture
glVertex2f (x, y); //x and y are the begining coords of your quad

glTexCoord2f(1,0); //Right upper corner of your texture
glVertex2f (x + w, y); //w is the width of your texture

glTexCoord2f(0,1); //Left down corner of your texture
glVertex2f (x , y + h); //h is the Highth of your texture

glTexCoord2f(1,1); //Right down corner of your texture
glVertex2f (x+w , y + h);


glEnd ();

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!