public void Test_ICM() { using (MagickImage image = new MagickImage(Files.SnakewarePNG)) { ColorProfile profile = image.GetColorProfile(); Assert.IsNull(profile); image.AddProfile(new ImageProfile("icm", ColorProfile.SRGB.ToByteArray())); TestProfile(image.GetColorProfile(), "icm"); } }
public void Test_Remove() { using (MagickImage image = new MagickImage(Files.SnakewarePNG)) { ColorProfile profile = image.GetColorProfile(); Assert.IsNull(profile); image.AddProfile(ColorProfile.SRGB); Assert.IsNull(image.GetProfile("icm")); profile = image.GetColorProfile(); Assert.IsNotNull(profile); image.RemoveProfile(profile.Name); profile = image.GetColorProfile(); Assert.IsNull(profile); } }
public void Test_Execute_ImageProfile() { MagickScript script = new MagickScript(Files.Scripts.ImageProfile); using (MagickImage image = new MagickImage(Files.MagickNETIconPNG)) { ColorProfile colorProfile = image.GetColorProfile(); Assert.IsNull(colorProfile); script.Execute(image); colorProfile = image.GetColorProfile(); Assert.IsNotNull(colorProfile); Assert.AreEqual(colorProfile.ToByteArray().Length, ColorProfile.SRGB.ToByteArray().Length); } }
public void Test_WithImage() { using (MagickImage image = new MagickImage()) { image.AddProfile(ColorProfile.USWebCoatedSWOP); ExceptionAssert.Throws<MagickCacheErrorException>(delegate () { image.ColorSpace = ColorSpace.CMYK; }); image.Read(Files.SnakewarePNG); ColorProfile profile = image.GetColorProfile(); Assert.IsNull(profile); image.AddProfile(ColorProfile.SRGB); TestProfile(image.GetColorProfile(), "icc"); } }
public void Test_AddProfile() { using (MagickImage image = new MagickImage(Files.SnakewarePNG)) { ColorProfile profile = image.GetColorProfile(); Assert.IsNull(profile); image.AddProfile(ColorProfile.SRGB); profile = image.GetColorProfile(); Assert.IsNotNull(profile); Assert.AreEqual(3144, profile.ToByteArray().Length); image.AddProfile(ColorProfile.AppleRGB, false); profile = image.GetColorProfile(); Assert.IsNotNull(profile); Assert.AreEqual(3144, profile.ToByteArray().Length); image.AddProfile(ColorProfile.AppleRGB); profile = image.GetColorProfile(); Assert.IsNotNull(profile); Assert.AreEqual(552, profile.ToByteArray().Length); } }