This project has moved. For the latest updates, please go here.

All ImageMagick commands take a long time

Aug 13, 2016 at 12:40 PM
Edited Aug 13, 2016 at 7:15 PM
Hello,

i will resize my images with ImageMagick.
in my c# (vs 2010) projekt have a link to "Magick.NET-Q8-x64.dll"

and my using is:
using IM = ImageMagick;

my c# code is:
    using (IM.MagickImage resized = new IM.MagickImage(@"C:\Temp\A.jpg"))
            {
                IM.MagickGeometry size = new IM.MagickGeometry(1920, 5000);
                size.Greater = true;
                resized.Resize(size);
                resized.Write(@"C:\Temp\A Resize.jpg");
            }
the code is running, but it takes a long time.
ImageMagick needs 7 sec for any search.
Is there a way to get around this?
Here is the log for the decisive point:

2016-08-13T13:20:00+02:00 0:00.957 0.969u 7.0.2 Trace: utility.c/GetPathComponen /1213/Trace ....\ImageMagick\MagickCore\blob.c

2016-08-13T13:20:07+02:00 0:07.493 7.516u 7.0.2 Trace: image.c/GetImageInfo/1343/Trace ...

Can I do anything about it?
verry thanks...

Regards,
Oliver
Coordinator
Aug 13, 2016 at 1:05 PM
Can you share the whole log on something like dropbox? What is the size of your input image? It might be swapping out to disk if it too big. And what do you mean by 'for any search'?

p.s. Enabling logging will also slow down the resize.
Aug 13, 2016 at 7:14 PM
Edited Aug 14, 2016 at 2:39 PM
thank you ...
(sorry for my bad english)

here is this log / trace:
Log in DropBox

And other question is ...what searches ImageMagick?

IM-Debug: 2016-08-13T13:20:00+02:00 0:00.950 0.953u 7.0.2 Configure : configure.c/GetConfigureOptions/688/Configure
Searching for configure file: "D:\Visual Studio 2010\osEasyPhotoCopy\osEasyPhotoCopy\bin\Debug\C:\Users\Oliver\AppData\Local\ImageMagick ImagemagickOpenCLDeviceProfile.xml"
IM-Debug: 2016-08-13T13:20:00+02:00 0:00.950 0.953u 7.0.2 Configure : configure.c/GetConfigureOptions/688/Configure
Searching for configure file: "C:\Users\Oliver\AppData\Local\ImageMagick\ImagemagickOpenCLDeviceProfile.xml"
IM-Debug: 2016-08-13T13:20:00+02:00 0:00.951 0.953u 7.0.2 Configure : configure.c/GetConfigureOptions/688/Configure
Searching for configure file: "C:\Users\Oliver\AppData\Local\ImageMagick\C:\Users\Oliver\AppData\Local\ImageMagick\ImagemagickOpenCLDeviceProfile.xml"
IM-Debug: 2016-08-13T13:20:00+02:00 0:00.953 0.953u 7.0.2 Locale : locale.c/GetLocaleOptions/829/Locale
Searching for locale file: "D:\Visual Studio 2010\osEasyPhotoCopy\osEasyPhotoCopy\bin\Debug\locale.xml"
IM-Debug: 2016-08-13T13:20:00+02:00 0:00.953 0.953u 7.0.2 Locale : locale.c/GetLocaleOptions/829/Locale
Searching for locale file: "locale.xml"
IM-Debug: 2016-08-13T13:20:00+02:00 0:00.953 0.953u 7.0.2 Locale : locale.c/GetLocaleOptions/829/Locale
Searching for locale file: "C:\Users\Oliver\AppData\Local\ImageMagick\locale.xml"
IM-Debug: 2016-08-13T13:20:00+02:00 0:00.954 0.953u 7.0.2 Locale : locale.c/GetLocaleOptions/829/Locale
Searching for locale file: "D:\Visual Studio 2010\osEasyPhotoCopy\osEasyPhotoCopy\bin\Debug\english.xml"
IM-Debug: 2016-08-13T13:20:00+02:00 0:00.954 0.953u 7.0.2 Locale : locale.c/GetLocaleOptions/829/Locale
Searching for locale file: "english.xml"


