[try Beta version]
Not logged in

 
Resizing Bitmap

Sep 21, 2011 at 6:51pm
Hello,
I wish to resize a image, which is avaliable as 32-bit encoded data(RGB).
I know that you can do this with StretchBlt(),
but is there a way to do this without using an API?
If anyone has some code or an idea, I would be grateful :)
Last edited on Sep 21, 2011 at 6:52pm
Sep 21, 2011 at 7:18pm
Without using an API, you will have to manually open the file, read every bit and understand what every individual bit means, write your own algorithm to create a new image that looks like it but smaller, and then write your own code to create a new image file. This is a lot of work and will require you to become very familiar with the definition of whichever kind of images you wish to work with.

Start here for bitmaps: http://en.wikipedia.org/wiki/BMP_file_format

Alternatively, look into the common easy image libraries, such as CoolImage http://cimg.sourceforge.net/ - APIs exist for a reason :)
Last edited on Sep 21, 2011 at 7:20pm
Sep 21, 2011 at 7:26pm
Do you want to resize the bitmap, or do you want to display a stretched version of it? If you want to display a stretched version, you would probably want to use something like OpenGL or D3D, put the bitmap as a texture on a plane, and then just display the plane at different sizes.

If you want to resize the bitmap and don't want to use an external API - well, like Moschops said. Read the file Byte by Byte, and figure out some algorithm for resizing.
Sep 21, 2011 at 8:08pm
Thank you for your quick reply!
I'll use CoolImage. It also complies in my requirements of portability.
Topic archived. No new replies allowed.