Drawing a complex image with many (lots of) shapes
Posted: 2013-08-22T12:49:45-07:00
Hi all,
Despite reading many pages in the doc and seeing examples, it is still unclear to me how to achieve this:
I want to draw many shapes in an image created with ImageMagick through the command line, so empty from the start. I wish to create the empty image in memory, draw shapes in it and when all is done save to a file. I don't know how to pipe the commands so that they are all executed before the file is saved.
In the bash script, the commands are executed inside a loop, as the shapes are calculated from an input text file whose lines are read, parsed and then used to issue commands to imagemagick.
I could in theory pipe all the commands in a single statement, but I don't think it's an option as there are more than a hundred thousand shapes to draw.
So basically, here is the flow I wish to achieve:
* create a temporary image
* loop in shape definitions and draw each shape in the image
* save the image to disk
From what I understand I could use miff:- to save the image in memory for further manipulation, but I have yet to find a comprehensive example on how to use it. Everything that I find is always a couple of statements piped in the same command, I did not find an example of very complex drawing.
To be honest, I had this done in PHP with GD and it was quite straightforward, but GD is not very powerful to draw (it does not have antialiasing for one thing) so that's why I wanted to translate that in ImageMagick.
Thank you
Despite reading many pages in the doc and seeing examples, it is still unclear to me how to achieve this:
I want to draw many shapes in an image created with ImageMagick through the command line, so empty from the start. I wish to create the empty image in memory, draw shapes in it and when all is done save to a file. I don't know how to pipe the commands so that they are all executed before the file is saved.
In the bash script, the commands are executed inside a loop, as the shapes are calculated from an input text file whose lines are read, parsed and then used to issue commands to imagemagick.
I could in theory pipe all the commands in a single statement, but I don't think it's an option as there are more than a hundred thousand shapes to draw.
So basically, here is the flow I wish to achieve:
* create a temporary image
* loop in shape definitions and draw each shape in the image
* save the image to disk
From what I understand I could use miff:- to save the image in memory for further manipulation, but I have yet to find a comprehensive example on how to use it. Everything that I find is always a couple of statements piped in the same command, I did not find an example of very complex drawing.
To be honest, I had this done in PHP with GD and it was quite straightforward, but GD is not very powerful to draw (it does not have antialiasing for one thing) so that's why I wanted to translate that in ImageMagick.
Thank you