I updated from 4 to 7, because my old library was throwing an SEHException that I couldn't navigate around. I was hoping the update had fixed the issue. With the update, I ran into changes in the library code. Below I've outlined the problem areas. Any help would be appreciated.
Font, FillColor, StrokeColor and TextGravity no longer exist in the following. I'm having trouble finding where it was changed in the change logs.
Also the name of MagickResourceLimiteErrorException has changed in the following. Is there a new name, or does the library no longer throw it?
Font, FillColor, StrokeColor and TextGravity no longer exist in the following. I'm having trouble finding where it was changed in the change logs.
using (MagickImage image = new MagickImage("xc:black", settings))
{
image.Format = MagickFormat.Png;
image.Font = "Arial";
image.FillColor = new MagickColor("gray");
image.StrokeColor = new MagickColor("red");
image.BackgroundColor = new MagickColor("black");
// Center text vertically
image.TextGravity = Gravity.Center;
// Build label
StringBuilder sb = new StringBuilder("label:");
// If directory name <= 20
if (dirInfo.Name.Length <= 20)
{
sb.Append(dirInfo.Name);
sb.Append("\n");
}
sb.Append("No Images");
image.Read(sb.ToString());
image.Write(dirThumbLocation);
}
How do I set the image's Gamma? In the following I used to use image.Gamma()public static void AdjustColor(MagickImage image, ImageDTO dto)
{
image.BrightnessContrast(new Percentage(dto.Brightness), new Percentage(dto.Contrast));
image.Gamma(dto.Gamma);
image.Evaluate(Channels.Red, EvaluateOperator.Add, dto.Red);
image.Evaluate(Channels.Green, EvaluateOperator.Add, dto.Green);
image.Evaluate(Channels.Blue, EvaluateOperator.Add, dto.Blue);
}
I hadPixelCollection pixels = image.GetReadOnlyPixels();
and changed it toPixelCollection pixels = image.GetPixels();
I hope this works.Also the name of MagickResourceLimiteErrorException has changed in the following. Is there a new name, or does the library no longer throw it?
try
{
using (MagickImage image = new MagickImage(file.FullName))
colors = GetColorsOfImage(image);
}
catch (MagickResourceLimitErrorException)
{
FileInfo thumbLocation = ImageThumb.ThumbLocation(file, true);
using (MagickImage image = new MagickImage(thumbLocation.FullName))
colors = GetColorsOfImage(image);
}