How to restrict document thumbnail size

We have Pimcore running as our DAM and we are storing a lot of documents to it.

We realised that the thumbnails were not shown on the admin for some of the documents. After digging into the logs we have found out that it is because the generated thumbnail file on the disk is so huge that the Imagick->readImage function will not be able to load the image and that causes the generic thumb to be shown instead. (eg. for one rollup the system has generated a thumbnail sized 37965 x 22217)

Is there a way to restrict the size of the thumbnail generated by the system? On config I can see something related to the thumbnails.