Page 1 of 1
Resize rotated image?
Posted: Tue Jun 20, 2023 6:51 pm
by cmhjon
Hi all,
I am trying to script the process of importing an image, rotating it to a different angle, reducing its size, and then setting its location. The script worked perfectly until I added the line to change its rotation angle. Here's the script as I have it so far:
Code: Select all
on mouseUp
answer file "Select a JPEG file:"
put it into filePath
import paint from file filePath
set itemDelimiter to "/"
put last item of filePath into tFileName
set itemDelimiter to ""
put the loc of graphic "placeHolder" into tLoc
set the angle of image tFileName to 270
set the width of image tFileName to 166
set the height of image tFileName to 203
set the loc of image tFileName to tLoc
end mouseUp
After adding the line to set the rotation angle, the image gets rotated to the specified angle but then seems to ignore the remaining commands.
What am I missing?
Thank you,
Jon

Re: Resize rotated image?
Posted: Tue Jun 20, 2023 7:30 pm
by dunbarx
Hi.
I did not recreate the various files you mentioned, merely starting from the rotation step with an arbitrary image and proceeding as you did.
No issues, no degradation of the image.
Mac.
Craig
Re: Resize rotated image?
Posted: Tue Jun 20, 2023 8:08 pm
by cmhjon
Hi Craig,
I am stumped. If I remove the angle command line, the script works perfectly but with the angle command in place, the image size is not reduced in size nor is it repositioned as instructed.
Best regards,
Jon
Re: Resize rotated image?
Posted: Tue Jun 20, 2023 8:17 pm
by bn
Hi Jon,
try to set the lockLoc of the image to true
Code: Select all
set the lockLoc of image tFileName to true -- add this line
set the angle of image tFileName to 270
Kind regards
Bernd
Re: Resize rotated image?
Posted: Tue Jun 20, 2023 8:17 pm
by dunbarx
I just made a new post:
https://forums.livecode.com/viewtopic.php?f=9&t=37986
In it, I cheat, and simply import a JPEG from the menubar. If I set its angle to some value, I can then set its loc, but neither of its width or height. The size and position pane in the inspector shows the "lock size and position" checkbox as unchecked.
Craig
Re: Resize rotated image?
Posted: Tue Jun 20, 2023 8:22 pm
by cmhjon
Hi Bernd,
I had just tried that before I saw your reply and yes, that did the trick!
Thanks everyone!
Jon

Re: Resize rotated image?
Posted: Tue Jun 20, 2023 8:30 pm
by dunbarx
Bernd.
My question is this: If one sets the angle of an image, one can no longer change its width or height. The lockLoc property is irrelevant.
Craig
Re: Resize rotated image?
Posted: Tue Jun 20, 2023 8:32 pm
by bn
dunbarx wrote: ↑Tue Jun 20, 2023 8:30 pm
Bernd.
My question is this: If one sets the angle of an image, one can no longer change its width or height. The lockLoc property is irrelevant.
I think you have to set the lockLoc to true before setting the angle. Then you can change to dimensions of the image afterwards.
Kind regards
Bernd
Re: Resize rotated image?
Posted: Tue Jun 20, 2023 8:48 pm
by cmhjon
Here is the updated script which now works:
Code: Select all
on mouseUp
put the loc of graphic "placeHolder" into tLoc
answer file "Select a JPEG file:"
put it into filePath
set itemDelimiter to "/"
put last item of filePath into tFileName
set itemDelimiter to ""
import paint from file filePath
set lockLoc of image tFileName to true
set the angle of image tFileName to 270
set the width of image tFileName to 166
set the height of image tFileName to 203
set the loc of image tFileName to tLoc
end mouseUp
Best regards,
Jon