And look here this paths ... this are wrong ...

IM-Debug: 2016-08-13T13:20:00+02:00 0:00.950 0.953u 7.0.2 Configure : configure.c/GetConfigureOptions/688/Configure
Searching for configure file: "D:\Visual Studio 2010\osEasyPhotoCopy\osEasyPhotoCopy\bin\Debug\C:\Users\Oliver\AppData\Local\ImageMagick ImagemagickOpenCLDeviceProfile.xml"

IM-Debug: 2016-08-13T13:20:00+02:00 0:00.951 0.953u 7.0.2 Configure : configure.c/GetConfigureOptions/688/Configure
Searching for configure file: "C:\Users\Oliver\AppData\Local\ImageMagick\C:\Users\Oliver\AppData\Local\ImageMagick\ImagemagickOpenCLDeviceProfile.xml"

regards
Oliver


Addendum:
It looks like two paths into one.
In the middle of the path starts again on C: \ at ...
Coordinator
Aug 14, 2016 at 7:44 PM
I found and fixed the bug with the incorrect path. Can you try if your issues is resolved with the latest development build? You can find that package on the following NuGet feed: https://ci.appveyor.com/nuget/Magick.NET
Aug 14, 2016 at 9:24 PM
yes i can... this url is empty.
i need a direkt link to "Magick.NET-Q16-AnyCPU.dll"
can you give me this link?
Coordinator
Aug 14, 2016 at 9:45 PM
You will need to add this url as a NuGet feed in Visual Studio and then you can find the package there.
Coordinator
Aug 15, 2016 at 9:56 AM
I just published a new version that resolved some other issues. Can test if that version resolves your issue?
Aug 15, 2016 at 11:02 AM
Super - very fast Support!

He needed for the first file is still time.
i send new log today afternoon.
Coordinator
Aug 15, 2016 at 2:10 PM
The performance hit for the first file should only happen once. The 'slowdown' is happening because of the OpenCL benchmark. You should not be able to reproduce the issue the second time you start the program.
Aug 15, 2016 at 7:05 PM
Edited Aug 15, 2016 at 7:13 PM
i have create new log-file with new imagemagick-version ... i have changed of this file "Magick.NET-Q16-AnyCPU.dll".
In this version, I only need a dll :-)

Here the 2 interesting lines Log:

IM-Debug [01877]: 2016-08-15T21:00:22+02:00 0:01.973 1.969u 7.0.2 Trace [9936]: utility.c/GetPathComponent/1213/Trace ....\ImageMagick\MagickCore\blob.c
IM-Debug [01878]: 2016-08-15T21:00:28+02:00 0:08.188 8.188u 7.0.2 Trace [9936]: image.c/CloneImage/812/Trace C:\Temp\A.jpg


complete log:
Log: 2016-08-15 2100
Aug 15, 2016 at 7:12 PM
dlemstra wrote:
The performance hit for the first file should only happen once. The 'slowdown' is happening because of the OpenCL benchmark. You should not be able to reproduce the issue the second time you start the program.
  • When I run my program and the first file to be changed, then it needs the 8 seconds waiting time ... all the other files then pass through.
  • When run it again without exit my program, it run all files without waiting time.
  • When I restart my program, I have again the 8 seconds waiting time for the first file.
Coordinator
Aug 15, 2016 at 7:13 PM
What happens when you remove the contents of the following folder: C:\Users\Oliver\AppData\Local\ImageMagick\? Are any files being created there when you run your test program again?
Aug 15, 2016 at 7:25 PM
i have delete this folder, here is new logfile:
Log: 2016-08-15 2124
Aug 15, 2016 at 7:39 PM
And now, i have delete this folder:
C:\Users\Oliver\AppData\Local\Temp\Magick.NET

