Commit Graph

44 Commits

Author SHA1 Message Date
Přemysl Eric Janouch 604594a8f1
Prepare for parallelized colour management
This rewrite is more or less necessary for:
 - colour-managed browser thumbnails,
 - asynchronous image loading,
 - turning fiv-io into a reusable library.

Little CMS has a fairly terrible API in this regard.
2024-01-28 01:48:28 +01:00
Přemysl Eric Janouch 3c8a280546
Move colour management to its own compilation unit
Also make it apparent that CMM profiles are pointer types.

This isn't all that pretty, but it's a necessary first step.
2024-01-26 19:17:54 +01:00
Přemysl Eric Janouch 840e7f172c
Colour-manage SVGs 2023-07-09 10:40:32 +02:00
Přemysl Eric Janouch 92deba3890
Silence a compiler warning 2023-07-03 20:03:07 +02:00
Přemysl Eric Janouch 49ee551b9b
Use LocalAppData for thumbnails on Windows 2023-06-26 02:11:12 +02:00
Přemysl Eric Janouch 074bd4d37f
Stop abusing Cairo user data, part 2
With the shift from cairo_surface_t, we've lost our ability
to directly render vector surfaces, but it doesn't matter.
2023-06-24 14:36:24 +02:00
Přemysl Eric Janouch add96b37a6
Stop abusing Cairo user data, part 1
This commit temporarily breaks multi-page images and animations.
2023-06-24 13:56:36 +02:00
Přemysl Eric Janouch b308b5da18
Fix thumbnail extraction 2023-06-13 12:44:23 +02:00
Přemysl Eric Janouch 8953e6beea
Update comments 2023-06-09 13:13:17 +02:00
Přemysl Eric Janouch 2e8bbf0e43
Improve LibRaw thumbnail choice
Make use of LibRaw 0.21.0's extended thumbnail API.
2023-06-09 12:47:41 +02:00
Přemysl Eric Janouch 07d4ea2dde
Optimize thumbnail extraction
Don't go over the same data twice.
2023-06-08 18:59:21 +02:00
Přemysl Eric Janouch a5b5e32c3b
Refactor fiv_thumbnail_extract() 2023-06-08 18:59:20 +02:00
Přemysl Eric Janouch 544722f8e0
Try not to thumbnail FIFOs
Unless there is a writer, this may block forever.

And if there is one, we're somewhat likely to break something.
2023-05-21 23:31:41 +02:00
Přemysl Eric Janouch 00110a639a
Avoid use of NULL picture data pointers
The sanitizer would scream, and LibRaw would rather confusingly
return I/O errors.
2023-05-21 23:31:41 +02:00
Přemysl Eric Janouch 5af36f4954
Fix raw image thumbnailing speed regression
LibRaw started returning the largest possible thumbnail,
which in the case of NEFs may be a nearly full-scale image.
2023-05-21 23:31:34 +02:00
Přemysl Eric Janouch 05ac3a0651
Check filesize when retrieving thumbnails
In particular, this handles screenshots from Rigol oscilloscopes,
which reuse the same name series with the same file modification time.
2023-04-14 05:24:57 +02:00
Přemysl Eric Janouch 796b05c9a5
Integrate online reverse image search
This makes use of our image processing capabilities in order to
turn arbitrary image files into normalized thumbnails,
upload them to a temporary host, and pass the resulting URI
to a search provider.

In future, fiv should ideally run the upload itself,
so that its status and any errors are obvious to the user,
as well as to get rid of the script's dependency on jq.
2023-03-15 05:52:32 +01:00
Přemysl Eric Janouch 62d82f38c8
Fix LibRaw 0.21.0 build 2022-12-23 17:17:33 +01:00
Přemysl Eric Janouch 4697a56760
Use cleaner paths when looking up thumbnails 2022-08-09 13:55:17 +02:00
Přemysl Eric Janouch 4e11970a7e
Do produce thumbnails of thumbnails, but in memory 2022-08-09 13:22:11 +02:00
Přemysl Eric Janouch 701846ab39
Support opening collections of files
Implement a process-local VFS to enable grouping together arbitrary
URIs passed via program arguments, DnD, or the file open dialog.

This VFS contains FivCollectionFile objects, which act as "simple"
proxies over arbitrary GFiles.  Their true URIs may be retrieved
through the "standard::target-uri" attribute, in a similar way to
GVfs's "recent" and "trash" backends.

(The main reason we proxy rather than just hackishly return foreign
GFiles from the VFS is that loading them would switch the current
directory, and break iteration as a result.

We could also keep the collection outside of GVfs, but that would
result in considerable special-casing, and the author wouldn't gain
intimate knowledge of GIO.)

There is no perceived need to keep old collections when opening
new ones, so we simply change and reload the contents when needed.

Similarly, there is no intention to make the VFS writeable.

The process-locality of this and other URI schemes has proven to be
rather annoying when passing files to other applications,
however most of the resulting complexity appears to be essential
rather than accidental.

Note that the GTK+ file chooser widget is retarded, and doesn't
recognize URIs that lack the authority part in the location bar.
2022-08-08 18:06:50 +02:00
Přemysl Eric Janouch 4131a926f2
Fix the remaining Windows build error
Linux has st_mtim (and an st_mtime macro),
macOS has st_mtimespec (and an st_mtime macro),
Windows has just st_mtime.

GFileInfo would be another option, though it seems unnecessary.
2022-07-23 10:39:53 +02:00
Přemysl Eric Janouch b87a109d61
Decode bitmap thumbnails through LibRaw as well 2022-06-10 22:47:00 +02:00
Přemysl Eric Janouch 84f8c9436f
Downscale embedded thumbnails within minions
Otherwise the UI would become unresponsive during loading.
2022-06-08 02:51:55 +02:00
Přemysl Eric Janouch 8dfbd0dee2
Add a command line option to extract thumbnails
Only use LibRaw for now, which probably has the most impact
using the least amount of effort.
2022-06-08 02:51:54 +02:00
Přemysl Eric Janouch 4ca8825e02
Clean up
Use gchar when memory is allocated through GLib.
2022-06-05 13:30:53 +02:00
Přemysl Eric Janouch 024b5117b4
Get rid of our spng dependency
Thumbnails can be properly loaded using Wuffs now.
2022-06-04 23:14:15 +02:00
Přemysl Eric Janouch ac6b606ccc
Bump Wuffs, support partial PNGs through it 2022-06-04 19:19:16 +02:00
Přemysl Eric Janouch e2adac72cc
Use the model's mtime for validating thumbnails
Saves a syscall, generalizes fiv_thumbnail_lookup(),
wastes a tiny bit of memory per entry.
2022-06-04 16:37:25 +02:00
Přemysl Eric Janouch 5c34a6846a
Fix loading huge JPEGs
They fell back to gdk-pixbuf, then misrendered in the thumbnailer,
and crashed the program when loaded directly.

The second best we can do is scale them down, right after tiling,
which is a complex feature to add.
2022-03-09 18:04:36 +01:00
Přemysl Eric Janouch d9435c988c
Clean up 2022-02-21 21:20:16 +01:00
Přemysl Eric Janouch 919a55c90b
Try to thumbnail everything we can 2022-02-21 00:02:15 +01:00
Přemysl Eric Janouch 04ec292caf
Make thumbnailers pass back raw images 2022-02-20 21:14:33 +01:00
Přemysl Eric Janouch a28fbf25bc
Implement wide thumbnail cache invalidation 2022-02-20 15:44:42 +01:00
Přemysl Eric Janouch 788485d81e
Redirect warnings to the info bar
And speed up thumbnailing of animated images while at it.

Also, fix thumbnailing SVGs with external links.
2022-01-24 05:48:13 +01:00
Přemysl Eric Janouch 07e7d39ea2
Produce properly scaled SVG thumbnails 2022-01-23 04:12:11 +01:00
Přemysl Eric Janouch 6a878fd3c4
Bump more copyright years 2022-01-07 09:53:58 +01:00
Přemysl Eric Janouch 3274b64f5a
Fix SVG thumbnailing
They're not loaded as image surfaces.
2022-01-07 09:43:28 +01:00
Přemysl Eric Janouch bb67df716c
Mildly improve Ubuntu 20.04 compatibility 2022-01-06 08:39:33 +01:00
Přemysl Eric Janouch 5f8dc88fa7
Minor URL-related fix-ups 2021-12-31 00:41:04 +01:00
Přemysl Eric Janouch 380ddd540b
Convert all loading to use GFile
Now we're able to make use of GVfs, with some caveats.
2021-12-30 22:32:29 +01:00
Přemysl Eric Janouch 0110e0a5d2
Check wide thumbnail metadata 2021-12-29 01:55:05 +01:00
Přemysl Eric Janouch 98bdab443a
Hardcode Exif orientation in thumbnails 2021-12-28 23:29:58 +01:00
Přemysl Eric Janouch bf47782f0a
Move thumbnails into their own source file
And clean up identifiers.
2021-12-28 20:18:25 +01:00