Search code examples
ioscamerarhomobilerhodes

iOS image resize with Rhomobile generates rotated pictures


I'm using Rhodes 3.3.3 to develop for iOS and Android. My app uses the camera and I need to resize pictures. I use the following Rhodes commands to resize the picture:

settings = {:enable_editing => false, :desired_width => 800, :desired_height => 800}
Camera::take_picture(url_for(:action => :camera_callback_new), settings)

Documentation: http://docs.rhomobile.com/rhodes/device-caps#camera

The picture returned is resized. However, if it is taken in portrait mode, it is rotated 90 degrees and if I take it in landscape mode, it is rotated 180 degrees.

Visual explanation of my problem: https://groups.google.com/forum/?fromgroups#!topic/rhomobile/W0b46OllwRw

The Rhodes source code for the camera is linked below. As of yet, I have not been able to figure out where the problem is. The picture is not rotated if I do not specify a resize size. The Rhodes support has ignored my requests so far.

https://github.com/rhomobile/rhodes/blob/master/platform/iphone/Classes/Camera/PickImageDelegate.m

Thanks,

Nick,


Solution

  • I fixed the issue by using the UIImage+Resize library. Full pull request is here:

    https://github.com/rhomobile/rhodes/pull/81