Return-Path: X-Original-To: apmail-cordova-dev-archive@www.apache.org Delivered-To: apmail-cordova-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 678AE106FE for ; Wed, 4 Dec 2013 16:19:30 +0000 (UTC) Received: (qmail 22527 invoked by uid 500); 4 Dec 2013 16:19:30 -0000 Delivered-To: apmail-cordova-dev-archive@cordova.apache.org Received: (qmail 22469 invoked by uid 500); 4 Dec 2013 16:19:30 -0000 Mailing-List: contact dev-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cordova.apache.org Delivered-To: mailing list dev@cordova.apache.org Received: (qmail 22451 invoked by uid 99); 4 Dec 2013 16:19:29 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 04 Dec 2013 16:19:29 +0000 X-ASF-Spam-Status: No, hits=-5.0 required=5.0 tests=RCVD_IN_DNSWL_HI,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of john.wargo@sap.com designates 155.56.66.98 as permitted sender) Received: from [155.56.66.98] (HELO smtpgw.sap-ag.de) (155.56.66.98) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 04 Dec 2013 16:19:25 +0000 From: "Wargo, John" To: "dev@cordova.apache.org" Subject: RE: Camera targetWidth & targetHeight Thread-Topic: Camera targetWidth & targetHeight Thread-Index: AQHO79X9lbyZzswj2UCNraPgKXlovJpCINKAgACbXgCAAEMNgIAAUNuAgADoHIA= Date: Wed, 4 Dec 2013 16:19:02 +0000 Message-ID: <5900F9BCB827854FB01CA94BA718810D1E756CA6@USPHLEMB11A.global.corp.sap> References: <529D4CBA.3040703@gmail.com> <529DCFDA.5020904@gmail.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.4.150.11] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Virus-Checked: Checked by ClamAV on apache.org Actually, I like being able to only apply one property. That is a useful us= e case for me. We know the camera is going to maintain an aspect ratio when= it resizes the image, right? All that matters then is one dimension; aspec= t ratio takes care of the other one. I would expect it to be implemented b= etter though; iOS is applying it to the wrong axis when in portrait mode fo= r example.=20 John M. Wargo -----Original Message----- From: Shazron [mailto:shazron@gmail.com]=20 Sent: Tuesday, December 03, 2013 4:24 PM To: dev@cordova.apache.org Subject: Re: Camera targetWidth & targetHeight Thanks for doing this John. I think the immediate win is to do this: "If the group doesn't want to support only providing one of the properties, then I would expect that the onError callback is called when only one is provided rather than simply ignoring them as is the case with iOS and Windows Phone." ... since this should be done anyway regardless of what is decided. On Tue, Dec 3, 2013 at 8:34 AM, James Jong wrote: > For targetWidth =3D 2048 , targetHeight=3D768, does it make sense to have= the > result picture with width=3D768,height=3D1024? That seems odd to me. > > -James Jong > > On Dec 3, 2013, at 7:34 AM, John M. Wargo wrote: > > > It occurred to me this morning that I didn't test a scenario where an > application deliberately didn't maintain an appropriate aspect ratio with > targetWidth & targetHeight. > > > > I added a button to my app that set targetWidth to 2048 and targetHeigh= t > to 768. > > > > On Android I got the following: > > > > Portrait: 768x1024 > > Landscape: 1024x768 > > > > On iOS I got the following: > > > > Portrait: 576x768 > > Landscape: 1024x768 > > > > Not what I expected. So apparently the API grabs the smaller property > and applies a set aspect ratio to the resulting photo rather than try to = do > something weird. Notice again that on iOS the API applies the restriction > weirdly in portrait. > > > > On 12/2/2013 10:18 PM, Simon MacDonald wrote: > >> IIRC on Android if you only specify the width or height it will > determine > >> what the other value should be by using the same aspect ration as the > >> original image. > >> > >> > >> Simon Mac Donald > >> http://hi.im/simonmacdonald > >> > >> > >> On Mon, Dec 2, 2013 at 10:15 PM, John M. Wargo > wrote: > >> > >>> A while back I posted a question regarding Camera targetWidth & > >>> targetHeight properties and how they worked. After some discussion, t= he > >>> conclusion I reached was that the documentation couldn't be correct > about > >>> how it worked since there was no way to determine the camera's > resolution > >>> with the current API but the docs said I had to provide both > parameters. I > >>> said I'd do some testing and I have finally gotten around to > completing it. > >>> Here's what I discovered: > >>> > >>> I created an application that allowed me to pass in different values > for > >>> targetWidth & targetHeight when taking a picture. I tested at the > following > >>> image sizes: 640x480, 800x600, 1024x768 as well as setting only the > >>> targetWidth to 1024 or only the targetHeight to 768. > >>> > >>> Here's the results: > >>> > >>> Android > >>> Portrait Landscape > >>> 480x640 640x480 > >>> 600x800 800x600 > >>> 768x1024 1024x768 > >>> 768x1024 1024x768 > >>> 768x1024 1024x768 > >>> > >>> > >>> > >>> iOS > >>> Portrait Landscape > >>> 360x480 640x480 > >>> 450x600 800x600 > >>> 576x768 1024x768 > >>> 2448x3264 3264x2448 > >>> 2448x3264 3264x2448 > >>> > >>> > >>> > >>> Windows Phone 8 > >>> Portrait Landscape > >>> 1836x3264 3264x1836 > >>> 1836x3264 3264x1836 > >>> 1836x3264 3264x1836 > >>> 1836x3264 3264x1836 > >>> 1836x3264 3264x1836 > >>> > >>> > >>> As you can see, Android properly implements the targetWidth & > targetHeight > >>> properties. On iOS, it supports setting both properties, but not > instances > >>> where only one is specified. Windows Phone 8 ignores the parameters > >>> completely. On iOS, when you turn the device on its side, the Camera > API > >>> applies the target width or height to the wrong axis (Android does th= is > >>> well however). > >>> > >>> I'm trying to test this on a BlackBerry device, but my development > >>> environment is giving me fits right now. I'll work on it in the > morning and > >>> publish my results when I get them. > >>> > >>> I would suggest that the android implementation is as expected and th= at > >>> the other platforms need their implementations of targetWidth & > >>> targetHeight adjusted so it works correctly. The documentation should > be > >>> updated as well as it's incorrect today specifying that both properti= es > >>> must be provided. > >>> > >>> If the group doesn't want to support only providing one of the > properties, > >>> then I would expect that the onError callback is called when only one > is > >>> provided rather than simply ignoring them as is the case with iOS and > >>> Windows Phone. > >>> > >>> I posted my sample application and a spreadsheet with my results to > >>> https://github.com/johnwargo/camera_res_test > >>> > >>> -- > >>> John M. Wargo > >>> @johnwargo > >>> www.johnwargo.com > >>> ------------------------------------------------------------ > >>> ------------------------------------------------------------ > >>> ------------------------------------------------------------ > >>> ------------------------------------------------------------ > >>> ------------------------------------------------------------ > >>> ------------------------------------------------------------ > >>> ------------------------------------------------------------ > >>> ------------------------------------------------------------ > >>> ------------------------------------------------------------ > >>> ------------------------------------------------------------ > >>> ------------------------------------------------------------ > >>> ------------------------------------------------------------ > >>> ------------------------------------------------------------ > >>> ------------------------------------------------------------ > >>> ------------------------------------------------------------ > >>> ------------------------------------------------------------ > >>> ------------------------------ > >>> > > > >