Composing images multi-threaded - problems

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Post by magick »

ImageMagick is thread safe on a per image per thread basis-- one image processing operation per image per thread. We added a patch to ImageMagick 6.2.7-2 Beta to make the composite, draw, annotate, and crop operations thread safe if each thread performs in a separate area of the image. For example you can composite into the four corners of an image in separate concurrent threads. To ensure predictibility, the composite areas should not overlap.

ImageMagick 6.2.7-2 Beta will be available sometime tommorrow in ftp://ftp.imagemagick.org/pub/ImageMagick/beta. If you discover other operations that you want to be thread-safe at a subimage level, let us know.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Post by magick »

It is quite simple to upgrade any method to be thread-safe. We must use cache views rather than the default Acquire/GetImagePixels(). The problem is that there are thousands of places within the ImageMagick that need to be tweaked. So for now we'll make methods thread-safe on demand. One solution would be to post a short segment of source code and we'll see if we can make it thread safe or if you are directly accessing pixels in an image, use Acquire/GetCacheView() instead of Acquire/GetImagePixels().
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Post by magick »

Thanks, however, we need a complete program that we can download, compile, and run. Alternatively, try 6.2.7-2 yourself. We suspect it will work in a threaded environment.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Post by magick »

We're using the latest ImageMagick 6.2.7-2 Beta and your program has been running all day without any problems. We periodically issue a
  • identify -verbose test*bmp | grep -i sign
command to ensure the pixel signatures match. We will continue running your program and you will hear back from us if it fails for any reason.
Post Reply