Rotate photo in Android

The place to discuss anything and everything about running your LiveCode on Android

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
cusingerBUSCw5N
Posts: 339
Joined: Wed Jul 11, 2012 9:24 pm

Rotate photo in Android

Post by cusingerBUSCw5N » Tue Oct 16, 2012 3:00 pm

Hi. I have learned that Androids take pictures using landscape. My app uses portrait layout.

I can deal with taking a picture using landscape, but when I bring it into the app, it displays sideways. I want to rotate it so it looks OK on the app.

I tried looking at revRotatePoly - but it it not for mobile applications.

How do I rotate an image 90 degress on an Android?

Thank you.

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Rotate photo in Android

Post by Klaus » Tue Oct 16, 2012 3:07 pm

Hi cusingerBUSCw5N,

...
set the angle of img "xyz" to 90
...


Best

Klaus

cusingerBUSCw5N
Posts: 339
Joined: Wed Jul 11, 2012 9:24 pm

Re: Rotate photo in Android

Post by cusingerBUSCw5N » Tue Oct 16, 2012 3:09 pm

sorry - I didn't realize that the simple command rotate worked in android. As usual, I was looking for a more complex solution.

cusingerBUSCw5N
Posts: 339
Joined: Wed Jul 11, 2012 9:24 pm

Re: Rotate photo in Android

Post by cusingerBUSCw5N » Tue Oct 16, 2012 3:22 pm

mobile didn't work.

Thank you Klaus - as usual, you are right on...
except, it needs to be -90

set the angle of image "libImage" to -90

does the trick

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Rotate photo in Android

Post by Klaus » Tue Oct 16, 2012 3:30 pm

Hi cusingerBUSCw5N,
cusingerBUSCw5N wrote:mobile didn't work.
yep, "rotate" is more an "image editing" command, since it is destructive and will really ROTATE the complete image!
Setting the "angle" is non-destructive.
cusingerBUSCw5N wrote:except, it needs to be -90
Hey, but you didn't specify a direction! :lol:


Best

Klaus

Mag
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 802
Joined: Fri Nov 16, 2012 10:51 pm

Re: Rotate photo in Android

Post by Mag » Sat Nov 09, 2013 2:26 pm

Thank Klaus for this post. I'm using it but having I resize the image by a scale factor that get to have the image at (a sort of) full screen, when then I rotate it, it keeps the original (big) size. Any advice? :(

Code: Select all

   put (the width of image myImage/the width of this card) into resizeFactor -- (for example 5.4)
   set the width of image myImage to the width of image myImage / resizeFactor
   set the height of image myImage to the height of image myImage / resizeFactor
   
   if the platform is "android" then
      set the angle of image nomeImmagine to -90
   end if
   
   set the loc of image myImage to the loc of this card

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Rotate photo in Android

Post by Klaus » Sat Nov 09, 2013 3:35 pm

Hi Mag,

sorry, what is happening with the rect and widht and height of an image
when its angle <> 0 is still a complete mistery to me, so I avoid that :D


Best

Klaus

Mag
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 802
Joined: Fri Nov 16, 2012 10:51 pm

Re: Rotate photo in Android

Post by Mag » Sat Nov 09, 2013 6:46 pm

:D

Just replace all the above with:

Code: Select all

   if the platform is "android" then
      set the angle of image myImage to -90
   end if
And just used an image control with the correct sizes and its lockloc set to true 8)

Post Reply