Reputation: 10919
How can I create a large blank image with ImageMagick without using gigabytes of disk space?
convert -debug All -size 100000x100000 canvas:white big_white.png
This takes at least 8 GB of disk space since it won't run with ImageMagick policy disk set to 8 GB.
Upvotes: 2
Views: 741
Reputation: 207465
If your aim is to create a 100,000x100,000 blank PNG, I would recommend libvips
to you. It is very frugal with resources compared to ImageMagick.
So, to create a 100000x100000 pixel black PNG in Terminal:
vips black black.png 100000 100000 --bands 3
takes 300s on my machine and uses 227MB of RAM. I tested with:
/usr/bin/time -l vips black black.png 100000 100000 --bands 3
If you insist on making that white, you can invert it:
vips invert black.png white.png
which takes 360s on my machine and uses 406MB of RAM.
By comparison, ImageMagick needs 3,300 seconds and ?? GB of RAM to do the same:
/usr/bin/time -l convert -size 100000x100000 canvas:white big_white.png
By the way, you should be more specific about whether you want a greyscale or a colour PNG, whether a palletised image is acceptable or not, and whether you want 8-bits/sample or 16-bits/sample.
Upvotes: 1