auto stretch a image in picturebox to a correct ratio 
Author Message
 auto stretch a image in picturebox to a correct ratio

How can I auto stretch a image to a correct size in a picture box?...

I want to have a function that allows me to correct the size of a image in a
picture box.
When the image is smaller then the picture box it have to center the image,
And when its bigger it have to stretch the image on a kind of ratio, so I
don't have
pictures with bigger widths then heights... I need this for displaying
faces...
Because it looks very silly when some faces got bigger widths then the
original size.

Hope you will understand what Im looking for, because my english is very
bad.

               Ray!



Wed, 18 Jun 1902 08:00:00 GMT  
 auto stretch a image in picturebox to a correct ratio
You can stretch a picture with the StretchBlt api. To get the result
picture, use the Image property and also set the autoredraw to true.



Quote:

> How can I auto stretch a image to a correct size in a picture box?...

> I want to have a function that allows me to correct the size of a image in
a
> picture box.
> When the image is smaller then the picture box it have to center the
image,
> And when its bigger it have to stretch the image on a kind of ratio, so I
> don't have
> pictures with bigger widths then heights... I need this for displaying
> faces...
> Because it looks very silly when some faces got bigger widths then the
> original size.

> Hope you will understand what Im looking for, because my english is very
> bad.

>                Ray!



Wed, 18 Jun 1902 08:00:00 GMT  
 auto stretch a image in picturebox to a correct ratio
I believe that you need to use a PictureBox because StretchBlt() requires an
hDC (as I recall).

Also the Scalemode of everything must be set to Pixel.

I have a small demo of StretchBlt at:
    http://home.earthlink.net/~mjg99/VB6/thumbnail.zip

It resizes images to 100 X 100 pixels.   Thus it produces thumbnails of
larger pictures and enlargements of small stuff.

Michael


Quote:
> You can stretch a picture with the StretchBlt api. To get the result
> picture, use the Image property and also set the autoredraw to true.



> > How can I auto stretch a image to a correct size in a picture box?...

> > I want to have a function that allows me to correct the size of a image
in
> a
> > picture box.
> > When the image is smaller then the picture box it have to center the
> image,
> > And when its bigger it have to stretch the image on a kind of ratio, so
I
> > don't have
> > pictures with bigger widths then heights... I need this for displaying
> > faces...
> > Because it looks very silly when some faces got bigger widths then the
> > original size.

> > Hope you will understand what Im looking for, because my english is very
> > bad.

> >                Ray!



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Stretched Image on PictureBox?

2. Keeping the correct screen/printer ratio in a picture-box

3. Keeping the correct screen/printer ratio in a picture-box

4. HDI Maintain aspect ratio in a picturebox?

5. PictureBox Aspect Ratio?

6. PictureBox replacement that stretches its contents URGENT

7. How to make a picturebox stretch its picture URGENT

8. Stretching the contents of a PictureBox

9. putting a imagebox picture on a picturebox in the stretch mode

10. Stretch picture in a picturebox

11. Using StretchBlt to Stretch a Bitmap/Icon in a PictureBox

12. constraining aspect ratio of Image

 

 
Powered by phpBB® Forum Software