Jump to content

Picture resze


qayqay
 Share

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

Link to comment
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 :o

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...

Link to comment
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 :o

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

Thank you

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...