You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by "John M. Wargo" <jw...@gmail.com> on 2013/12/03 04:15:06 UTC

Camera targetWidth & targetHeight

A while back I posted a question regarding Camera targetWidth & targetHeight properties and how they worked. After some discussion, the 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 this 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 that 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 properties 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 <http://twitter.com/johnwargo>
www.johnwargo.com <http://www.johnwargo.com>
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Re: Camera targetWidth & targetHeight

Posted by "John M. Wargo" <jw...@gmail.com>.
Yes, that's what I determined in my testing. IMHO the other platforms should do that as well. No need to force both if the developer simply wants to set one of them. The docs say both are required - either Android is wrong or the other platforms are wrong.

I say we remove that reference from the docs and update the other platforms so they work like Android does. Android is right on only requiring one of the parameters plus it properly deals with the device in portrait or landscape mode (which iOS does not).

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 <jw...@gmail.com> wrote:
>
>> A while back I posted a question regarding Camera targetWidth &
>> targetHeight properties and how they worked. After some discussion, the
>> 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 this
>> 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 that
>> 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 properties
>> 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 <http://twitter.com/johnwargo>
>> www.johnwargo.com <http://www.johnwargo.com>
>> ------------------------------------------------------------
>> ------------------------------------------------------------
>> ------------------------------------------------------------
>> ------------------------------------------------------------
>> ------------------------------------------------------------
>> ------------------------------------------------------------
>> ------------------------------------------------------------
>> ------------------------------------------------------------
>> ------------------------------------------------------------
>> ------------------------------------------------------------
>> ------------------------------------------------------------
>> ------------------------------------------------------------
>> ------------------------------------------------------------
>> ------------------------------------------------------------
>> ------------------------------------------------------------
>> ------------------------------------------------------------
>> ------------------------------
>>


RE: Camera targetWidth & targetHeight

Posted by "Wargo, John" <jo...@sap.com>.
Apparently, when aspect ratio isn't maintained, it grabs one of the properties and applies it and drops the other. 

That seems odd to me too. It should fail (and call the error callback).

For me it's weird as well that on iOS in portrait, it's applying the metric to the wrong axis.


-----Original Message-----
From: James Jong [mailto:wjamesjong@gmail.com] 
Sent: Tuesday, December 03, 2013 11:35 AM
To: dev@cordova.apache.org
Subject: Re: Camera targetWidth & targetHeight

For targetWidth = 2048 , targetHeight=768, does it make sense to have the result picture with width=768,height=1024?  That seems odd to me.

-James Jong

On Dec 3, 2013, at 7:34 AM, John M. Wargo <jw...@gmail.com> 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 targetHeight 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 <jw...@gmail.com> wrote:
>> 
>>> A while back I posted a question regarding Camera targetWidth &
>>> targetHeight properties and how they worked. After some discussion, the
>>> 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 this
>>> 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 that
>>> 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 properties
>>> 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 <http://twitter.com/johnwargo>
>>> www.johnwargo.com <http://www.johnwargo.com>
>>> ------------------------------------------------------------
>>> ------------------------------------------------------------
>>> ------------------------------------------------------------
>>> ------------------------------------------------------------
>>> ------------------------------------------------------------
>>> ------------------------------------------------------------
>>> ------------------------------------------------------------
>>> ------------------------------------------------------------
>>> ------------------------------------------------------------
>>> ------------------------------------------------------------
>>> ------------------------------------------------------------
>>> ------------------------------------------------------------
>>> ------------------------------------------------------------
>>> ------------------------------------------------------------
>>> ------------------------------------------------------------
>>> ------------------------------------------------------------
>>> ------------------------------
>>> 
> 


RE: Camera targetWidth & targetHeight

Posted by "Wargo, John" <jo...@sap.com>.
Actually, I like being able to only apply one property. That is a useful use 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; aspect ratio takes care of the other one.  I would expect it to be implemented better though; iOS is applying it to the wrong axis when in portrait mode for example. 

John M. Wargo

-----Original Message-----
From: Shazron [mailto:shazron@gmail.com] 
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 <wj...@gmail.com> wrote:

