Ok, but now it gets a bit more complex. You could do the following (I
think):
Create an offscreen buffer bitmap. Get the Graphics object for it, use the
Graphics object and its DrawImage method to draw the image on the offscreen
buffer any size you want. Now create a new bitmap as a rectangle the size of
the drawn image on the offscreen, blit the image from offscreen to new
bitmap, and this new bitmap can be used as a thumbnail (and is not drawn on
the screen). Provided its big enough to hold your biggest thumbnail, you can
use the sane offscreen bitmap over and over (provided you Clear it before
each use)...
float m_W = thumb_w ;
float m_H = thumb_h ;
Bitmap^ image = gcnew Bitmap( filename) ;
Bitmap^ m_Offscreen = gcnew Bitmap( thumb_w, thumb_h) ;
Graphics^ m_Offscreen_Graphics = Graphics::FromImage( m_Offscreen ) ;
m_Offscreen_Graphics->DrawImage( image, 0, 0, m_W, m_H ) ;
Bitmap^ thumbnail = gcnew Bitmap( m_W, m_H ) ;
thumbnail->DrawImageUnscaled( m_Offscreen_Graphics, 0, 0 ) ;
[==P==]
John Swan said:
Sorry. I did not explain correctly.
I would like this to be a batch process so I dont want to actually display
image.
Just create a lot of thumbnails of the images.
Peter Oliphant said:
(1) create a PictureBox
(2) set the Image of the PictureBox to your Bitmap (form->Image = bitmap)
(3) add the PictureBox to your form (form->Controls->Add( picturebox ))
(4) set the Width and Height of your PictureBox.
The image should stretch to fill whatever dimensions you givethe PictureBox
(there might be a proprty of PictureBox you have to set a particular
way
to
get this behavior, but I think it's default is to stretch)...
[==P==]
Hello.
I'm trying to create a simple program that amongst other things
creates
a
thumbnail of an image (Bitmap) to a set size determined by the user in
pixels?
The problem is: All of the examples I have seen so far are in c#.
Can anyone please provide reference to a c++ managed version.
Thanks.
John