Improve image preview speed (media store thumb vs exif thumb)
- Dominant language
- Java
- Stars
- 35k
- Forks
- 6.2k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 8
Description
I tested loading images via the media store thumbnail vs. getting the exif thumbnail and I think using the exif thumbnail is much faster (resolution is similar, but not equal!).
Media store thubnail size: 512x384
Exif Thumbnail: 215x288
Retrieving exif thumbnail works like following (with sanselan this could be extended to work with streams from any source as well):
``` java
public byte[] getExifThumbnail()
{
ExifInterface exif;
try
{
exif = new ExifInterface(path);
}
catch (IOException e)
{
return null;
}
byte[] imageData = exif.getThumbnail();
if (imageData != null)
return imageData;
return null;
}
```
Can I currently use glide to do following:
1) check if exif thumb exists, if yes load it
2) else use media store if possible (this is automatically falling back to the file itself as far as I know already, correct?)
Currently I manually check this condition before creating the glide request, I create different requests depending on if the image has an exif thumbnail.
If I understand glide correctly, when using the media store size or smaller, glide will automatically use the media store thumbnail if it exists and will fall back to loading the image from disc and resize it. I would like to also respect the exif thumbnail as primary thumbnail, then the media store thumbnail and only afterwards fall back to the file...
Contributor guide
Assessment
This issue has not been assessed yet.