You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by trubit <gi...@git.apache.org> on 2015/08/27 23:40:29 UTC

[GitHub] cordova-plugin-camera pull request: Retaining image ratio when res...

GitHub user trubit opened a pull request:

    https://github.com/apache/cordova-plugin-camera/pull/118

    Retaining image ratio when resizing

    According to documentation and iOS/Android behavior, resized images should retain ratio. This code fixes windows scaling.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/trubit/cordova-plugin-camera master

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/cordova-plugin-camera/pull/118.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #118
    
----
commit 3918643f866bf26fe3463dea3ac8e9e28c62491b
Author: Jakub Navrátil <na...@gmail.com>
Date:   2015-08-27T21:32:50Z

    Retaining image ratio when resizing

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-camera pull request: Retaining image ratio when res...

Posted by trubit <gi...@git.apache.org>.
Github user trubit commented on the pull request:

    https://github.com/apache/cordova-plugin-camera/pull/118#issuecomment-136507080
  
    Yeah, in my case it worked, but correct calculation is:
        var scale = Math.min(targetWidth / this.width, targetHeight / this.height);
    
    Calculates ratio for both sides and pick the small one


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-camera pull request: Retaining image ratio when res...

Posted by muratsu <gi...@git.apache.org>.
Github user muratsu commented on the pull request:

    https://github.com/apache/cordova-plugin-camera/pull/118#issuecomment-136498895
  
    I think the logic needs some rework.
    Imagine original picture with size 2w x 1h (aspect ratio 2). If we want to scale this image to 10x5 this CR will provide us with 5x2.5 which is not the most optimum outcome. 
    
    Ideally the outcome should be:
    
    original width x height | aspect ratio
    --- | ---
    2x1 | 2
    
     target width x height  | target aspect ratio | output width x height | output aspect ratio
    --- | --- | --- | ---
    10x5 | 2 | 10x5 | 2
    12x5 | 2,4 | 10x5 | 2
    8x5 | 1,6 | 8x4 | 2


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-camera pull request: Retaining image ratio when res...

Posted by vladimir-kotikov <gi...@git.apache.org>.
Github user vladimir-kotikov commented on the pull request:

    https://github.com/apache/cordova-plugin-camera/pull/118#issuecomment-138862030
  
    This was merged in https://github.com/apache/cordova-plugin-camera/commit/cad9ab0419ec3c90f0c052483177952d364a353d but not auto-closed. @trubit, close please.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-camera pull request: Retaining image ratio when res...

Posted by nikhilkh <gi...@git.apache.org>.
Github user nikhilkh commented on the pull request:

    https://github.com/apache/cordova-plugin-camera/pull/118#issuecomment-135613806
  
    @muratsu Can you please review?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-camera pull request: Retaining image ratio when res...

Posted by muratsu <gi...@git.apache.org>.
Github user muratsu commented on the pull request:

    https://github.com/apache/cordova-plugin-camera/pull/118#issuecomment-136510649
  
    Yup, looks like right. Thanks!


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-camera pull request: Retaining image ratio when res...

Posted by vladimir-kotikov <gi...@git.apache.org>.
Github user vladimir-kotikov commented on the pull request:

    https://github.com/apache/cordova-plugin-camera/pull/118#issuecomment-138917699
  
    Thanks


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-camera pull request: Retaining image ratio when res...

Posted by trubit <gi...@git.apache.org>.
Github user trubit closed the pull request at:

    https://github.com/apache/cordova-plugin-camera/pull/118


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org