Scaling an image to fit the group dimensions
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Scaling an image to fit the group dimensions
Hi Everyone,
Can you show me the coding needed to scale an image to fit the dimensions of a group?
I'm not concerned with aspect ratio but would like the image to fill the entire space of the group.
Thanks.
Can you show me the coding needed to scale an image to fit the dimensions of a group?
I'm not concerned with aspect ratio but would like the image to fill the entire space of the group.
Thanks.
Re: Scaling an image to fit the group dimensions
Sure.
set the rect of image "yourImage" to the rect of group "yourGroup"
Craig Newman
set the rect of image "yourImage" to the rect of group "yourGroup"
Craig Newman
Re: Scaling an image to fit the group dimensions
Hi Carig,
I tried it but the image is not filling the entire group.
It fills the width but not the height.
I used this coding:
I tried it but the image is not filling the entire group.
It fills the width but not the height.
I used this coding:
Code: Select all
on preOpenCard
put screenrect() into theScreenSize
set the width of group "big ben group" to word 1 of item 3 of the field "theScreenSize"
set the height of group "big ben group" to word 1 of item 4 of the field "theScreenSize"
set the rect of image "big-ben.png" to the rect of group "big ben group"
end preOpenCard
Re: Scaling an image to fit the group dimensions
set the margins of the image and the group to 0
Dixie
Dixie
Re: Scaling an image to fit the group dimensions
Aha.
Dixie's point may be your problem. Newly created objects (other than fields) have default margins set to four pixels. This may, depending on the construction of your group, cause the edges of the two objects to visually misalign. On the other hand, again depending on the group, you may use this property to your advantage, the other method being that you control the image rect itself.
Craig Newman
Dixie's point may be your problem. Newly created objects (other than fields) have default margins set to four pixels. This may, depending on the construction of your group, cause the edges of the two objects to visually misalign. On the other hand, again depending on the group, you may use this property to your advantage, the other method being that you control the image rect itself.
Craig Newman
Re: Scaling an image to fit the group dimensions
Thanks everyone for the helpful replies. 
