First, OS is Windows 8.1 64 bit, installed is ImageMagick 7.0.1-3 and 6.8.0-8, setup without "Add application directory to your system path" set.
I convert our EPS files with the command
Code: Select all
"%ProgramFiles%\ImageMagick-7.0.1-Q8\magick.exe" convert -verbose -debug All -colorspace sRGB -density 600 -resize 200x200 -gravity center -extent 200x200 -background Transparent "C:\Temp\test.eps" -density 72 "C:\Temp\test.png"
With version 6.8.0-8 everything worked as it should, but since I've installed a newer version I get the error message
"unable to load module '%ProgramFiles%\ImageMagick-7.0.1-Q8\modules\coders\IM_MOD_DB_PNG_.dll'".
With a process explorer I can see that '...\modules\coders\IM_MOD_DB_PNG_.dll' needs '...\CORE_DB_PNG_.dll', which cannot be found because PATH is not set. But why did it work in version 6.8.0-8 ?
After doing some research in source code of the old and the new version I found the problem in the file 'nt-base.c', where 'SetEnvironmentVariable' is used to expand the PATH with the module path. This code is disabled since version 6.9 because ProvideDllMain is no longer defined.
The reason for this can be found in community topic "Windows DllMain initialization broken (6.9.0-3)" https://www.imagemagick.org/discourse-s ... in#p118877.
My question is, in file 'magick.c', could you expand the method 'MagickMain' with 'SetEnvironmentVariable' for setting the 'PATH' to the core dlls?
In 'magick.c', line 118:
Code: Select all
...
MagickCoreGenesis(*argv,MagickTrue);
#if defined(MAGICKCORE_WINDOWS_SUPPORT) && !defined( ProvideDllMain )
char
execution_path[MagickPathExtent];
GetPathComponent(argv[0], HeadPath, execution_path);
char
*environment_path;
environment_path = (char *)AcquireQuantumMemory(16UL * MagickPathExtent, sizeof(*environment_path));
if (environment_path == (char *)NULL)
{
exit_code = 2;
return(exit_code);
}
ssize_t
count;
count = (ssize_t)GetEnvironmentVariable("PATH", environment_path, 16 * MagickPathExtent);
if ((count != 0) && (strstr(environment_path, execution_path) == (char *)NULL))
{
if ((strlen(execution_path) + count + 1) < (16 * MagickPathExtent - 1))
{
char
*new_environment_path;
new_environment_path = (char *)AcquireQuantumMemory(16UL * MagickPathExtent, sizeof(*new_environment_path));
if (new_environment_path == (char *)NULL)
{
environment_path = DestroyString(environment_path);
exit_code = 2;
return(exit_code);
}
(void)FormatLocaleString(new_environment_path, 16 * MagickPathExtent, "%s;%s", execution_path, environment_path);
SetEnvironmentVariable("PATH", new_environment_path);
new_environment_path = DestroyString(new_environment_path);
}
}
environment_path = DestroyString(environment_path);
#endif
...