-
-
Notifications
You must be signed in to change notification settings - Fork 72
Pictures selected have wrong orientation #45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
+1 |
Hey I ended up using an image cropper plugin in order to allow the user the choose the correct orientation and size. You would probably have to use an image cropper if you intend to use the image within the application anyway since the images stored on the device are probably enormous. |
@xerotolerant Can you share the plugin? is there a demo by any chance? |
I think it was this one. I am not 100% sure though. It was a long time ago and I have since moved away from nativescript. but basically after you choose the image and the promise returns the image. In your success function immidiately invoke the image cropper. Once the user uses it it returns the cropped image at the size it appears on screen (or a size you choose). A 4MB 12MP photo would then become an 800x600 4xxKB image so you can upload it or whatever from there. I remember running out of memory after loading a few images directly from storage simply because it was too large |
Thank you @xerotolerant ! |
+1 here... Is this plugin being maintained??? |
It doesn't seem to be but I haven't encountered any problems with it. I remember being skeptical because of how long it was since the last commit. However I really had no choice. So far it hasn't let me down. |
Well there's this orientation issue. I'd prefer to solve it w/o adding another plugin. |
@i have only encountered this problem on Android. I obtained a hacky fix by adding:
immediately before:
in the decodeUri function in viewmodel.android.ts Then I can obtain the rotation angle from the imagesource obtained from .getImage(), and bind that to: <Image [src]="fileUri" [rotate]="imageSource.rotationAngle"> |
I don't remember myself but it might have been on android too. On a related note, have you ever run out of memory after using multiple images directly?
…Sent from my iPhone
On 20 Jan 2017, at 10:05 PM, Jason K. Ellis ***@***.***> wrote:
I have only encountered this problem on Android. I obtained a hacky fix by adding:
image.setRotationAngleFromFile(this._calculateFileUri(uri));
immediately before:
return image;
in the decodeUri function.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Yes, I have. That's what led me to tracking down this problem. I noticed the image rotation problem on Android, and sought to remedy it by instantiating imageSource.fromFile(filename).rotationAngle. Naturally, this led to OOM error when loading a list of images because they weren't being garbage collected. I found that by employing this fix and extracting the rotation angle when choosing the image, then storing it, the imagesource instance would be garbage collected. |
@tsonevn Is it possible to make it so that the imageSource that is returned from SelectedAsset.getImage() contains the rotation angle if the image is located on the android device? I've done some testing, and it is clear that the rotation angle is not defined for images without a fileUri (located on Google Drive for example). In a previous version of imagepicker, there was an internal function in viewmodel.android.ts: image.setRotationAngleFromFile(this._calculateFileUri(uri)); |
Any fix for this ? |
+1 |
1 similar comment
+1 |
+1 really need this to be fixed |
Hi! It would be fantastic if you could solve this error, we use this plugin very often and it is really very useful. Thanks! |
I can confirm that the solution given by @vagabond92 worked for me !! Just need to add this line in 'imagepicker.android.js' (like explain in @vagabond92 previous post) : This will add the 'rotationAngle' property to the imageSource getted from selection result of this plugin. From memory, the following template code given by @vagabond92 didn't works for me
So instead I use this code (in my composant ts file) ;
And then the imageSource have the good orientation ! PS : need the tns-platform-declarations plugin to make it work |
+1 |
1 similar comment
+1 |
Meanwhile you can use the following repository with the applied fix To install it: |
Hi guys, There are few possible reasons for getting images with a wrong orientation:
Could you share some code snippets with the way you pass the images from the Image Picker to the Image View? We also made a lot of improvements in the images processing. You could track their status in the following pull requests: |
I am still seeing this issue with NS 3.4 and Image Picker 4.0.1. Here is my call:
profileImage looks like:
|
Example of code working using the forked branch:
|
I see there's a new version of this plugin (5.0.0), was this bug fixed? |
@gabitoesmiapodo, the fixes in the above-mentioned pull requests are part of the NativeScript Core Modules (not in this plugin) and they are currently available in the |
@DimitarTachev sorry, but I don't understand. Is this particular bug, for this plugin, fixed? Was it somehow fixed in tns-core-modules and not in nativescript-imagepicker? |
@gabitoesmiapodo The bug is fixed in |
Hi guys, the latest version of |
Upon selecting an image using nativescript-imagepicker plugin. Sometimes the image orientation is incorrect event though it was correct in the picker. I suspect it has something to do with the orientation which the picture was taken in however it is pretty inconsistent. Is there a way to do it internally or do I have to use an additional tool?
The text was updated successfully, but these errors were encountered: