# Picture resze

## Recommended Posts

Hallo everybody!

First of all I must say I am so happy that I found autoit! I is just amasing.

Now to my question:

I found out that I can resize pictures when I use GUICtrlCreatePic .

But I wanted to adjust just the height and the width should be changed proportional to the original picture.

For example:

Picture a 200x40

Picture b 400x70

I want them to resize to 600x ??, so that it shows

a 600x120

b 600x210

Can someone help me!

TNX

##### Share on other sites

In one of my scripts I have a space 371p X 371p. All graphics displayed must fit in that space. Here is the code I use to resize any sized graphic to fit that space without changing the aspect ratio.

\$iX is the original width

\$iY is the original height

\$iW is the displayed width

\$iH is the displayed height

This makes them larger or smaller as needed. It uses cross multiplication and division to determine the unknown dimension.

```\$iX = Number(\$iX)
\$iY = Number(\$iY)
If \$iX > \$iY Then
\$iW = 371
\$iH = Int(((371*\$iY)/\$iX))
EndIf
If \$iX = \$iY Then
\$iW = 371
\$iH = 371
EndIf
If \$iY > \$iX Then
\$iH = 371
\$iW = Int(((371*\$iX)/\$iY))
EndIf```

Gene

Hallo everybody!

First of all I must say I am so happy that I found autoit! I is just amasing.

Now to my question:

I found out that I can resize pictures when I use GUICtrlCreatePic .

But I wanted to adjust just the height and the width should be changed proportional to the original picture.

For example:

Picture a 200x40

Picture b 400x70

I want them to resize to 600x ??, so that it shows

a 600x120

b 600x210

Can someone help me!

TNX

[font="Verdana"]Thanks for the response.Gene[/font]Yes, I know the punctuation is not right...

##### Share on other sites

In one of my scripts I have a space 371p X 371p. All graphics displayed must fit in that space. Here is the code I use to resize any sized graphic to fit that space without changing the aspect ratio.

\$iX is the original width

\$iY is the original height

\$iW is the displayed width

\$iH is the displayed height

This makes them larger or smaller as needed. It uses cross multiplication and division to determine the unknown dimension.

Wow! Gene, TNX for that quick reply!

But I must say "cross multiplication" sounds hevy

I think I have to play with it, but I should get it to work!

Thank you

##### Share on other sites

Ah I spoke too fast!

How do I get

\$iX width

\$iY height

for the calculation????

## Create an account

Register a new account

• ### Recently Browsing   0 members

×

• Wiki

• Back

• #### Beta

• Git
• FAQ
×
• Create New...