A Thumbnail view for Tracker

I consider use case of displaying many small image files (PNG etc). Storing thumbnails can double folder size with no reason. I have many screenshots, schematics, mockups etc. that can be previewed in Tracker.

2 Likes

I think it can be a problem for user who want a fast starting system. The programs and other non-writable system parts of the system need space and then we have in the future more big size apps and games, the system be slower (correct me if i am false here). If we generate every start of the system thumbnails the system need more time to start and it need more default hdd space.

On live CDs this would run never?

  1. Would it be possible to use image preview in Tracker Add-on to use with a folder (Images…)? Generate them in RAM?

  2. Have a Viewer like Albums to give attributes (thumbnails, comments, ratings) to the images? Improve the program Albums?

  3. Use Image preview in the Window menu by selecting the images, so now all the images in the folder would have to be generated at once?

  4. Use a translator to handle the generation for attributes by saving?

I could look at the modification date instead of a CRC32 but I would have to store the modification date in an attribute or somewhere when I generate a thumbnail “Thumbnail modification date” so that I have something to compare against to know that the modification date has changed and so the thumbnail needs to be regenerated. It doesn’t fundamentally change what I’m doing, calculating a CRC32 is fast, generating a thumbnail is relatively slow so I check the CRC32 before proceeding to do the heavy lifting of generating a thumbnail. I’m not sure using the modification date is better than this, but perhaps it is because I wouldn’t have to read the file contents that way, just the modification date so that may be faster. I only need the BStatable of a file instead of the BNode for those of you that understand what that means in terms of the Storage Kit. Of course I need the BNode to read and write the attribute but that comes in the next step and might not be needed if there’s no reason to generate a thumbnail.

Recall that I only generate and store thumbnail attributes for the image sizes you actually view so it’s not like I generate all sizes at once, if you never look at a folder at 64x64 for example you’ll never store any 64x64 icon attributes. Yes these attributes uses disk space, it trades disk space for cpu time. If you open a folder with 10,000 images in it, it’s beneficial that this process happens once instead of every time you open the folder IMHO.

I do store the attribute in RAM on file systems that don’t support attributes, the thumbnails are generated and displayed, but not stored. A good example of where this happens is when you look at images on a CDROM or other read-only medium. Obviously I can’t store the attributes there, but I can still generate the thumbnails and show them to you. It takes more CPU time this way but you still get thumbnails, they just need to be regenerated every time you open a folder with image files on it.

I also added an off switch for this feature in Tracker settings if you don’t want thumbnails. If you’re concerned about the space/time/ram usage, turn it off and no more thumbnails will be generated.

Applications generating thumbnails on save is unnecessary because saving the file will modify it, which will trigger Tracker to regenerate the thumb for you automatically assuming the file is visible. If it’s not visible, for example if it’s in a folder that isn’t open then there’s no reason to regenerate the thumbnail until next time you open the folder. That said, having a server that runs in the background, i.e. Index Server that generates thumbnails for you while nothing else is going on might be something we want to do later on.

Concerning what Jim said that we could display additional information about a file. I think the most appropriate place for that kind of thing would be in the file information dialog. When you Get info on an image file it could display image specific information like the image width and height or if you Get info on a video it could show runtime length, video format, audio format, stuff like that. That information would need to be in attributes and it’s something Tracker could generate. We know if a file is an image or a video by the mime type that we calculate and the Translation kit gives us the ability to parse information on audio, video, and image files.

8 Likes

Wow…this is impressive :open_mouth:

Why don’t u have created a patch for this yet? Is it still not stable enough?

Thumbnails can be generated on demand only for visible items in Tracker and in another thread. Before generation is finished for particular item, show original icon or some stub.

4 Likes

I think most implementations do it this way, no?

Thumbnails are already generated in another thread because each Tracker window is its own thread… although I suppose I could spawn another 'nother thread for the thumbnails. But why would I throw the results out when I was done, to save disk space? Bad plan. Everybody’s a critic…

1 Like

Using window thread will cause window to freeze when thumbnails are generated. Thumbnail generator thread can be one for Tracker process.

There are no meaning to save 32x32 thumbnail for 32x32 PNG image. Thumbnail storing on disk only have meaning for large images.

1 Like

If a computer or other device doesn’t have room for thumbnails, it certainly doesn’t have room for the original images.

2 Likes

I only need the BStatable of a file instead of the BNode for those of you that understand what that means in terms of the Storage Kit. Of course I need the BNode to read and write the attribute but that comes in the next step and might not be needed if there’s no reason to generate a thumbnail.

Well you will still need a BNode to access the thumbnail generation date, unless that is stored in the parent directory and not per file (an advantage for dates here: you’d need only one date to compare with, for all files in a folder). But indeed I’d say this strategy could be changed later, let’s get the thing merged and working first, and improve it later if needed :slight_smile:

When you Get info on an image file it could display image specific information like the image width and height or if you Get info on a video it could show runtime length, video format, audio format, stuff like that.

A few month ago I added an “Attributes” tab to the Get Info window which shows the attributes in a column list view. So all that’s needed is for the information to be populated.

I’m still not a big fan of the idea of doing this all in Tracker, to me it seems better to do it in each app that generates files. Two reasons for this: I assume the apps know better what’s relevant to store, and know things in a lot more details than what a translator can provide. And, it avois having to spawn a thread to scan all files in the background (or use the window thread and prevent user interaction while the scanning and attribute generation goes on, which could take some time in a machine with slow cpu or slow storage). I’d say Tracker can be used as a fallback for files that have no type attribute yet, at the same time it “identifies” them.

Sure, it needs more work in applications, but doesn’t it fit the Haiku approach of doing things at the right place and time? I feel that doing it in Tracker is catching the problem at the wrong place because it’s cheaper in development efforts, but the disk access to rescan all files every time we open a directory is going to make Tracker as painfully slow as Windows file manager?

1 Like

I see these (valid) points. But having this set at Tracker level will let you switch it on/off globally, without affecting the original icon or other attributes on the physical file I suppose…

Please, please add this! I’ve been wishing for this since beta1! If possible I’d even push for support up to 512 by 512 icons like on the Mac — Haiku’s advantage is that icons are vector not raster, so they’d scale up seamlessly without pixelation and artifacts. It’d literally be the perfect system for this!

1 Like

CRC I would think won’t scale very well… If you CRC 20MB from each file and have 1000 files in a directory you have to read 20GB to check if they have changed

1 Like

Just my 2 cents but:
Can we begin by using the existing implementation which would probably be 100% better compared to no implementation at all?
Then we could iterate and optimize based on real usage data. Since there would be an on/off switch somewhere I really see no problem to experiment with existing implementation as it is.

1 Like

What about Query windows? I can imagine a haiku user wanting to query for all JPEG images in the system… but then there is no thumbnail support in the results.

Tracker should have auto layouted grid view that is usable in query window and open/save dialog.

2 Likes

Knowing what Index Server was intended to do, it seems as though the process of Finding Images and giving them a Preview would be given to an IndexServerAddOn. However, I understand that Index_Server is currently incomplete. Perhaps this is bike shedding.

1 Like

Not exactly. If the thumbnails are stored on disk, we need to decide on the storage format at least, otherwise we will be making things complicated if we need to change the format (and make sure things arre cleanly migrated). This is not an issue if they are not stored, of course, and only rendered on the fly when opening the window.

Also it has to be done in a way that doesn’t make the window freeze until all thumbnails are rendered, otherwise it would indeed be more annoying than no implementation.

@mmlr do you remember how was it done in NewFS? IIRC it was pretty fast there.