Being able to choose compression quality
Feature request
User type: Logged In or not
User level: Beginners
Issue
It takes about 5 seconds for me, to load a thumbnail the gallery view, and about 10 sec to view a single picture, when I try to view a single pictures all 4 cores are used more than 3/4th
Description of feature / solution to the issue
Is there any way to choose picture preview compression ratio ? Is it possible to disable it ? I think there’s no way to do this, I tried look for it in the source code but I did not find anything
Benefit / value
People would be able to choose the compression ratio they want, e.g. high compression level when the server has high perf CPU and people with slow Internet access can choose low compression level (or even no compression) when the server has a bad CPU and if I know that people have fast Internet access
Are you a developer willing to implement this feature?: Yes but I do not find where IPreview is located
In my opinion, you should test the server on some personal computers with CPUs like two cores pentium as some servers only have atom. I mean that I would not buy an expensive server just to share few pictures of holidays with my family.
Illustration
Here is htop when i load an album with the gallery I used htop to visualise what happens when I load an album with the gallery :

Originally from #194@Gallery
Are you a developer willing to implement this feature?: Yes but I do not find where IPreview is located
👍 I can point you to those files.
The files you need to touch are:
lib/private/Preview/andlib/private/legacy/image.php
If someone else wants to help, they're welcome
Hello, I'm also very interested in disabling the compression because of its bad quality. So I did some research and located the point for optimizing:
/lib/private/legacy/image.php
line 270: $retVal = imagejpeg($this->resource, $filePath);
this calls imagejpeg() with the default jpg quality of 75. According to Stackoverflow GD's compression algorithms are not the best ones. However, with a change to:
line 270: $retVal = imagejpeg($this->resource, $filePath, --$JpgQuality--);
You could use a configurable Quality Setting during jpg creation. 100 would mean no lossy compression and therefore less cpu load but much bigger files.
Sadly I have no idea how to create a configuration variable.
edit: for effect in the gallery you have to change line 322 also:
$res = imagejpeg($this->resource); --> $res = imagejpeg($this->resource, NULL, --$JpgQuality--);
I did an test with quality 100 on my installation and the file size of my example picture changed from 409kB --> 1MB. The scaling quality remains poor and does not the quality enhancement I wished for. but
If someone else wants to help, he's welcome
Or "she", presumably! ;)
"They" made a PR at https://github.com/nextcloud/server/pull/3575