I'm trying to track down why exactly webtrees won't generate thumbnails for a large image. I uploaded a 4835 x 6335 pixel jpg that is 6.46 MB. This one wouldn't create thumbnails. I resized it to 2550 x 3341 and it began creating thumbnails for it.
Webtrees server infomartion says I have both gd and imagick installed. I assume webtrees will use imagick by default when both are available. imagick is version 3.4.4 (Nov 2017) and the formats include JPG JPEG and PNG.
I loaded up my php settings from my hosting provider (GoDaddy deluxe linux hosting via cPanel). The "memory_limit" is set at 368M and "max_execution_time" is set to 240 for testing. The page finishes loading way before 4 minutes. Physical memory is 512 MB and it was generating thumbnails for 2550 x 3400 images with 128 MB memory limit.
My apache server logs show a 503 error when trying to GET the thumbnail. Nothing shows up in the Webtrees logs related to creating the media object, uploading it, or failure to generate thumbnails. I'm not sure if there should be some sort of PHP error log, but if there is, I couldn't find one anywhere. PHP "error_reporting" is set to E_ALL.
I'm unable to find an error log that details the exact problem, but I believe I've mostly figured it out. I checked a few random times and my httpd process was using just over 200 MB of RAM. That leaves about 300 MB left for image processing (hosting limit of 512 MB).
My imagick version (which I can't change) has a pixel quantum level of 16, or Q16. When loading an image it uses 5 * Q / 8 per pixel, or in my case 10 bytes. That turns a 30 megapixel image to 300 MB and exceeds my physical memory limit.
From some searching, gd is using 4 bytes per pixel and is safely under my max. I simply disabled the imagick module in my php settings and now it generates the thumbnails.
Webtrees could possibly have an automatic retry with gd if imagick fails because it doesn't have enough memory, or add in a pixel limit to switch over to gd. It could also generate thumbs from the highest res thumb available instead of the original image. It probably sacrifices some tiny amount of quality, but it may have speed gains for big images.