Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


What kind of ram is needed for imgs manipulation?
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

What kind of ram is needed for imgs manipulation?

Hello,
whar kind of memory is needed to edit and resize pictures up to 28MP? I remember that with php GD library I could easily fill the ram on a 256MB vps. I need to process images on on the fly and add watermark. It's not a huge app it will accessed only by a few people per day (not at the same time) but the vps doesn't have to crash while it loads images.

Comments

  • DDR3

  • @ATHK said:
    DDR3

    Hi, I meant size.

  • @sandro said:
    size

    Xtra large

  • exception0x876exception0x876 Member, Host Rep, LIR

    http://php.net/manual/en/function.memory-get-peak-usage.php

    Add this function to the end of your php script that is doing the resize (obviously you have to run it on the server with enough RAM for this test)

  • You are better off using GraphicsMagick.

  • @zllovesuki said:
    You are better off using GraphicsMagick.

    does it use less RAM? I remember that a 12Mp would use like 100MB of RAM with gd.

  • A couple of times 28*3 MB would be nice (assuming 24-bit color)

  • DerekDerek Member
    edited January 2016

    Have you tried increasing your memory limit in your php.ini file?

    You can as well make a swapfile in KVM if your needing to temporary increase your limits.

    in your php.ini file,

    memory_limit=512M


    In CLI,

    dd if=/dev/zero of=/swap bs=1024 count=524288

    mkswap /swap

    swapon /swap

    Try this and re-attempting your script and see if it works.

  • @sandro said:
    Hello,
    whar kind of memory is needed to edit and resize pictures up to 28MP?

    This depends entirely on the image format(s) used, the changes you want to make, and the image processing library you use. For example, ImageMagick has support specifically for larger files, so if you use something based on that you can probably tweak the settings to work on even a very small LEB.

    Otherwise, you need to think more about what you're doing. If it's something like a watermark, that's a simple operation that happens at the pixel level, so it's fairly cheap, memory-wise. The main thing that is going to suck up RAM is probably going to be uncompressing and recompressing the file, assuming you're mainly working with JPEG images.

    Whatever you do, the workaround is to substitute disk space for memory space, and that makes things sloooooooooow. One job I was at used 256MB servers to do some data processing. For one of the larger files, it took over 10 minutes to do the requested analysis. Bumped it up to a 1GB server and it was able to do it in under 10 seconds.

  • you'd still use most of the same amount of RAM, but the speed would suffer is all. You can technically work well with 512 for image manipulation

  • 512 should work, one thing that would be nice is to limit the app to only allowing one image manipulation at a time. If multiple users overlap in execution, it would throw up the RAM. ... ahh I see you mention not at the same time, my bad.

    Still might be a nice feature just in case it happens :) Not sure how to do this with php, but with Java a single thread executor would fit the bill.

  • ericlsericls Member, Patron Provider

    I use Pillow and 512MB is enough for 5 threaded manipulation of web-sized images.

  • @AdamM said:
    512 should work, one thing that would be nice is to limit the app to only allowing one image manipulation at a time. If multiple users overlap in execution, it would throw up the RAM. ... ahh I see you mention not at the same time, my bad.

    Still might be a nice feature just in case it happens :) Not sure how to do this with php, but with Java a single thread executor would fit the bill.

    Hey thanks, I guess if you run just one php child the other requets will wait in queue until the previous process finishes (unless timeout kicks in). I'm not sure if this could work though.

  • @ericls said:
    I use Pillow and 512MB is enough for 5 threaded manipulation of web-sized images.

    What is pillow? So you have 5 cores?

  • sandro said: What is pillow?

  • Time to register pillowhosting.com

  • ericlsericls Member, Patron Provider

    @sandro said:
    What is pillow? So you have 5 cores?

    It's a Python Library. https://github.com/python-pillow/Pillow

    Only have 1 core.

Sign In or Register to comment.