Control (limit) resource usage in Magick.NET using C#

Magick.NET is an object-oriented C# interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning Magick.NET
Post Reply
Ljurka
Posts: 4
Joined: 2018-07-01T13:53:12-07:00
Authentication code: 1152

Control (limit) resource usage in Magick.NET using C#

Post by Ljurka »

I am looking for the write to way setup limit memory from backend C# code.
I see that it possible via command line -limit memory 32MiB
but could I set up it via backend C#? The rest of settings I would like to leave as is by default.

Also I see that ImageMagick.Configuration.ConfigurationFiles but do not know is it what I need or not and how it could be used if yes.

Any help would be much appreciated.
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: Control (limit) resource usage in Magick.NET using C#

Post by dlemstra »

You are looking for the ResourceLimits class.
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
Ljurka
Posts: 4
Joined: 2018-07-01T13:53:12-07:00
Authentication code: 1152

Re: Control (limit) resource usage in Magick.NET using C#

Post by Ljurka »

Thank you!
Is it enough just to set ResourceLimits.Memory=32...
or is it require more sophisticated initizlization?
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: Control (limit) resource usage in Magick.NET using C#

Post by dlemstra »

The value is in bytes so you should set it to `33554432` if you want to limit it to 32MiB
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
Post Reply