Anthony Thyssen wrote:
Stephen Woodbridge on  wrote...
| Hi all,
| | I am trying to speed up a simple heatmap image generation: | | | t1 = clock(); | | heatmap = MagickFxImage(heatmap, "v.p{0,u*v.h}"); | | t2 = clock();
|      if (DEBUG) fprintf(stderr, "Time to fx image: %.1f\n",
|              ((double) (t2-t1)) / CLOCKS_PER_SEC);
| | This call is taking 68 seconds for a 700x550 image. | | t1 = clock(); | | sprintf(alphaFX, "A*%.2f", opacity);
|      heatmap = MagickFxImageChannel(heatmap, AlphaChannel, alphaFX);
| | t2 = clock();
|      if (DEBUG) fprintf(stderr, "Time to fx Alpha image: %.1f\n",
|              ((double) (t2-t1)) / CLOCKS_PER_SEC);
| | and this call is taking 8.2 sec. | | is there a better (faster) way to do this? This represents about 99% of | the time to process the image :( | | Another annoying problem I ran into is the fact that the first Fx call | would not even work until I saved the heatmap image to a file and | reloaded the file. is there a better way to materialize the image so the | Fx command will work on it? | The two images should be in the same Wand for the FX function to work.

and yes FX is slow, because it is interpreted.  If you want to do it
faster you can do the lookup yourself in the API you are using.
That will make it a couple of orders of magnitude faster.

Actually color lookup tables such as you are doing is actually quite a
standard FX function, and probably should be made into a built in.
Though the actual syntax both in the Core function and commandline API
has not been worked out.

Anthony,

Thank you for the response. I was looking at rewriting the whole application in MagickCore but really would like to avoid that. Can you give me a quick outline of the process to do this in the current API. I don't mind doing the coding if you could shoot me some pseudo-code to replace the MagickFxImage calls it would really help.

I spent the last three nights getting this far and I'm happy to have something working. Is it possible to avoid having to write and reload the image also.

Thanks,
  -Steve
_______________________________________________
Magick-users mailing list
[email protected]
http://studio.imagemagick.org/mailman/listinfo/magick-users

Reply via email to