Image magic performance questions

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
alexg
Posts: 1
Joined: 2012-02-29T03:33:03-07:00
Authentication code: 8675308

Image magic performance questions

Post by alexg » 2012-03-13T03:20:53-07:00

Hi guys,

I am using image magic in the Java (I am using im4java) project where I need to create really big image (16050x30000) - it is a table, representation, so wide can't change much, but height is basically unlimited. What I am doing:

1. creating image pieces of the table with max size 4500x3000 px; This piece has png format, 2 colors palette - black and white and depth 8. Resulting size is around 400KB - 500KB
2. reducing image size two times to have about 2500x1500px piece. Image size is reduced to about 200-300KB.
Syntax:

Code: Select all

img.png -colorspace sRGB -adaptive-resize 2500x1500  -colorspace RGB img-tmp.png
This operation takes around 1.5 - 2 s. and the more calls to reduceSize method I have the more OS resources is consumed and more time is wasted. It seems like it waits for some process. But is there a way to make this operation faster? some additional parameter/flag or something else?

4. When all horizontal image pieces (with reduced size from step 2) of specific height are created I am appending them to each other to create one vertical piece.
Syntax:

Code: Select all

img-tmp.png img2-tmp.png img3-tmp.png img4-tmp.png +append v_1.png
This operation takes around 3-3.5 seconds. Also, more calls to this method are made, more time and OS resources are consumed.

5. After all vertical pieces are created, I am appending them to create the whole table representation.
Syntax:

Code: Select all

v_1.png v_2.png v_3.png v_4.png v_5.png -append table.png
This operation takes pretty much time, but If I will not reduce size in the second step and make it append images of the size 16050x3000 it will "eat" about 1.5GB of memory and will hang out like forever!
If possible I would like to escape step 2 at all, since it is not very efficient, but currently it is not (because of above-mentioned issue). So, how to increase appending speed?

I have tried appending without java by using command line with the same images, but the result was still the same: 1.5GB of RAM and forever process. It seems like I am doing something wrong or is this really such a big deal for IM to work with such big images?

Any help would be much appreciated. Thank you in advance.

Post Reply