I am trying to use Picasso to load images in an app from the SD card. If I load images that were not taken by the camera they load in fine, but if I try to get images that were taken by the camera they don't load.
Images over http work too, just not the camera ones.
I have also tried downloading the image from that URL and putting it on the phones storage, it loads fine that way too, it only seems to be images taken from the phones camera. Tested it on Galaxy S2 and S5 and a Galaxy Ace 3. So it could be a Samsung/Galaxy issue only.
Calling Code:
String file = "/storage/extSdCard/DCIM/Camera/20140609_204344.jpg";
picasso
.load(new File(file)) // this does not work
//.load("http://upload.wikimedia.org/wikipedia/commons/4/4e/Pleiades_large.jpg")// this works
.fit()
.error(R.drawable.logo)
.into(this.imageView);
Exception that occurs:
06-09 21:31:47.662: W/System.err(16633): java.lang.IllegalArgumentException: y + height must be <= bitmap.height()
06-09 21:31:47.672: W/System.err(16633): at android.graphics.Bitmap.createBitmap(Bitmap.java:783)
06-09 21:31:47.672: W/System.err(16633): at com.squareup.picasso.BitmapHunter.transformResult(BitmapHunter.java:457)
06-09 21:31:47.672: W/System.err(16633): at com.squareup.picasso.BitmapHunter.hunt(BitmapHunter.java:154)
06-09 21:31:47.672: W/System.err(16633): at com.squareup.picasso.BitmapHunter.run(BitmapHunter.java:101)
06-09 21:31:47.672: W/System.err(16633): at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)
06-09 21:31:47.672: W/System.err(16633): at java.util.concurrent.FutureTask.run(FutureTask.java:237)
06-09 21:31:47.672: W/System.err(16633): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
06-09 21:31:47.672: W/System.err(16633): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
06-09 21:31:47.672: W/System.err(16633): at java.lang.Thread.run(Thread.java:841)
06-09 21:31:47.672: W/System.err(16633): at com.squareup.picasso.Utils$PicassoThread.run(Utils.java:394)
Try adding the local file prefix "file://":
String file = "file:///storage/extSdCard/DCIM/Camera/20140609_204344.jpg";
That doesn't work when using File(), but I did try pass that in as a plain string which doesn't work for camera images but does work for other images on the file system
I am already looking at another issue like this. Thanks for filing it though.
Does it work with Picasso 2.2?
Looking at this now.
I managed to reproduce the issue. I am fixing this now.
This is something that will be fixed this week.
How is it going fixing the problem? When we can expect the update?
@kestasb can you try 2.3.3-SNAPSHOT? We merged a fixed yesterday.
I had a similar problem and it works for me now. If you want I can share my demo app that I used for testing. When are you planning to release 2.3.3?
When are you planning to release 2.3.3?
We don't do ETAs, sorry. We'll release when we're sure it's ready.
May you please build a jar for a pre-release version 2.3.3?
Just download sources and run "mvn install" to build the latest jar.
@dnkoutso Just tested 2.3.3 snapshot and it is working like version 2.2.0, photo is displayed but cropped incorrectly. Just try yourself to load this image from SD card using .resize(100, 75) and .centerCrop().
I tried it and the image was stretched to fill the screen. Then I change to ImageView scaleType to "center" and it looks good now.
The image should be cropped 100px width and 75px height but something is mixed up in the code because incorrect bitmap is returned.
I looks like it was cropped as you wrote, so 100 px width and 75 px height and after that it was rotated using the EXIF information from the original file, so the output is 75 px wide and 100 px high. It's hard to say if that's a bug or a feature.
Yes, exactly. I hope it is a bug and will be fixed :)
Is anyone fixing the problem?
Also running into this issue but only on Note 3 and S3. Samsung devices ftw....
Also works fine with screenshots from those devices, only camera photos seem to not work.
Hmm I notice this issue too. In addition to the "Camera roll" folder, I also have issues with images in the "Download" folder. Other folders create by other apps seem ok. Odd little fella this bug. But kind of critical :(
Sorry I missed the comment above. 2.3.3-SNAPSHOT fixes the issue.
When the photo orientation issue in 2.3.3 is about to be fixed?
This happens to me too in 2.3.2. Trying with repo version fixes some of the bugs I'm actually having, but for instance taking a photo with the Samsung Galaxy S4 rear camera crashes the app for the same reason.
I am on vacation. I can take a look at this next week.
Crashes the app? If so whats the stacktrace?
Had the same problem with 2.3.2 on Samsung Galaxy ACE 3. It wasn't because of the size of images, but rather something with the default samsung camera app, because another camera app from gplay made bigger photos but Picasso handled them nicely.
Anyway, with 2.3.3-SNAPSHOT the problem disappeard.
Btw, building this maven project in Android Studio was really a pita. I wonder if you guys are planning to move to gradle.
Last but not least - great lib :)
Doing further testing I discovered that the crash was because other reason in the app I'm using this library. With the current repo version all camera bugs are fixed! :)
@dnkoutso Are you working on a fix for incorrect resize due to photo orientation in exif data? When can we expect the update?
@kestasb The fix is already in master
. We don't give ETAs.
@JakeWharton The problem still exists displaying images from SD card with rotation in exif data.
Just try to display this image from SD card. It is resized incorrectly during display.
Then it's probably this bug: https://github.com/square/picasso/issues/566
@JakeWharton Yes, looks like the same issue. How to solve it correctly?
Will take a look today. I am back.
@dnkoutso how is it going with a fix?
@kestasb Sorry for the delay on this. I am focusing on Picasso now.
I think I found the problem. #566 might be the right fix. Looking a bit more.
@kestasb The problem is that Kitkat is returning the new documents provider URI for the image. Picasso is not using MediaStoreBitmapHunter
.
This is a bigger problem because picasso is maven based to support unit-tests. In order to use Kit-Kat picasso would have to be converted to Gradle first.
We are looking into this.
@kestasb
Here's a transformation you can apply now to fix this until it gets properly fixed on master.
https://gist.github.com/dnkoutso/9e34a1bba3d63034e863
Uri uri = Uri.parse(imageUri);
Picasso.with(this)
.load(uri)
.fit()
.skipMemoryCache()
.transform(new DocumentExifTransformation(this, uri))
.into(imageView);
I am closing this issue. Please follow through on #566
@dnkoutso Hello, sorry for commenting on a closed issue but I'm experiencing the same bug on a 2013 Moto X on the latest release (2.5.2).
The Moto X is running Kit Kat 4.4.4.
Use
Picasso picasso = new Picasso.Builder(context).listener(new Picasso.Listener() {
@Override public void onImageLoadFailed(Picasso picasso, Uri uri, Exception exception) {
exception.printStackTrace();
}
}).build();
See what the stacktrace says.
@dnkoutso I did just that, it threw no exception, but it still failed to load the image.
Here's a vide of the bug: https://youtu.be/7sYfbuQ-DvU
The images with the green background are all placeholder images. They're supposed to be camera pictures, but they don't load. Other pictures load fine.
@dnkoutso having the same issue here. Picasso 2.5.2 fails to load images from camera. It doesn't throw any exception, the only trace I get of this error is when I attach a Target
to the ImageView
and it triggers the onBitmapFailed()
method.
I am using a Moto G on Android 5.0.1.
NB: it may be useful to know that I don't get this error using Genymotion's emulator camera.
Thanks
I'm getting java.lang.IllegalStateException: Unrecognized type of request: Request{/storage/sdcard0/Pictures/[my folder]/[image_name].jpg} on cyanogenmod kitkat picasso 2.5.2
Getting this too.
Hey, I've got the same problem, I implemented what dnkoutso said and I get "java.io.IOException: Cannot Reset"
Try 2.6.0-SNAPSHOT
On Mon, Mar 28, 2016 at 2:55 PM Sinnup [email protected] wrote:
Hey, I've got the same problem, I implemented what dnkoutso said and I get
"java.io.IOException: Cannot Reset"—
You are receiving this because you were mentioned.Reply to this email directly or view it on GitHub
https://github.com/square/picasso/issues/539#issuecomment-202528371
Thanks @JakeWharton , I'm not really experimented on this, how could I implement that version into my Android Studio project? Do I put it in graddle?
@JakeWharton it works with 2.6.0 SNAPSHOT
I've got an issue to compile, it does not.
compile 'com.squareup.picasso:picasso:2.6.0-SNAPSHOT'
I've writen also :
buildscript {
repositories {
jcenter()
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
}
Use Glide lib, it resolves this problem.
compile 'com.github.bumptech.glide:glide:3.7.0'
@dpedroza Thanks a lot, it works as expected.
on motox 5.0.1 removing fit and center crop when loading images from file prevents this issue
I am experiencing this too.
Camera images don't seem to load especially the ones with sizes greater than 1mb.
Is there any hack or fix available?
I'm seeing this issue as well on a MotoX (2nd Gen) on Android 5.1. Saved or edited files display properly, but anything from the camera does not display. Removing fit, center crop, etc as @jiancchen suggested did not resolve it for me. Seeing the issue on picasso version 2.5.2 and 2.6.0-SNAPSHOT
Most helpful comment
I am experiencing this too.
Camera images don't seem to load especially the ones with sizes greater than 1mb.
Is there any hack or fix available?