* create a png file by knowing width and height (and color depth) and getting all the data serially as RGBA integers.
My plan is to add the pixels one by one until the image is ready, and then write the image to disk.
I've looked through the documentation and I see that I could do this by using something like:
Code: Select all
$image->Draw(fill=>$pixelColor, primitive=>'point', points=>"$x,$y");
I have the following concerns/questions:
1. The image I'm drawing will be 1280x720x32bpp. This will take up roughly 3.6MB in RAM. I am working on an embedded system, so I have some memory constraints.
I'd like to know if PerlMagick is doing compression behind the scenes progressively, as I add more pixels (e.g. if it starts to group similar pixels before I finish adding pixels to the image), so that it wouldn't use up 3.6MB of RAM during runtime. Or does it store it as RGBA inside and only compresses it when I write to disk?
2. How costly is it (in terms of CPU cycles) to add each pixel to the image? Would it be more efficient if I added a full row at a time? Can I add multiple pixels at once with one function call?
Thanks for the help. If you have other suggestions on how I could do this more efficiently, please let me know.