Save to camera roll in a different size

icahill (Administrator) 7 years ago 0
Traditionally the camera tag will save an image to the camera roll at 100% of the screen, even if you resize the camera tag smaller, you are left with a skewed image.

To combat this, and save a photo taken with the camera in a different size, say a square, you simply need to change your camera type to "video" and using the capture tag to pull the paused image in the video.

Check out this example:

<panel name="background" height="100%" width="100%" background="#0000ee">
<panel name="contain" alias="CONTAIN" height="600" width="600" align="center">
<camera alias="CAMERA" name="panel" onclickup="picture" background="#FFFFFF" type="video" height="400" width="400" align="center" valign="top"></camera>
<text name="title" text="Light" font="helvetica" size="24" width="50%" height="20%" alignment="center" valign="bottom" align="left" color="#FFFFFF" background="#000000" alpha="0.5"
onclickup="light" />
<text name="title" text="Fire" font="helvetica" size="24" width="50%" height="20%" alignment="center" valign="bottom" align="right" color="#FFFFFF" background="#000000" alpha="0.5"
onclickup="picture" />
<action name="onstart" oninit="yes">
<assign property="var:torch" value="off"/>
<action name="picture">
<event type="pausePreview" target="CAMERA" wait="yes"/>
<capture toalbum="test" target="CAMERA"/>
<event type="resumePreview" target="CAMERA"/>
<action name="light">
<if lhs="[var:torch]" operator="eq" rhs="on">
<event type="torchModeOn" target="CAMERA"/>
<if lhs="[var:torch]" operator="eq" rhs="off">
<event type="torchModeOff" target="CAMERA"/>
<assign property="var:torch" value="[eval:
('[var:torch]' == 'off' ? 'on' : 'off')]" />