## How to scale the size of a .BMP picture?

### How to scale the size of a .BMP picture?

Hello Everyone:

I want to check the size of a bitmap picture before loading it into a
Picture control or Image control.  If the size of a bitmap is bigger than e.g.

500kB or 120x120, I want the control to scale the picture into 120x120 and
save the scaled picture into a file e.g. ABC.bmp.

Can anyone please tell me how to do the following:

1)  How to detect the size of a picture file in kB or in HeightxWidth?

2)  How to scale the picture into the required dimension e.g. 120x120?

3)  Can the SavePicture( ) save the scaled picture?

I try to scale a picture in Image control with Stretch = True, and
save the image with SavePicture( ).  But the new picture remains in the same
size!

### How to scale the size of a .BMP picture?

Try the following

Picture1.image.height = blah blah

splau heeft geschreven in bericht

Quote:>Hello Everyone:

>        I want to check the size of a bitmap picture before loading it into
a
>Picture control or Image control.  If the size of a bitmap is bigger than
e.g.

>500kB or 120x120, I want the control to scale the picture into 120x120 and
>save the scaled picture into a file e.g. ABC.bmp.

>Can anyone please tell me how to do the following:

>1)  How to detect the size of a picture file in kB or in HeightxWidth?

>2)  How to scale the picture into the required dimension e.g. 120x120?

>3)  Can the SavePicture( ) save the scaled picture?

>        I try to scale a picture in Image control with Stretch = True, and
>save the image with SavePicture( ).  But the new picture remains in the
same
>size!

### How to scale the size of a .BMP picture?

You can find out the size (in pixels) like this:

Dim p1 As Picture, picwide As Integer, pichigh As Integer
picwide = ScaleX(p1.Width, vbHimetric, vbPixels)
pichigh = ScaleY(p1.Height, vbHimetric, vbPixels)
Print picwide; " x "; pichigh

>Hello Everyone:

>        I want to check the size of a bitmap picture before loading it into
a
>Picture control or Image control
>snip<

### How to scale the size of a .BMP picture?

decided to enlighten us with :

Quote:>Hello Everyone:

>        I want to check the size of a bitmap picture before loading it into a
>Picture control or Image control.  If the size of a bitmap is bigger than e.g.

>500kB or 120x120, I want the control to scale the picture into 120x120 and
>save the scaled picture into a file e.g. ABC.bmp.

>Can anyone please tell me how to do the following:

>1)  How to detect the size of a picture file in kB or in HeightxWidth?

>2)  How to scale the picture into the required dimension e.g. 120x120?

>3)  Can the SavePicture( ) save the scaled picture?

>        I try to scale a picture in Image control with Stretch = True, and
>save the image with SavePicture( ).  But the new picture remains in the same
>size!

Number 1 has been taken care of already.

Have a look into the StretchBlt function. Once you've succeeded in
blitting the image to another control at another scale, you can use
SavePicture to save the scaled image, as long as the destination
control supports the SavePicture method.

Good luck,
Jeremiah D. Seitz
Omega Techware
http://members.home.net/omegatechware

### How to scale the size of a .BMP picture?

What you could do is using two pictureboxes. One is hidden and is used to
load the picture, the other one is visible and receives the picture by using
the PaintPicture method to copy from the hidden box. PaintPicture can shrink
and stretch as desired.

Be aware, though, that sometimes you have to use PaintPicture
HiddenBox.Picture and sometimes PaintPicture HiddenBox.IMAGE (don't want to
dive into the reasons now).

John Tegelaar

>Hello Everyone:

>        I want to check the size of a bitmap picture before loading it into
a
>Picture control or Image control.  If the size of a bitmap is bigger than
e.g.

>500kB or 120x120, I want the control to scale the picture into 120x120 and
>save the scaled picture into a file e.g. ABC.bmp.

>Can anyone please tell me how to do the following:

>1)  How to detect the size of a picture file in kB or in HeightxWidth?

>2)  How to scale the picture into the required dimension e.g. 120x120?

>3)  Can the SavePicture( ) save the scaled picture?

<SNIP>

Hello Everyone:

I want to check the size of a bitmap picture before loading it into a
Picture control or Image control.  If the size of a bitmap is bigger than e.g.
500kB or 120x120, I want the control to scale the picture into 120x120 and
save the scaled picture into a file e.g. ABC.bmp.

Can anyone please tell me how to do the following:

1)  How to detect the size of a picture file in kB or in HeightxWidth?

2)  How to scale the picture into the required dimension e.g. 120x120?

3)  Can the SavePicture( ) save the scaled picture?

I try to scale a picture in Image control with Stretch = True, and
save the image with SavePicture( ).  But the new picture remains in the same
size!