FileChooserIconView with thumbnail and exif rotation

198 views
Skip to first unread message

ZenCODE

unread,
Apr 25, 2016, 1:46:37 PM4/25/16
to Kivy users support
So, I thought I'd share this in case anyone finds it useful :-)

These two classes add icon previews and exif rotation to the icons displayed in the FileChooserIconView. The icon implementation does perhaps touch a little too deeply on the current icon implementation, but the main goal was to make it simply an add-on the the current FileChooserIconView. It really is dead easy to use: just instantiate it with the FileChooseIconView as a parameter and done.

    FileChooserThumbnail(fc)

One of the main issues here was making it work for large folders with many images. As the image caches the whole texture of the source, we use the Clock to write the reduced image to the temp folder and load it from there. This caching also helps makes re-visited folders very quick to display.

The exif rotation works by using PIL to examine the metadata and pops a matrix onto the image if required, so it can essentially be used for any Image class.

Anyway, hope it helps. Run the below command for a sample.

    python filechooserthumbnail.py

Peace
exifrotation.py
filechooserthumbnail.py

qua non

unread,
Apr 26, 2016, 6:29:38 PM4/26/16
to kivy-...@googlegroups.com
Pil gives you a way to read just the embedded thumbnails from the image itself. Would be a lot faster.

--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

ZenCODE

unread,
Apr 27, 2016, 10:46:23 AM4/27/16
to Kivy users support
I tried that, at it turned out to be significantly slower. I think the the OpenGL acceleration offered by Kivy outweighs that. PIL is all CPU based, so cannot use the GPU like the kivy image does,,,

But that's just my theory. I just know using the PIL thumbnail was slower when testing on my desktop (admittedly with a NVidia 950)....

qua non

unread,
Apr 27, 2016, 1:12:54 PM4/27/16
to kivy-...@googlegroups.com
I have that working significantly faster you just have to make sure you are extracting the embedded thumbnail from the metadata of the image and it's significantly faster as you have to just decode a very small thumbnail...nothing to do with cpu/pil.

On Wed, Apr 27, 2016 at 8:16 PM, ZenCODE <zenkey....@gmail.com> wrote:
I tried that, at it turned out to be significantly slower. I think the the OpenGL acceleration offered by Kivy outweighs that. PIL is all CPU based, so cannot use the GPU like the kivy image does,,,

But that's just my theory. I just know using the PIL thumbnail was slower when testing on my desktop (admittedly with a NVidia 950)....

--

ZenCODE

unread,
Apr 27, 2016, 2:49:36 PM4/27/16
to Kivy users support
Okay, thanks. Will benchmark that and post the code and results.....:-)

Sadaka Technology

unread,
Oct 10, 2020, 2:48:10 PM10/10/20
to Kivy users support
@Zencode , any idea of how to upload images  or videos from userphone gallery like in this video?(https://www.youtube.com/watch?v=MkKHqX44Mv8)
Reply all
Reply to author
Forward
0 new messages