Image Rotation
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Re: Image Rotation
Yes...I tried that stack a while ago and had all sorts of problems with it trying to get it to work properly.
I will revisit though and post my results.
Bidge
I will revisit though and post my results.
Bidge
-
- VIP Livecode Opensource Backer
- Posts: 2262
- Joined: Thu Feb 28, 2013 11:52 pm
- Location: Göttingen, DE
Re: Image Rotation
Marginal note (Angle and resize in one step).
With smaller image sizes one can do that already perfectly in LC Script by accessing the raw imageData. For example my stack "Perspective Image Distortion 1.3.1" (see Sample Stacks) does this for more complicated 4-point-shapes than rectangles.
[There you can set the relativePoints of the control-poly to the rotated points of your image's rectangle.]
Probably in December I'll make a "Fast Perspective Distortion" stack.
- In LC Builder one can do that easily.
- With an image of screen size one can do that also in LC Script by using javascript in a browser widget. See for example Jonathan's stack "Browser Widget Image Manipulator" in Sample Stacks.
With smaller image sizes one can do that already perfectly in LC Script by accessing the raw imageData. For example my stack "Perspective Image Distortion 1.3.1" (see Sample Stacks) does this for more complicated 4-point-shapes than rectangles.
[There you can set the relativePoints of the control-poly to the rotated points of your image's rectangle.]
Probably in December I'll make a "Fast Perspective Distortion" stack.
shiftLock happens
Re: Image Rotation
You just need this:bidgeeman wrote:Ahh MaxV...thank you that worked well. I see that you left the image unlocked. My image was being locked by the code I was using and was not allowing the image to resize itself. I have had to rebuild the code I had originally to accommodate this and it works well for image rotating now but my resizing slider does not retain the last size of the image when it is set by the slider as this was relying on locking the image to the new size. How can I get around this?
Code: Select all
on scrollBarDrag pvalue lock screen # I put pValue/100 into sScale set the width of img "i1" to the formattedWidth of img "i1" set the height of img "i1" to the formattedWidth of img "i1" set the lockloc of img "i1" to false put the width of img "i1" into sWidth put the height of img "i1" into sHeight set the width of img "i1" to (sWidth * sScale) set the height of img "i1" to (sHeight * sScale) set the visible of img "i1" to true unlock screen end scrollBarDrag
EDIT: I have tried setting the locloc but it keeps reverting back as soon as the locloc is set back to false to allow the image to rotate.
Thanks again
Bidge
########CODE to copy and paste#######
on scrollBarDrag pvalue
lock screen
# I have the original invisible image called "i1", but I always work wit a copy "i2"
put pValue/100 into sScale
if there is an image "i2" then delete image "i2"
clone image "i1"
set the name of the last image to "i2"
set the width of img "i2" to (round ( (the width of image "i1") * sScale)
set the height of img "i2" to (round (the height of image "i1") * sScale)
set the visible of image "i2" to true
set the imagedata of image "i2" to the imagedata of image "i2"
unlock screen
end scrollBarDrag
#####END OF CODE generated by http://tinyurl.com/j8xf3xq with livecode 9.0.0-dp-6#####
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
Re: Image Rotation
Wow...that worked brilliantly MaxV!
I can't place a "grab me" command on the duplicate image as it replaces itself and the code is lost.
Is there a way to stop the image defaulting position to the top left corner each time? I will have a
play around with it and see if I can work it out.
Thanks so much again.
Bidge
I can't place a "grab me" command on the duplicate image as it replaces itself and the code is lost.
Is there a way to stop the image defaulting position to the top left corner each time? I will have a
play around with it and see if I can work it out.
Thanks so much again.
Bidge
Re: Image Rotation
Hi David,
Hint:
...
put "on mousedown" & CR & "grab me" & CR & "end mousedown" into tScript
...
Hint:
"binfile" erm, I mean "loc"!
Best
Klaus
sure you can't add this to the cloned image in the script? I bet you can!bidgeeman wrote:I can't place a "grab me" command on the duplicate image as it replaces itself and the code is lost.
Hint:
...
put "on mousedown" & CR & "grab me" & CR & "end mousedown" into tScript
...
Do you want it at the SAME loc(ation) as image "i1"?bidgeeman wrote:Is there a way to stop the image defaulting position to the top left corner each time?
Hint:
"binfile" erm, I mean "loc"!
Best
Klaus
Re: Image Rotation
LOL Klaus
I was just thinking about placing the grab me into the script but you beat me to it!
Might try and set image "i1" to the same loc as image "i2" so that they can be both
dragged around.
Thanks
Binfile...errr...Bidge
I was just thinking about placing the grab me into the script but you beat me to it!
Might try and set image "i1" to the same loc as image "i2" so that they can be both
dragged around.
Thanks
Binfile...errr...Bidge
Re: Image Rotation
???bidgeeman wrote:Wow...that worked brilliantly MaxV!
I can't place a "grab me" command on the duplicate image as it replaces itself and the code is lost.
When you clone an object, also the code is cloned.
Put all the code you need in the image "i1" and it will be cloned.
Otherwise, put the code in a custom property, for example:
Code: Select all
set the script of image "i2" to the templateScript1 of image "i1"
Do you know what is a custom property? See http://livecode.wikia.com/wiki/Custom_properties
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
Re: Image Rotation
Hi MaxV.
Thank you again. The code does get copied you are correct
I have struck only one small problem. For some reason the resolution of the original image is degraded and the copy becomes slightly pixelated when using the resize. I Don't know what could be causing it?
Bidge
Thank you again. The code does get copied you are correct
I have struck only one small problem. For some reason the resolution of the original image is degraded and the copy becomes slightly pixelated when using the resize. I Don't know what could be causing it?
Bidge
-
- Livecode Opensource Backer
- Posts: 9361
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Image Rotation
This has been an ongoing problem with Livecode since the extinction of the dinosaurs,original image is degraded
and, at the moment at least, the way to go would seem to be with SVG widgets.
Re: Image Rotation
If you enlarge an small image, it gets pixelated. But if the original image is bigger than the resized one, it can't be pixelated.bidgeeman wrote:Hi MaxV.
Thank you again. The code does get copied you are correct
I have struck only one small problem. For some reason the resolution of the original image is degraded and the copy becomes slightly pixelated when using the resize. I Don't know what could be causing it?
Bidge
See also this post (there is a button to translate it in your mother tongue): http://livecodeitalia.blogspot.it/2014/ ... li_88.html .
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
Re: Image Rotation
Hi MaxV.
Once again thanks for your feedback
Regards
Bidge
Once again thanks for your feedback
Regards
Bidge
-
- VIP Livecode Opensource Backer
- Posts: 2718
- Joined: Sat Dec 22, 2007 5:35 pm
- Location: Genève
- Contact:
Re: Image Rotation
Hi All
Hermann said:
but I experimented "imageHandles89_v110" from hh and it works for this goal
You may download it on sample stacks
Thanks again Hermann
Jean-Marc
Hermann said:
Yes for an image resized proportionaly mais no for a distorded image.There is a stack "Angle and Resize an Image" (by Paul Hibbert) on "Sample Stacks" to that problem.
but I experimented "imageHandles89_v110" from hh and it works for this goal
You may download it on sample stacks
Thanks again Hermann
Jean-Marc
https://alternatic.ch