AWS Lambda with IM7

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
malinlesinge
Posts: 2
Joined: 2019-10-18T01:29:25-07:00
Authentication code: 1152

AWS Lambda with IM7

Post by malinlesinge »

Hi,

I am using ImageMagick in a AWS Lambda to crop png to tiles with that command:

Code: Select all

/opt/bin/magick convert /tmp/1571383180912/1571383180912_300dpi.png -monitor -crop 512x512 -set filename:tile %[fx:page.x/512]_%[fx:page.y/512] +repage +adjoin "/tmp/1571383180912/1571383180912_300dpi/tile-300-%[filename:tile].png"
Everything is working so far, I just have issues with huge png (I have a 8mo file, 26 000*10 000 pixels)
I am getting the following error :

Code: Select all

convert: unable to write pixel cache '/tmp/magick-24phDuETFQt7OM': No space left on device @ error/cache.c/WritePixelCachePixels/5823.
convert: no images defined `/tmp/1571383180912/1571383180912_300dpi/tile-300-%[filename:tile].png' @ error/convert.c/ConvertImageCommand/3300.
I pretty much already know why : Lambda have only 512mb space available on /tmp file, and /tmp is the only FS we get the access to.

My question is, can I remove the disk pixel cache and only use memory cache ? (I can get up to 3gb)
Time is not really an issue, I just want it to get done.

Thank you for your help.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: AWS Lambda with IM7

Post by magick »

malinlesinge
Posts: 2
Joined: 2019-10-18T01:29:25-07:00
Authentication code: 1152

Re: AWS Lambda with IM7

Post by malinlesinge »

Thanks for the link !
I'm trying to implement the distribute cache, but I got an error and I don't really know how to fix it :

Code: Select all

convert: DistributedPixelCache '52.208.221.223' @ error/distribute-cache.c/ConnectPixelCacheServer/243.
convert: cache resources exhausted `/tmp/1571390578996/1571390578996_100dpi.png' @ error/cache.c/OpenPixelCache/3850.
convert: cache resources exhausted `/tmp/1571390578996/1571390578996_100dpi/tile-100-%[filename:tile].png' @ error/cache.c/OpenPixelCache/3850.
convert: cache resources exhausted `/tmp/1571390578996/1571390578996_100dpi/tile-100-%[filename:tile].png' @ error/cache.c/OpenPixelCache/3850.
convert: cache resources exhausted `/tmp/1571390578996/1571390578996_100dpi/tile-100-%[filename:tile].png' @ error/cache.c/OpenPixelCache/3850.
convert: memory allocation failed `/tmp/1571390578996/1571390578996_100dpi/tile-100-%[filename:tile].png' @ error/png.c/WriteOnePNGImage/9345.
convert: Wrote palette index exceeding num_palette `/tmp/1571390578996/1571390578996_100dpi/tile-100-0_0.png' @ warning/png.c/MagickPNGWarningHandler/1748.
This is my command :

Code: Select all

/opt/bin/magick convert /tmp/1571390578996/1571390578996_100dpi.png -limit memory 2000mb -limit map 200mb -limit disk 200mb -define registry:cache:hosts=52.208.221.223:6666 -monitor -crop 1024x1024 -set filename:tile %[fx:page.x/1024]_%[fx:page.y/1024] +repage +adjoin "/tmp/1571390578996/1571390578996_100dpi/tile-100-%[filename:tile].png"
Is there any way to see in my remote host logs or anything ?

Thanks
Post Reply