K
K
Kim_Soal2018-03-06 17:29:38
PHP
Kim_Soal, 2018-03-06 17:29:38

Memory calculation when running php gd?

Approximately how much memory will an image in a variable size, say, 5000x5000 pixels, take up when working through php gd ?
If anyone has come across something that can lead to an approximate formula.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Stalker_RED, 2018-03-06
@Kim_Soal

Ideally, this would be 5000 * 5000 * 32 = 800 million bits высота * ширина * количество_бит_на_пиксель
for a 32-bit color , which is just under 800 MB. In practice, processing will require about 2.5 times more (an empirical coefficient, which may well depend on the environment and build parameters).

V
Vitaly Khomenko, 2018-03-06
@iiifx

From my experience I can say that you will run out of memory. I don't know what GD does there, but for large images it consumes a crazy amount of memory. Images over 2k per side are already becoming a problem. Use Image Magic.
PS. www.dotsamazing.com/ru/labs/phpmemorylimit
5a9fdd790fc87010529469.png

B
Boris Korobkov, 2018-03-06
@BorisKorobkov

Measure yourself with php.net/manual/ru/function.memory-get-usage.php for a dozen different smaller images. And extrapolate.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question