Why are the previews so huge? (14GB preview / 26GB images)

Nextcloud version 11.0.1
Operating system and version: Ubuntu 16.04
Apache or nginx version : Apache 2.4
PHP version : PHP 7.0.13

The issue you are facing:

The preview files in
are created as jpeg files with “png” extension.

-rw-r–r-- 1 user group 156K Jan 19 02:33 1024-683.png
-rw-r–r-- 1 user group 3.4K Jan 19 02:33 128-85.png
-rw-r–r-- 1 user group 318K Jan 19 02:33 1536-1024.png
-rw-r–r-- 1 user group 6.3K Jan 19 02:33 192-128.png
-rw-r–r-- 1 user group 598K Jan 18 20:56 2048-1365-max.png
-rw-r–r-- 1 user group 598K Jan 19 02:33 2048-1365.png
-rw-r–r-- 1 user group 11K Jan 19 02:33 256-171.png
-rw-r–r-- 1 user group 913 Jan 19 02:33 32-21.png
-rw-r–r-- 1 user group 963 Jan 18 20:56 32-32-crop.png
-rw-r–r-- 1 user group 23K Jan 19 02:33 384-256.png
-rw-r–r-- 1 user group 1.1K Jan 19 02:33 48-32.png
-rw-r–r-- 1 user group 41K Jan 19 02:33 512-341.png
-rw-r–r-- 1 user group 1.5K Jan 19 02:33 64-43.png
-rw-r–r-- 1 user group 1.7K Jan 19 02:33 64-64-crop.png
-rw-r–r-- 1 user group 88K Jan 19 02:33 768-512.png
-rw-r–r-- 1 user group 2.2K Jan 19 02:33 96-64.png

The Problem is, the preview files are quite huge. (50% of the original Images)
Can I change the quality of the preview generator?

An additional question is, why do I have to similar images? (one with, and one without max)
-rw-r–r-- 1 user group 598K Jan 18 20:56 2048-1365-max.png
-rw-r–r-- 1 user group 598K Jan 19 02:33 2048-1365.png

Thank you for your help,

1 Like

My guess is the following: Since jpg uses fourier transform to cut off high frequencies in images as MP3 does for audio, the gain in smaller file size is massive at first, however if you try to shave off more to save more, quality will deteriorate immensively.

Try to compare MP3s encoded in 128 bit and ones in 64 bit, then 64 and 32. The difference is massive and it only saves you half of the file size.

While I think that you could and should be able to adjust the quality somewhere, I don’t think the difference will be that big (unless you make really crappy previews).

E.g. compare https://raw.githubusercontent.com/nextcloud/news/master/screenshots/1.png to https://raw.githubusercontent.com/nextcloud/news/master/screenshots/1-small.png which is about half the file size

Thank you for your help.
I think you are right with the filesize. 500kb for a 2.8mpix picture is already small.

One is cropped and resized to a small square and one is proportionally resized to smaller values.