Page 1 of 3

problem during executing MagickWand resize method parallel (MultiThread)

Posted: 2020-03-05T00:27:24-07:00
by ArunKumar
Written a c program for image resize with MagickWand and called that c program from java (with the help JNA) and called that c program with multi thread concept

problem : image resize is not working & unable to call the c program parallely

How to call the resize c program parallely

Re: problem during executing MagickWand resize method parallel (MultiThread)

Posted: 2020-03-05T03:13:11-07:00
by magick
The problem must lie within Java. You should be able to create threads in Java and run any command-line utility in parallel. We can help you with ImageMagick, as expected, but not Java.

Re: problem during executing MagickWand resize method parallel (MultiThread)

Posted: 2020-03-17T23:22:25-07:00
by ArunKumar
java: MagickCore/magick.c:1038: GetMagickUseExtension: Assertion `magick_info->signature == MagickCoreSignature' failed

But It give error like this When I compiled and run the program(SomeTimes it Execute without error )

why?

Re: problem during executing MagickWand resize method parallel (MultiThread)

Posted: 2020-03-17T23:30:58-07:00
by ArunKumar
java: MagickCore/magick.c:450: GetMagickDecoderThreadSupport: Assertion `magick_info->signature == MagickCoreSignature' failed.
java: MagickCore/magick.c:546: GetMagickEncoderThreadSupport: Assertion `magick_info->signature == MagickCoreSignature' failed.
java: MagickCore/semaphore.c:451: UnlockSemaphoreInfo: Assertion `semaphore_info != (SemaphoreInfo *) NULL' failed

Aborted (core dumped)

This is error occured when I executed it another time

Re: problem during executing MagickWand resize method parallel (MultiThread)

Posted: 2020-03-18T04:48:14-07:00
by magick
We need to reproduce the problem before we can offer any assistance. Detail the steps required to build and run your Java script.

Re: problem during executing MagickWand resize method parallel (MultiThread)

Posted: 2020-03-18T05:49:32-07:00
by ArunKumar
Im Using MagickWand (c Language) for image resize ( MagickResizeImage() ) & Im calling this C program from java Language(using JNA) with MultiThread concept (to perform more resize operation parallely )

Help Me...

Steps:
C Program (using MagickWand MagickResizeImage())
Calling C Program From Java ( using Java Native Access )with multiThread concept

Re: problem during executing MagickWand resize method parallel (MultiThread)

Posted: 2020-03-18T14:21:49-07:00
by magick
Your response does not help us reproduce the problem. We would require the C program, the Java program, and dependent image/data files, plus steps to reproduce. Once we can reproduce the problem, we can trace execution to determine if the problem is within ImageMagick or your Java program. Unless its a bug in ImageMagick, we cannot help you.

Re: problem during executing MagickWand resize method parallel (MultiThread)

Posted: 2020-03-18T21:11:42-07:00
by ArunKumar
How To send a Zip File or Files of my Code Here

Re: problem during executing MagickWand resize method parallel (MultiThread)

Posted: 2020-03-18T21:42:30-07:00
by snibgo
Upload it to anywhere on the internet and paste the URL here.

Re: problem during executing MagickWand resize method parallel (MultiThread)

Posted: 2020-03-18T22:35:41-07:00
by fmw42
If you only have code, you can past that between <code>...</code> tags by clicking the button marked </> after highlighting your code or click it first and paste between the tags.

Re: problem during executing MagickWand resize method parallel (MultiThread)

Posted: 2020-03-19T02:59:06-07:00
by ArunKumar
------My Full Code-------

Re: problem during executing MagickWand resize method parallel (MultiThread)

Posted: 2020-03-19T17:18:27-07:00
by magick
Comment out MagickWandTerminus() in resize.c. Your program will complete without complaint. Do not call MagickWandTerminus() while threads are active. Wait until all threads have completed before you call MagickWandTerminus().

Re: problem during executing MagickWand resize method parallel (MultiThread)

Posted: 2020-03-19T21:32:49-07:00
by ArunKumar
Can you elaborate Why should I comment the MagickWandTerminus() in resize.c while threads are active and why its causing problem to the thread?

Re: problem during executing MagickWand resize method parallel (MultiThread)

Posted: 2020-03-20T03:35:13-07:00
by magick
All calls to MagickWand, except MagickWandGenesis()/MagickWandTerminus() are thread safe. This is a standard pattern in programming:
  1. Initialize the environment
  2. spawn multiple threads
  3. wait for the threads to reap
  4. terminate the environment.

Re: problem during executing MagickWand resize method parallel (MultiThread)

Posted: 2020-03-20T04:48:57-07:00
by ArunKumar
Shall I take it in a way that not using MagickWandGenesis()/MagickWandTerminus() in a MulthiThread based program will not cause any issue or problem in now & further