Opened 20 years ago
Closed 20 years ago
Last modified 20 years ago
#917 closed patch (fixed)
MythGallery Fast thumbnail loading using EXIF
Reported by: | Owned by: | Isaac Richards | |
---|---|---|---|
Priority: | minor | Milestone: | 0.20 |
Component: | mythgallery | Version: | head |
Severity: | medium | Keywords: | |
Cc: | Ticket locked: | no |
Description
Most digital cameras store thumbnail images in the EXIF info and they are trivially parsed out and very fast compared to loading the whole image and rescaling, especially in the age of 7MP + cameras.
In most arrangements I believe this would remove the need to have a thumbnail cache for everything except movie files.
Attached patch is against 0.18.1
Cheers,
Grant.
Attachments (2)
Change History (9)
by , 20 years ago
Attachment: | fastthumbs.patch added |
---|
by , 20 years ago
Attachment: | fastthumbs.2.patch added |
---|
comment:1 by , 20 years ago
Version: | 0.18.1 → head |
---|
comment:2 by , 20 years ago
Milestone: | → 0.20 |
---|
comment:3 by , 20 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
This doesn't look like it's using libexif right at all - it's treating a data structure as raw image data?
comment:4 by , 20 years ago
I found it hard to believe it was that simple too!!
The trick is that the data attached to the first IFD is raw thumbnail JPG data!. Everything else is a tag (retrieved via the tag functions).
I would personally like to see libexif better documented and the structure more clearly named, but it is the way it is and I'm sitting here watching MythGallery generate thumbnails on my 3000 image collection at lightning speed!
GG
comment:5 by , 20 years ago
Resolution: | invalid |
---|---|
Status: | closed → reopened |
Hi apologies for spamming trac.
I realise I've got no mythtv cred/karma and my c++ is a bit rusty. Anyway, the code below is from the exif demo provided on the libexif site and shows how to extract thumbnails using libexif. This is what I used to work out how to do it.
... } else if (extract_thumbnail) { /* No thumbnail? Exit. */ if (!ed->data) { fprintf (stderr, _("'%s' does not contain a thumbnail!"), *args); fputc ('\n', stderr); return (1); } /* Save the thumbnail */ f = fopen (fname, "wb"); if (!f) { fprintf (stderr, _("Could not open '%s' for writing (%m)!"), fname); fputc ('\n', stderr); return (1); } fwrite (ed->data, 1, ed->size, f); fclose (f); fprintf (stdout, _("Wrote file '%s'."), fname);
I'll re-open the ticket with this new info. Happy for you to close it again if you don't like the way it is done in which case I'll see if anyone on the dev list knows a better way of getting the thumbnails out.
Cheers,
Grant
comment:6 by , 20 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
comment:7 by , 20 years ago
As I unserstand the comments here, the current SVN (8625) should display thumbnails really fast. However, it doesn't do this here. The pictures are fresh from a Canon EOS 300D and it generates ~1 thumbnail per second on an Athlon XP 2500+.
How can I see what goes wrong here?
Patch against svn trunk