Page 1 of 1

Creating an image with an unpredictable number of rows

Posted: 2006-11-29T17:15:57-07:00
by rmagick
I'd like to create an image a row at a time, where I don't know up front how many rows there will be. I've got code that uses AllocateImage to create a 0x0 image. I then set the number of columns. Then I build the image a row at a time, first incrementing the number of rows in the image by 1 and then calling SetImagePixels/SyncImagePixels to create the row.

This works, but, in the IM source code all the uses of SetImagePixels establish the total number of rows in the image before calling SetImagePixels. I'm concerned that I'm breaking an implicit rule. Is this an acceptable use of the SetImagePixels? If not, what is the correct way to do this?

Posted: 2006-11-29T17:30:44-07:00
by magick
Use SetImageExtent() to dynamically extend an image.

Posted: 2006-11-29T17:45:15-07:00
by rmagick
Thanks for the info!

Posted: 2006-12-05T19:08:10-07:00
by anthony
You can see its effect from the command line -extent operator, as shown in IM examples.
http://www.cit.gu.edu.au/~anthony/graph ... op/#extent

Posted: 2006-12-05T19:12:02-07:00
by rmagick
Thanks, Anthony. That example helps.