> For targetWidth = 2048 , targetHeight=768, does it make sense to have the
> result picture with width=768,height=1024?  That seems odd to me.
>
> -James Jong
>
> On Dec 3, 2013, at 7:34 AM, John M. Wargo <jw...@gmail.com> 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 targetHeight
> 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 <jw...@gmail.com>
> wrote:
> >>
> >>> A while back I posted a question regarding Camera targetWidth &
> >>> targetHeight properties and how they worked. After some discussion, the
> >>> 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 this
> >>> 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 that
> >>> 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 properties
> >>> 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 <http://twitter.com/johnwargo>
> >>> www.johnwargo.com <http://www.johnwargo.com>
> >>> ------------------------------------------------------------
> >>> ------------------------------------------------------------
> >>> ------------------------------------------------------------
> >>> ------------------------------------------------------------
> >>> ------------------------------------------------------------
> >>> ------------------------------------------------------------
> >>> ------------------------------------------------------------
> >>> ------------------------------------------------------------
> >>> ------------------------------------------------------------
> >>> ------------------------------------------------------------
> >>> ------------------------------------------------------------
> >>> ------------------------------------------------------------
> >>> ------------------------------------------------------------
> >>> ------------------------------------------------------------
> >>> ------------------------------------------------------------
> >>> ------------------------------------------------------------
> >>> ------------------------------
> >>>
> >
>
>

Re: Camera targetWidth & targetHeight

Posted by Shazron <sh...@gmail.com>.
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 <wj...@gmail.com> wrote:

> For targetWidth = 2048 , targetHeight=768, does it make sense to have the
> result picture with width=768,height=1024?  That seems odd to me.
>
> -James Jong
>
> On Dec 3, 2013, at 7:34 AM, John M. Wargo <jw...@gmail.com> 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 targetHeight
> 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 <jw...@gmail.com>
> wrote:
> >>
> >>> A while back I posted a question regarding Camera targetWidth &
> >>> targetHeight properties and how they worked. After some discussion, the
> >>> 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 this
> >>> 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 that
> >>> 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 properties
> >>> 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 <http://twitter.com/johnwargo>
> >>> www.johnwargo.com <http://www.johnwargo.com>
> >>> ------------------------------------------------------------
> >>> ------------------------------------------------------------
> >>> ------------------------------------------------------------
> >>> ------------------------------------------------------------
> >>> ------------------------------------------------------------
> >>> ------------------------------------------------------------
> >>> ------------------------------------------------------------
> >>> ------------------------------------------------------------
> >>> ------------------------------------------------------------
> >>> ------------------------------------------------------------
> >>> ------------------------------------------------------------
> >>> ------------------------------------------------------------
> >>> ------------------------------------------------------------
> >>> ------------------------------------------------------------
> >>> ------------------------------------------------------------
> >>> ------------------------------------------------------------
> >>> ------------------------------
> >>>
> >
>
>

Re: Camera targetWidth & targetHeight

Posted by James Jong <wj...@gmail.com>.
For targetWidth = 2048 , targetHeight=768, does it make sense to have the result picture with width=768,height=1024?  That seems odd to me.

-James Jong

On Dec 3, 2013, at 7:34 AM, John M. Wargo <jw...@gmail.com> 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 targetHeight 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 <jw...@gmail.com> wrote:
>> 
>>> A while back I posted a question regarding Camera targetWidth &
>>> targetHeight properties and how they worked. After some discussion, the
>>> 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 this
>>> 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 that
>>> 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 properties
>>> 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 <http://twitter.com/johnwargo>
>>> www.johnwargo.com <http://www.johnwargo.com>
>>> ------------------------------------------------------------
>>> ------------------------------------------------------------
>>> ------------------------------------------------------------
>>> ------------------------------------------------------------
>>> ------------------------------------------------------------
>>> ------------------------------------------------------------
>>> ------------------------------------------------------------
>>> ------------------------------------------------------------
>>> ------------------------------------------------------------
>>> ------------------------------------------------------------
>>> ------------------------------------------------------------
>>> ------------------------------------------------------------
>>> ------------------------------------------------------------
>>> ------------------------------------------------------------
>>> ------------------------------------------------------------
>>> ------------------------------------------------------------
>>> ------------------------------
>>> 
> 


Re: Camera targetWidth & targetHeight

