This project has moved and is read-only. For the latest updates, please go here.

Difference between Magick.NET-AnyCPU and Magick.NET.Core

Apr 21, 2016 at 1:43 AM
Edited Apr 21, 2016 at 1:45 AM
In my current project I am using both the libraries (not sure if it is ok or not but working fine)
What is purpose of those (I know that we can manipulate images but other than that). I am trying to change from AnyCpu to x64 version, Can we have both references in one?
Apr 21, 2016 at 5:37 AM
Magick.NET.Core is a version of Magick.NET that works under .NET Core (https://dotnet.github.io/) and you probably don't need that. You should use a version that has x64 in the name If you want to switch to the x64 version. For example this one: https://www.nuget.org/packages/Magick.NET-Q16-x64/
Apr 21, 2016 at 6:10 PM
Edited Apr 21, 2016 at 10:47 PM
But I am not able to use ImageMagick.Internal namespace without .NET Core. It shows error after I remove .NET Core reference for the properties point, resolution. Is there a way to avoid these errors with using just Q16-x64 dll and not .NET Core? Thanks.
Apr 21, 2016 at 8:05 PM
You don't need the .NET Core reference If you just add the reference to the NuGet package that I linked in my previous post. I also don't know where you found the ImageMagick.Internal namespace but you really don't need that.
Apr 21, 2016 at 10:49 PM
Edited Apr 21, 2016 at 11:01 PM
I used that name space after adding reference to .NET.Core.
The same version (104) of x64 i am using that was downloaded from NuGet feature.

sample error: 'ImageMagick.MagickImage' does not contain a definition for 'ResolutionUnits' and no extension method 'ResolutionUnits' accepting a first argument of type 'ImageMagick.MagickImage' could be found (are you missing a using directive or an assembly reference?)

Also "image.Density = new PointD(150, 150);" is giving below error
Cannot implicitly convert type 'ImageMagick.PointD' to 'ImageMagick.Density'

All those were working fine with .NET Core reference. Thanks for the help.
Apr 24, 2016 at 11:23 AM
I made some changes in the library a while and you will need to change your code. You will need to use the new Density class to set image.Density. The ResolutionUnits property is now also part of the Density class. And please stop adding the reference to .NET.Core.
Apr 25, 2016 at 10:53 PM
Edited Apr 25, 2016 at 11:14 PM
Thanks for the response, I added only x64 dll now and I am able to use density property but still having issues with ResolutionX, ResolutionY, ResolutionUnits, and TransformScale properties with x64 version (which was fine with AnyCPU version). Could you please provide me sample code if possible?
Also I have one more question, AnyCPU was creating a huge file (more than 100GB) in temp folder once in a while which is taking up most of available memory does this latest x64 will solve that issue as well? ( I am going to try anyway but just asking) Thanks.
Apr 26, 2016 at 9:58 PM
Edited Apr 26, 2016 at 9:59 PM
Those properties no longer exist and that is why you have issues with them. And it is possible that you get a huge file in your temp folder when you read an image with ridiculous dimensions (width*height).
Apr 26, 2016 at 10:42 PM
Is it, thanks for the info. Could you please let me know what was the latest version (or last version) of x64 with all the above properties available without using .NET.Core?
Thanks.
Apr 27, 2016 at 10:48 AM
ResolutionX, ResolutionY, ResolutionUnits were replaced with Density between 7.0.0.0102 and 7.0.0.0104. I would recommend you to use the new properties instead. And the TransformScale methodd has also been removed between those version. You can set that with the Affine property of MagickImage.Settings.Affine. I will add some methods to the DrawableAffine class so you don't have to calculate it yourself.
Apr 27, 2016 at 4:46 PM
that will be great, thank you so much for the help!!
Apr 27, 2016 at 9:41 PM
Edited Apr 27, 2016 at 9:41 PM
Below is an example to clarify how you should set the ResolutionUnits for Density since it is a read only property.
image.Density = new Density(72, DensityUnit.PixelsPerInch);
Apr 28, 2016 at 8:33 PM
Thank you so much!!
Apr 30, 2016 at 12:12 AM
Edited May 2, 2016 at 7:15 PM
sorry for clubbing all questions here, is there any known issue that causes intermittent crash of application while writing magicknet image? I am seeing this issue with AnyCPU version. This crash does not catches exception using try catch block either. Just stops execution. Could we have a return boolean type while writing image just to see if fails instead of void type.
I am working on updating to latest x64 library for this change I need wait some time. Could you please let me know if there is any issue that relates to this problem.
Thanks.
May 9, 2016 at 10:54 PM
Edited May 9, 2016 at 11:05 PM
Hello, I have updated to latest library (x64bit) everything works great as I tested for few days.
But there is one thing, everything works good as long as I ran the app from visual studio. After publishing, it shows error 'Unable to load DLL 'Magick.NET-q16-x64.Native dll' : The specified module could not be found. <exception from HRESULT: 0x8007007E>. Could you please explain this? Thanks.
May 10, 2016 at 12:08 AM
Edited May 10, 2016 at 12:09 AM
An update on this, it worked fine when I copied the native dll manually into windows system32 folder. (I tried adding that as reference/COM reference too which didn't work) Is this the only solution? Thanks
Jul 12, 2016 at 11:17 PM
I have similar issue with Magick.NET-q16-x64.Native.dll. Can someone please confirm if manually copying it to the system32 folder is the only option? If this is the case, it might not work for my production environment. Thanks.
Jul 15, 2016 at 6:52 PM
Thanks for sending me the better explanation through CodePlex Sam. Have you tried copying the Magick.NET-q16-x64.Native.dll file into the bin folder of your project? And instead of using the zip package it might be easier to use the NuGet version that will do that automatically.
Jul 15, 2016 at 10:12 PM
Thanks for the quick reply. Yes, manually copying Magick.NET-q16-x64.Native.dll file into the bin folder or using the NuGet version does seem to work for my app. However, my tests still complain about unable to find it even though it is found in my test project's bin folder. Any other suggestions? Thanks again.
Jul 15, 2016 at 10:18 PM
You probably also need to copy the native.dll into the bin folder of your test project.
Jul 15, 2016 at 11:03 PM

The native dll is already found in the test’s bin folder, but the test still failed to find it. Will try again on Monday.

Thanks for your help,

Sam