And here is new log-line:
IM-Debug [02542]: 2016-08-15T21:33:37+02:00 0:02.199 2.141u 7.0.2 Trace [8364]: utility.c/GetPathComponent/1213/Trace ....\ImageMagick\MagickCore\blob.c
IM-Debug [02543]: 2016-08-15T21:33:43+02:00 0:08.468 8.406u 7.0.2 Trace [8364]: image.c/CloneImage/812/Trace none
Coordinator
Aug 15, 2016 at 7:43 PM
I was asking for a deletion of another folder and the contents of that folder when you exit your program.
Aug 15, 2016 at 7:50 PM
I have both deleted folder, one by one and looked if it improves.
This folder will always be recreated "C:\Users\Oliver\AppData\Local\Temp\Magick.NET"

No change, I have to always wait 8 seconds for the first file. if so, then this is so. if you can fix this, of course, it would of course be good. but we must not solve violence with all this.
Coordinator
Aug 15, 2016 at 7:52 PM
Edited Aug 15, 2016 at 7:55 PM
Do you have a folder called C:\Users\Oliver\AppData\Local\ImageMagick on your system? And does it contain files? This is not the same folder was you were talking about.

p.s. There is an easy way to resolve your issue but I would really like to understand why this is happening so I can fix it and help other users who run into this issue.
Aug 15, 2016 at 8:09 PM
Yes i have this folder. And this is this content:
  • ImagemagickOpenCLDeviceProfile.xml
When i start image-magick debug-log, then this recreated this folder.
without this lines:
            IM.MagickNET.SetLogEvents(IM.LogEvents.All | IM.LogEvents.Trace);
            IM.MagickNET.Log += MagickNET_Log;
then this folder is not recreated.

here in my program, when i resize 14 files...
this execption has "blame" :-)

IM-Debug [00133]: 2016-08-15T22:06:08+02:00 0:09.099 1.234u 7.0.2 Exception [5340]: blob.c/FileToBlob/992/ Exception
unable to open file 'C:\Users\Oliver\AppData\Local\ImageMagick\magick_opencl_Intel(R)_HD_Graphics_4600_0d076197_64.bin': No such file or directory
IM-Debug [00134]: 2016-08-15T22:06:14+02:00 0:15.218 7.344u 7.0.2 Resource [5340]: resource.c/AcquireMagickResource/314/Resource
Width: 1.92KB/0P/10MP
Coordinator
Aug 15, 2016 at 8:23 PM
Edited Aug 15, 2016 at 8:27 PM
What is the contents of the file: ImagemagickOpenCLDeviceProfile.xml?

p.s. Thanks for being so responsive in helping me figure out what is going on.
Aug 15, 2016 at 8:27 PM
<devices>
<device name="CPU" score="7.636"/>
<device platform="Intel(R) OpenCL" name="Intel(R) HD Graphics 4600" version="20.19.15.4331" maxClockFrequency="1200" maxComputeUnits="20" score="0.3454"/>
<device platform="Intel(R) OpenCL" name="Intel(R) Core(TM) i5-4690 CPU @ 3.50GHz" version="5.2.0.10094" maxClockFrequency="3500" maxComputeUnits="4" score="0.6649"/>
</devices>
Coordinator
Aug 15, 2016 at 8:53 PM
It looks like your OpenCL driver does not allow getting the binaries of the OpenCL kernel. Not sure how I can properly handle this in ImageMagick. Will need to come up with a plan for that. Thanks for your help and I think it is just best to disable OpenCL in your situation. You can do that with OpenCL.IsEnable = false. I might ask you for help again once I figured out how to work around this issue.
Aug 15, 2016 at 9:06 PM
Edited Aug 15, 2016 at 9:08 PM
OK, i have set this value of false.
and here is new log:
Log 2016-08-15 2303

Are there any drawbacks?
Can I use this as a standard in my software?


after set this parameter, run now from first file without waiting time.
very nice :-)
Coordinator
Aug 16, 2016 at 5:04 AM
Edited Aug 16, 2016 at 5:08 AM
The drawback is that it your resize is a prabably bit slower without OpenCL enbaled. But its safe to turn it off by default though.