Posted by "John M. Wargo" <jw...@gmail.com>.
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 targetHeight 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 <jw...@gmail.com> wrote:
>
>> A while back I posted a question regarding Camera targetWidth &
>> targetHeight properties and how they worked. After some discussion, the
>> 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 this
>> 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 that
>> 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 properties
>> 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 <http://twitter.com/johnwargo>
>> www.johnwargo.com <http://www.johnwargo.com>
>> ------------------------------------------------------------
>> ------------------------------------------------------------
>> ------------------------------------------------------------
>> ------------------------------------------------------------
>> ------------------------------------------------------------
>> ------------------------------------------------------------
>> ------------------------------------------------------------
>> ------------------------------------------------------------
>> ------------------------------------------------------------
>> ------------------------------------------------------------
>> ------------------------------------------------------------
>> ------------------------------------------------------------
>> ------------------------------------------------------------
>> ------------------------------------------------------------
>> ------------------------------------------------------------
>> ------------------------------------------------------------
>> ------------------------------
>>


Re: Camera targetWidth & targetHeight

Posted by Simon MacDonald <si...@gmail.com>.
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 <jw...@gmail.com> wrote:

> A while back I posted a question regarding Camera targetWidth &
> targetHeight properties and how they worked. After some discussion, the
> 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 this
> 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 that
> 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 properties
> 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 <http://twitter.com/johnwargo>
> www.johnwargo.com <http://www.johnwargo.com>
> ------------------------------------------------------------
> ------------------------------------------------------------
> ------------------------------------------------------------
> ------------------------------------------------------------
> ------------------------------------------------------------
> ------------------------------------------------------------
> ------------------------------------------------------------
> ------------------------------------------------------------
> ------------------------------------------------------------
> ------------------------------------------------------------
> ------------------------------------------------------------
> ------------------------------------------------------------
> ------------------------------------------------------------
> ------------------------------------------------------------
> ------------------------------------------------------------
> ------------------------------------------------------------
> ------------------------------
>

Re: Camera targetWidth & targetHeight

Posted by Shazron <sh...@gmail.com>.
+1


On Fri, Dec 20, 2013 at 8:38 AM, Andrew Grieve <ag...@chromium.org> wrote:

> Just to recap (correct if I'm wrong) -
> 1. targetWidth & targetHeight are not being interpreted consistently across
> platforms.
> 2. What they should do is:
>   - Never grow the image
>   - Shrink the image while maintaining aspect ratio, such that both
> dimension of the resized image fit within targetWidth & targetHeight.
>
> Certainly sounds good to me!
>
>
> On Fri, Dec 20, 2013 at 10:49 AM, Wargo, John <jo...@sap.com> wrote:
>
> > Well I've not really received a consensus on anything. One or two people
> > have spoken up, but not much beyond that.
> >
> > John M. Wargo
> > SCN Blog: http://scn.sap.com/blogs/johnwargo
> > Twitter: @johnwargo
> >
> >
> > -----Original Message-----
> > From: Shazron [mailto:shazron@gmail.com]
> > Sent: Tuesday, December 17, 2013 1:15 AM
> > To: dev@cordova.apache.org
> > Subject: Re: Camera targetWidth & targetHeight
> >
> > Thanks John,
> > Filing the issue on iOS would be great, summarizing what needs to be done
> > (and the consensus).
> >
> >
> > On Mon, Dec 16, 2013 at 5:30 PM, John M. Wargo <jw...@gmail.com>
> wrote:
> >
> > > So, does anyone have an opinion on how this discrepancy should be
> > > addressed? The methods work differently on different platforms and I
> > think
> > > they should work the same.
> > >
> > > To me Android works as I expect it should - setting the properties
> along
> > > the right axis. Do I need to file JIRA tickets about bringing iOS into
> > > alignment?
> > >
> > > Also, what about when only one parameter is provided? Should we decide
> > how
> > > this is supposed to work and implement it across the different
> platforms?
> > >  I'm for supporting only one parameter, allows me to set the one side
> and
> > > let the camera aspect ratio determine the other.
> > >
> > >
> > > -------- Original Message --------
> > > Subject:        Camera targetWidth & targetHeight
> > > Date:   Mon, 02 Dec 2013 22:15:06 -0500
> > > From:   John M. Wargo <jw...@gmail.com>
> > > To:     Cordova Dev <de...@cordova.apache.org>
> > >
> > >
> > >
> > > A while back I posted a question regarding Camera targetWidth &
> > > targetHeight properties and how they worked. After some discussion, the
> > > 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 this
> > > 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 that
> > > 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 properties
> > > 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 <http://twitter.com/johnwargo>
> > > www.johnwargo.com <http://www.johnwargo.com>
> > > ------------------------------------------------------------
> > > ------------------------------------------------------------
> > > ------------------------------------------------------------
> > > ------------------------------------------------------------
> > > ------------------------------------------------------------
> > > ------------------------------------------------------------
> > > ------------------------------------------------------------
> > > ------------------------------------------------------------
> > > ------------------------------------------------------------
> > > ------------------------------------------------------------
> > > ------------------------------------------------------------
> > > ------------------------------------------------------------
> > > ------------------------------------------------------------
> > > ------------------------------------------------------------
> > > ------------------------------------------------------------
> > > ------------------------------------------------------------
> > > ------------------------------
> > >
> > > --
> > > John M. Wargo
> > > @johnwargo <http://twitter.com/johnwargo>
> > > www.johnwargo.com <http://www.johnwargo.com>
> > > ------------------------------------------------------------
> > > ------------------------------------------------------------
> > > ------------------------------------------------------------
> > > ------------------------------------------------------------
> > > ------------------------------------------------------------
> > > ------------------------------------------------------------
> > > ------------------------------------------------------------
> > > ------------------------------------------------------------
> > > ------------------------------------------------------------
> > > ------------------------------------------------------------
> > > ------------------------------------------------------------
> > > ------------------------------------------------------------
> > > ------------------------------------------------------------
> > > ------------------------------------------------------------
> > > ------------------------------------------------------------
> > > ------------------------------------------------------------
> > > ------------------------------
> > >
> > >
> > >
> >
>

Re: Camera targetWidth & targetHeight

Posted by Brian LeRoux <b...@brian.io>.
+1. Open bugs John :)
On Dec 21, 2013 2:49 AM, "Andrew Grieve" <ag...@chromium.org> wrote:

> Just to recap (correct if I'm wrong) -
> 1. targetWidth & targetHeight are not being interpreted consistently across
> platforms.
> 2. What they should do is:
>   - Never grow the image
>   - Shrink the image while maintaining aspect ratio, such that both
> dimension of the resized image fit within targetWidth & targetHeight.
>
> Certainly sounds good to me!
>
>
> On Fri, Dec 20, 2013 at 10:49 AM, Wargo, John <jo...@sap.com> wrote:
>
> > Well I've not really received a consensus on anything. One or two people
> > have spoken up, but not much beyond that.
> >
> > John M. Wargo
> > SCN Blog: http://scn.sap.com/blogs/johnwargo
> > Twitter: @johnwargo
> >
> >
> > -----Original Message-----
> > From: Shazron [mailto:shazron@gmail.com]
> > Sent: Tuesday, December 17, 2013 1:15 AM
> > To: dev@cordova.apache.org
> > Subject: Re: Camera targetWidth & targetHeight
> >
> > Thanks John,
> > Filing the issue on iOS would be great, summarizing what needs to be done
> > (and the consensus).
> >
> >
> > On Mon, Dec 16, 2013 at 5:30 PM, John M. Wargo <jw...@gmail.com>
> wrote:
> >
> > > So, does anyone have an opinion on how this discrepancy should be
> > > addressed? The methods work differently on different platforms and I
> > think
> > > they should work the same.
> > >
> > > To me Android works as I expect it should - setting the properties
> along
> > > the right axis. Do I need to file JIRA tickets about bringing iOS into
> > > alignment?
> > >
> > > Also, what about when only one parameter is provided? Should we decide
> > how
> > > this is supposed to work and implement it across the different
> platforms?
> > >  I'm for supporting only one parameter, allows me to set the one side
> and
> > > let the camera aspect ratio determine the other.
> > >
> > >
> > > -------- Original Message --------
> > > Subject:        Camera targetWidth & targetHeight
> > > Date:   Mon, 02 Dec 2013 22:15:06 -0500
> > > From:   John M. Wargo <jw...@gmail.com>
> > > To:     Cordova Dev <de...@cordova.apache.org>
> > >
> > >
> > >
> > > A while back I posted a question regarding Camera targetWidth &
> > > targetHeight properties and how they worked. After some discussion, the
> > > 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 this
> > > 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 that
> > > 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 properties
> > > 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 <http://twitter.com/johnwargo>
> > > www.johnwargo.com <http://www.johnwargo.com>
> > > ------------------------------------------------------------
> > > ------------------------------------------------------------
> > > ------------------------------------------------------------
> > > ------------------------------------------------------------
> > > ------------------------------------------------------------
> > > ------------------------------------------------------------
> > > ------------------------------------------------------------
> > > ------------------------------------------------------------
> > > ------------------------------------------------------------
> > > ------------------------------------------------------------
> > > ------------------------------------------------------------
> > > ------------------------------------------------------------
> > > ------------------------------------------------------------
> > > ------------------------------------------------------------
> > > ------------------------------------------------------------
> > > ------------------------------------------------------------
> > > ------------------------------
> > >
> > > --
> > > John M. Wargo
> > > @johnwargo <http://twitter.com/johnwargo>
> > > www.johnwargo.com <http://www.johnwargo.com>
> > > ------------------------------------------------------------
> > > ------------------------------------------------------------
> > > ------------------------------------------------------------
> > > ------------------------------------------------------------
> > > ------------------------------------------------------------
> > > ------------------------------------------------------------
> > > ------------------------------------------------------------
> > > ------------------------------------------------------------
> > > ------------------------------------------------------------
> > > ------------------------------------------------------------
> > > ------------------------------------------------------------
> > > ------------------------------------------------------------
> > > ------------------------------------------------------------
> > > ------------------------------------------------------------
> > > ------------------------------------------------------------
> > > ------------------------------------------------------------
> > > ------------------------------
> > >
> > >
> > >
> >
>

RE: Camera targetWidth & targetHeight

Posted by "Wargo, John" <jo...@sap.com>.
That works for me. What about if you only supply one parameter? I think that should be supported and iOS be adjusted to it applies to the 'right' axis.

John M. Wargo
Twitter: @johnwargo


-----Original Message-----
From: agrieve@google.com [mailto:agrieve@google.com] On Behalf Of Andrew Grieve
Sent: Friday, December 20, 2013 11:39 AM
To: dev
Subject: Re: Camera targetWidth & targetHeight

Just to recap (correct if I'm wrong) -
1. targetWidth & targetHeight are not being interpreted consistently across
platforms.
2. What they should do is:
  - Never grow the image
  - Shrink the image while maintaining aspect ratio, such that both
dimension of the resized image fit within targetWidth & targetHeight.

Certainly sounds good to me!


On Fri, Dec 20, 2013 at 10:49 AM, Wargo, John <jo...@sap.com> wrote:

> Well I've not really received a consensus on anything. One or two people
> have spoken up, but not much beyond that.
>
> John M. Wargo
> SCN Blog: http://scn.sap.com/blogs/johnwargo
> Twitter: @johnwargo
>
>
> -----Original Message-----
> From: Shazron [mailto:shazron@gmail.com]
> Sent: Tuesday, December 17, 2013 1:15 AM
> To: dev@cordova.apache.org
> Subject: Re: Camera targetWidth & targetHeight
>
> Thanks John,
> Filing the issue on iOS would be great, summarizing what needs to be done
> (and the consensus).
>
>
> On Mon, Dec 16, 2013 at 5:30 PM, John M. Wargo <jw...@gmail.com> wrote:
>
> > So, does anyone have an opinion on how this discrepancy should be
> > addressed? The methods work differently on different platforms and I
> think
> > they should work the same.
> >
> > To me Android works as I expect it should - setting the properties along
> > the right axis. Do I need to file JIRA tickets about bringing iOS into
> > alignment?
> >
> > Also, what about when only one parameter is provided? Should we decide
> how
> > this is supposed to work and implement it across the different platforms?
> >  I'm for supporting only one parameter, allows me to set the one side and
> > let the camera aspect ratio determine the other.
> >
> >
> > -------- Original Message --------
> > Subject:        Camera targetWidth & targetHeight
> > Date:   Mon, 02 Dec 2013 22:15:06 -0500
> > From:   John M. Wargo <jw...@gmail.com>
> > To:     Cordova Dev <de...@cordova.apache.org>
> >
> >
> >
> > A while back I posted a question regarding Camera targetWidth &
> > targetHeight properties and how they worked. After some discussion, the
> > 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 this
> > 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 that
> > 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 properties
> > 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 <http://twitter.com/johnwargo>
> > www.johnwargo.com <http://www.johnwargo.com>
> > ------------------------------------------------------------
> > ------------------------------------------------------------
> > ------------------------------------------------------------
> > ------------------------------------------------------------
> > ------------------------------------------------------------
> > ------------------------------------------------------------
> > ------------------------------------------------------------
> > ------------------------------------------------------------
> > ------------------------------------------------------------
> > ------------------------------------------------------------
> > ------------------------------------------------------------
> > ------------------------------------------------------------
> > ------------------------------------------------------------
> > ------------------------------------------------------------
> > ------------------------------------------------------------
> > ------------------------------------------------------------
> > ------------------------------
> >
> > --
> > John M. Wargo
> > @johnwargo <http://twitter.com/johnwargo>
> > www.johnwargo.com <http://www.johnwargo.com>
> > ------------------------------------------------------------
> > ------------------------------------------------------------
> > ------------------------------------------------------------
> > ------------------------------------------------------------
> > ------------------------------------------------------------
> > ------------------------------------------------------------
> > ------------------------------------------------------------
> > ------------------------------------------------------------
> > ------------------------------------------------------------
> > ------------------------------------------------------------
> > ------------------------------------------------------------
> > ------------------------------------------------------------
> > ------------------------------------------------------------
> > ------------------------------------------------------------
> > ------------------------------------------------------------
> > ------------------------------------------------------------
> > ------------------------------
> >
> >
> >
>

Re: Camera targetWidth & targetHeight

Posted by Andrew Grieve <ag...@chromium.org>.
Just to recap (correct if I'm wrong) -
1. targetWidth & targetHeight are not being interpreted consistently across
platforms.
2. What they should do is:
  - Never grow the image
  - Shrink the image while maintaining aspect ratio, such that both
dimension of the resized image fit within targetWidth & targetHeight.

Certainly sounds good to me!


On Fri, Dec 20, 2013 at 10:49 AM, Wargo, John <jo...@sap.com> wrote:

> Well I've not really received a consensus on anything. One or two people
> have spoken up, but not much beyond that.
>
> John M. Wargo
> SCN Blog: http://scn.sap.com/blogs/johnwargo
> Twitter: @johnwargo
>
>
> -----Original Message-----
> From: Shazron [mailto:shazron@gmail.com]
> Sent: Tuesday, December 17, 2013 1:15 AM
> To: dev@cordova.apache.org
> Subject: Re: Camera targetWidth & targetHeight
>
> Thanks John,
> Filing the issue on iOS would be great, summarizing what needs to be done
> (and the consensus).
>
>
> On Mon, Dec 16, 2013 at 5:30 PM, John M. Wargo <jw...@gmail.com> wrote:
>
> > So, does anyone have an opinion on how this discrepancy should be
> > addressed? The methods work differently on different platforms and I
> think
> > they should work the same.
> >
> > To me Android works as I expect it should - setting the properties along
> > the right axis. Do I need to file JIRA tickets about bringing iOS into
> > alignment?
> >
> > Also, what about when only one parameter is provided? Should we decide
> how
> > this is supposed to work and implement it across the different platforms?
> >  I'm for supporting only one parameter, allows me to set the one side and
> > let the camera aspect ratio determine the other.
> >
> >
> > -------- Original Message --------
> > Subject:        Camera targetWidth & targetHeight
> > Date:   Mon, 02 Dec 2013 22:15:06 -0500
> > From:   John M. Wargo <jw...@gmail.com>
> > To:     Cordova Dev <de...@cordova.apache.org>
> >
> >
> >
> > A while back I posted a question regarding Camera targetWidth &
> > targetHeight properties and how they worked. After some discussion, the
> > 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 this
> > 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 that
> > 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 properties
> > 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 <http://twitter.com/johnwargo>
> > www.johnwargo.com <http://www.johnwargo.com>
> > ------------------------------------------------------------
> > ------------------------------------------------------------
> > ------------------------------------------------------------
> > ------------------------------------------------------------
> > ------------------------------------------------------------
> > ------------------------------------------------------------
> > ------------------------------------------------------------
> > ------------------------------------------------------------
> > ------------------------------------------------------------
> > ------------------------------------------------------------
> > ------------------------------------------------------------
> > ------------------------------------------------------------
> > ------------------------------------------------------------
> > ------------------------------------------------------------
> > ------------------------------------------------------------
> > ------------------------------------------------------------
> > ------------------------------
> >
> > --
> > John M. Wargo
> > @johnwargo <http://twitter.com/johnwargo>
> > www.johnwargo.com <http://www.johnwargo.com>
> > ------------------------------------------------------------
> > ------------------------------------------------------------
> > ------------------------------------------------------------
> > ------------------------------------------------------------
> > ------------------------------------------------------------
> > ------------------------------------------------------------
> > ------------------------------------------------------------
> > ------------------------------------------------------------
> > ------------------------------------------------------------
> > ------------------------------------------------------------
> > ------------------------------------------------------------
> > ------------------------------------------------------------
> > ------------------------------------------------------------
> > ------------------------------------------------------------
> > ------------------------------------------------------------
> > ------------------------------------------------------------
> > ------------------------------
> >
> >
> >
>

RE: Camera targetWidth & targetHeight

Posted by "Wargo, John" <jo...@sap.com>.
Well I've not really received a consensus on anything. One or two people have spoken up, but not much beyond that. 

John M. Wargo
SCN Blog: http://scn.sap.com/blogs/johnwargo 
Twitter: @johnwargo


-----Original Message-----
From: Shazron [mailto:shazron@gmail.com] 
Sent: Tuesday, December 17, 2013 1:15 AM
To: dev@cordova.apache.org
Subject: Re: Camera targetWidth & targetHeight

Thanks John,
Filing the issue on iOS would be great, summarizing what needs to be done
(and the consensus).


On Mon, Dec 16, 2013 at 5:30 PM, John M. Wargo <jw...@gmail.com> wrote:

> So, does anyone have an opinion on how this discrepancy should be
> addressed? The methods work differently on different platforms and I think
> they should work the same.
>
> To me Android works as I expect it should - setting the properties along
> the right axis. Do I need to file JIRA tickets about bringing iOS into
> alignment?
>
> Also, what about when only one parameter is provided? Should we decide how
> this is supposed to work and implement it across the different platforms?
>  I'm for supporting only one parameter, allows me to set the one side and
> let the camera aspect ratio determine the other.
>
>
> -------- Original Message --------
> Subject:        Camera targetWidth & targetHeight
> Date:   Mon, 02 Dec 2013 22:15:06 -0500
> From:   John M. Wargo <jw...@gmail.com>
> To:     Cordova Dev <de...@cordova.apache.org>
>
>
>
> A while back I posted a question regarding Camera targetWidth &
> targetHeight properties and how they worked. After some discussion, the
> 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 this
> 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 that
> 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 properties
> 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 <http://twitter.com/johnwargo>
> www.johnwargo.com <http://www.johnwargo.com>
> ------------------------------------------------------------
> ------------------------------------------------------------
> ------------------------------------------------------------
> ------------------------------------------------------------
> ------------------------------------------------------------
> ------------------------------------------------------------
> ------------------------------------------------------------
> ------------------------------------------------------------
> ------------------------------------------------------------
> ------------------------------------------------------------
> ------------------------------------------------------------
> ------------------------------------------------------------
> ------------------------------------------------------------
> ------------------------------------------------------------
> ------------------------------------------------------------
> ------------------------------------------------------------
> ------------------------------
>
> --
> John M. Wargo
> @johnwargo <http://twitter.com/johnwargo>
> www.johnwargo.com <http://www.johnwargo.com>
> ------------------------------------------------------------
> ------------------------------------------------------------
> ------------------------------------------------------------
> ------------------------------------------------------------
> ------------------------------------------------------------
> ------------------------------------------------------------
> ------------------------------------------------------------
> ------------------------------------------------------------
> ------------------------------------------------------------
> ------------------------------------------------------------
> ------------------------------------------------------------
> ------------------------------------------------------------
> ------------------------------------------------------------
> ------------------------------------------------------------
> ------------------------------------------------------------
> ------------------------------------------------------------
> ------------------------------
>
>
>

Re: Camera targetWidth & targetHeight

Posted by Shazron <sh...@gmail.com>.
Thanks John,
Filing the issue on iOS would be great, summarizing what needs to be done
(and the consensus).


On Mon, Dec 16, 2013 at 5:30 PM, John M. Wargo <jw...@gmail.com> wrote:

> So, does anyone have an opinion on how this discrepancy should be
> addressed? The methods work differently on different platforms and I think
> they should work the same.
>
> To me Android works as I expect it should - setting the properties along
> the right axis. Do I need to file JIRA tickets about bringing iOS into
> alignment?
>
> Also, what about when only one parameter is provided? Should we decide how
> this is supposed to work and implement it across the different platforms?
>  I'm for supporting only one parameter, allows me to set the one side and
> let the camera aspect ratio determine the other.
>
>
> -------- Original Message --------
> Subject:        Camera targetWidth & targetHeight
> Date:   Mon, 02 Dec 2013 22:15:06 -0500
> From:   John M. Wargo <jw...@gmail.com>
> To:     Cordova Dev <de...@cordova.apache.org>
>
>
>
> A while back I posted a question regarding Camera targetWidth &
> targetHeight properties and how they worked. After some discussion, the
> 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 this
> 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 that
> 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 properties
> 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 <http://twitter.com/johnwargo>
> www.johnwargo.com <http://www.johnwargo.com>
> ------------------------------------------------------------
> ------------------------------------------------------------
> ------------------------------------------------------------
> ------------------------------------------------------------
> ------------------------------------------------------------
> ------------------------------------------------------------
> ------------------------------------------------------------
> ------------------------------------------------------------
> ------------------------------------------------------------
> ------------------------------------------------------------
> ------------------------------------------------------------
> ------------------------------------------------------------
> ------------------------------------------------------------
> ------------------------------------------------------------
> ------------------------------------------------------------
> ------------------------------------------------------------
> ------------------------------
>
> --
> John M. Wargo
> @johnwargo <http://twitter.com/johnwargo>
> www.johnwargo.com <http://www.johnwargo.com>
> ------------------------------------------------------------
> ------------------------------------------------------------
> ------------------------------------------------------------
> ------------------------------------------------------------
> ------------------------------------------------------------
> ------------------------------------------------------------
> ------------------------------------------------------------
> ------------------------------------------------------------
> ------------------------------------------------------------
> ------------------------------------------------------------
> ------------------------------------------------------------
> ------------------------------------------------------------
> ------------------------------------------------------------
> ------------------------------------------------------------
> ------------------------------------------------------------
> ------------------------------------------------------------
> ------------------------------
>
>
>

Fwd: Camera targetWidth & targetHeight

Posted by "John M. Wargo" <jw...@gmail.com>.
So, does anyone have an opinion on how this discrepancy should be addressed? The methods work differently on different platforms and I think they should work the same.

To me Android works as I expect it should - setting the properties along the right axis. Do I need to file JIRA tickets about bringing iOS into alignment?

Also, what about when only one parameter is provided? Should we decide how this is supposed to work and implement it across the different platforms?  I'm for supporting only one parameter, allows me to set the one side and let the camera aspect ratio determine the other.

-------- Original Message --------
Subject: 	Camera targetWidth & targetHeight
Date: 	Mon, 02 Dec 2013 22:15:06 -0500
From: 	John M. Wargo <jw...@gmail.com>
To: 	Cordova Dev <de...@cordova.apache.org>



A while back I posted a question regarding Camera targetWidth & targetHeight properties and how they worked. After some discussion, the 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 this 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 that 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 properties 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 <http://twitter.com/johnwargo>
www.johnwargo.com <http://www.johnwargo.com>
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

-- 
John M. Wargo
@johnwargo <http://twitter.com/johnwargo>
www.johnwargo.com <http://www.johnwargo.com>
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------