microsoft / PowerToys

Windows system utilities to maximize productivity
MIT License
110.33k stars 6.5k forks source link

[Preview Pane] Add possibility to set file size threshold to avoid showing big files #15508

Open AlessioQuercia opened 2 years ago

AlessioQuercia commented 2 years ago

Description of the new feature / enhancement

Add a field where the user can specify the maximum file size he would like to show to the Preview Pane, to avoid showing big files, which would take a lot of time/RAM to load, and in some cases would crash the File Explorer.

Adding a settable parameter (e.g. max_size) would be enough to solve this problem I suppose. As an example, max_size = 1 MB would only show to the Preview Pane files of size up to 1 MB.

Scenario when this would be used?

When the file size too big for the available RAM size.

When the file size (e.g. an svg image in my case) is too big: the Preview Pane takes forever, consumes a lot of RAM to load it and then the File Explorer crashes.

Supporting information

No response

crutkas commented 2 years ago

Can you provide more details here? Like, what file is causing this?

This an issue with powertoy stuff or other file types?

AlessioQuercia commented 2 years ago

In my case the issue is with >9MB svg images of clustering plots (which I will anyway save as png to reduce the file size). But in general the bigger the file size the longer it will take to show the preview (and if the file size is too big, it just takes too much time and crashes). This also slows down the other operations (multiple selection, copy/paste, and so on). Here an example: test.zip.

crutkas commented 2 years ago

We could but for reference that SVG brings edge (aka chromium) to its knees as well even on my desktop rig trying to render it.

crutkas commented 2 years ago

implementation:

Aaron-Junker commented 2 years ago

Just that I said it Developer file previewer has a limit of 10 KB built in

AlessioQuercia commented 2 years ago

I just checked with a 23 MB power point presentation and it works just fine. I suppose the problem might just be related to rendering detailed vector images. If this is true, every file type should have its own max size threshold, otherwise the others would not be rendered even if they could be rendered in a fast way.

Perhaps another option could be a timer: if it takes more than X ms to render the selected item on the preview pane, than it stops rendering. This could also be set off as default, and, if activated, the time could be specified by the user.

I see this as an optimization, but in general I don't know if it will be useful for many users.

crutkas commented 2 years ago

Different files have different characteristics on loading and visualization. Some people may want it. 5mb gcode file could be file due to how that data is processed.

GitMensch commented 2 years ago

Any update? I agree that "big" svg files are likely to be problematic and in this case can't be preview'd (just out of interest: is the Qt solution better? That would be seen with https://github.com/tibold/svg-explorer-extension).

On the other hand developer files should be always preview-able, currently there is a presumably fixed limit of 50KB, a configurable limit may be reasonable there (guess not), but when the limit is reached there should just be a message "only partially preview, limit of nnKB exceeded" and then a partial preview of the first nnKB be done. @Aaron-Junker What do you think?

Aaron-Junker commented 2 years ago

Any update? I agree that "big" svg files are likely to be problematic and in this case can't be preview'd (just out of interest: is the Qt solution better? That would be seen with https://github.com/tibold/svg-explorer-extension).

On the other hand developer files should be always preview-able, currently there is a presumably fixed limit of 50KB, a configurable limit may be reasonable there (guess not), but when the limit is reached there should just be a message "only partially preview, limit of nnKB exceeded" and then a partial preview of the first nnKB be done. @Aaron-Junker What do you think?

Something should change for sure. But I need to think about this