Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement: Limit preview sizes and scale from closest match #11722

Closed
ghost opened this issue Oct 9, 2018 · 10 comments
Closed

Enhancement: Limit preview sizes and scale from closest match #11722

ghost opened this issue Oct 9, 2018 · 10 comments

Comments

@ghost
Copy link

ghost commented Oct 9, 2018

Currently, Nextcloud can generate several different previews of different sizes for the same file. This depends on for example, what client is used.

Eventually this will eat up a lot of storage space and server resources.

So my feature request is:

  • limit preview sizes, perhaps 3 different sizes.
  • scale icons and displayed images from nearest sized preview.

I know it is possible to use previewgenerator and also to lower its jpeg quality to save space, but it isn't enough. Also, generating a small preview takes much more time than sending a slightly larger file and let the client's browser scale it down.

@MorrisJobke
Copy link
Member

cc @rullzer

@nextcloud-bot
Copy link
Member

GitMate.io thinks possibly related issues are #4240 (File Size Limit), #8080 (Squeeze size of preview images), #2603 (Video previews are not sized correctly), #5358 (Fetching all previews from DB cause reaching memory limit), and #3923 (Preview API).

@rullzer
Copy link
Member

rullzer commented Oct 10, 2018

limit preview sizes, perhaps 3 different sizes.

This one is tricky. Because there are so many factors to consider.

  • You want 1 large preview to view in full screen
  • You want 1 thumbnail to view in the filelist
  • You want 1 medium preview to show in the sidebar

So that are 3 different sizes. All fine.
However. If you have users using hidpi screens, or have users that are very zoomed in your need additional sizes else the current ones look coarse.

scale icons and displayed images from nearest sized preview.

We generate a 'master' preview from which we scale already.

Also we do round up to the nearest power of 2 for previews.
so if you request a 100x100 picture (of a square picture) it will just deliver 128x128.

However this of course still leaves a lot of previews.

@ghost
Copy link
Author

ghost commented Oct 12, 2018

@rullzer You are of course correct. I will assume that there different use cases and in that regard a custom setting for this would be very useful.

Examples

  • Home user on low end server (that's me). With limited CPU resources one night prefer fewer previews to speed up responsiveness.
  • high end server users might want more previews to allow for better quality.
  • in a corporate setting there might be a defined size and resolution for all users. Enabling only matching previews might be preferred.

So an option to specify what sizes that should be generated would probably be very beneficial for many users.

Also, png's might be a better choice for really small dimensions. This could be an additional option.

Thank you.

@nero120
Copy link

nero120 commented Apr 30, 2019

Would love to see this implemented as well. Using default nextcloudpi config, I have 13GB of previews from a 28GB account, which also means my backups take a long time to run and themselves are 13GB in size without compression! 😱

@dgtlmoon
Copy link

Additionally, if the browser requests say a 130pixel thumbnail you'll get a 1024pixel image ...
see #13709 (comment)

@dgtlmoon
Copy link

@rullzer I'm going out on a limb here, I think people care a little less about the exact resolution of the thumbnail and care more about web page performance and disk usage, there's the bug in #13709 (comment) ... in other words, if someone gets a little lower resolution thumbnail, but everything is FAST and doesnt chew up much disk, no one will care

@szaimen
Copy link
Contributor

szaimen commented Jun 2, 2021

Please use the recommended settings from this article which will limit the numbers of previews that get generated.
https://ownyourbits.com/2019/06/29/understanding-and-improving-nextcloud-previews/
Thanks!

@szaimen szaimen closed this as completed Jun 2, 2021
@charleypaulus
Copy link

The link provided as an answer is broken.

@charleypaulus
Copy link

I ran the steps below to see which actions generated which previews. This test was done with a landscape-oriented photo.

  • Upload (via RClone to avoid generating previews by using the GUI)
      - No preview generated
  • Access Files list view
      - (a) Rectangle preview of width as per preview_max_* configuration
      - (b) Rectangle preview of width 1024 (and smaller height), probably used as icon thumbnail
  • Access Photos list view
      - (c) Rectangle preview of width 256 (and smaller height), probably used as photo thumbnail
  • Open photo in full screen (either in Files view or Photos view)
      - No new preview generated
  • Open side bar (in Files view)
      - (d) Rectangle preview of height 1024 (and larger width)

@rullzer I understand we need several sizes, but my test above brings these questions:

  • If the browser is able to use preview b (1024 width) for file thumbnail in Files view, why can't it use the same preview for photo thumbnail in Photos view, instead of generating preview c (256 width) (which is actually a smaller preview for a larger thumbnail!) ?
  • If we have to have preview b of width 1024, couldn't we use it for the side bar, instead of generating preview d of height 1024 ? It seems close enough to address both needs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants