Click to See Complete Forum and Search --> : resize bitmap ???


nguyenk2089
June 25th, 2009, 11:24 AM
hi everybody.
i am need resize image bitmap(24bits).

input :
1. path image bmp
2. scalse

output : path image bmp.

not using Graphic User Interface.
using in Win console

thanks very much

ProgramArtist
June 26th, 2009, 10:01 AM
Why don't you want to use "Graphic User Interface"?

Even if I do not need any GUI for this purpose I would use GDI functions.
Is that ok?

My general approach would be like:

Load a bitmap from file
Select it in a Memory DC
Create a new bitmap with the new dimensions and attributes
Select the new bmp in another memory DC
"Draw" the old bitmap into the new via StretchBlt function
Save the new bitmap to a file


Writing a "GUI" program without showing any GUI is possible.

For saving / loading bmp files:
Search codeguru, there are examples.

If you want to make a fully portable app (not using any OS dependant stuff like win32 API, GDI and so) it will be a bit more work: You have to understand the bmp format fully and then you can make all the things (really bit stuff...) on your own.

Another choice could be to use a graphics library. There are portable ones too. Search google for it, I do not have any experience.

With regards
Programartist

ProgramArtist
June 26th, 2009, 10:04 AM
What exactly do you want to achieve? There are (even free ones) bitmap / picture programs which can scale images as a batch process. For example I use Irfanview in batch mode if I want to scale one (or more) bitmaps. It's really easy.

With regards
Programartist