Search code examples
androidimageandroid-gallery

Opening image in Gallery app programatically shows low resolution


I download and save an image on button click in my app. This works fine. If I view this image via the Gallery app (or any other way) it looks fine.

However, if I try to open the image with:

Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(imageFile), "image/*");
startActivity(intent);

It prompts me what app I want to open the file with (Gallery or Photos). If I select Gallery, the image opens but is very low resolution. As the photo contains a lot of text, it makes it so you can't zoom in and read. If I select "Photos", it looks fine.

Is there anything I can do to make it work fine in Gallery?


Solution

  • So I was saving the image with no extension. As it was opening in Gallery I figured it knew it was an image, but as soon as I added ".jpeg" to the file name, it showed in correct resolution. Strange bug, figured I'd update just in case someone else was hoping to find an answer here at some point.