You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
try{// Read invalid jpg fileusing(MagickImageimage=newMagickImage("InvalidFile.jpg")){}}// Catch any MagickExceptioncatch(MagickExceptionexception){// Write excepion raised when reading the invalid jpg to the consoleConsole.WriteLine(exception.Message);}try{// Read corrupt jpg fileusing(MagickImageimage=newMagickImage("CorruptImage.jpg")){}}// Catch only MagickCorruptImageErrorExceptioncatch(MagickCorruptImageErrorExceptionexception){// Write excepion raised when reading the corrupt jpg to the consoleConsole.WriteLine(exception.Message);}
VB.NET
Try' Read invalid jpg fileUsingimageAsNewMagickImage("InvalidFile.jpg")EndUsing' Catch any MagickExceptionCatchexceptionAsMagickException' Write excepion raised when reading the invalid jpg to the consoleConsole.WriteLine(exception.Message)EndTryTry' Read corrupt jpg fileUsingimageAsNewMagickImage("CorruptImage.jpg")EndUsing' Catch only MagickCorruptImageErrorExceptionCatchexceptionAsMagickCorruptImageErrorException' Write excepion raised when reading the corrupt jpg to the consoleConsole.WriteLine(exception.Message)EndTry
Obtain warning that occurred during reading
C#
using(MagickImageimage=newMagickImage()){// Attach event handler to warning eventimage.Warning+=MagickImage_Warning;// Read file that will raise a warning.image.Read("FileWithWarning.jpg");}
VB.NET
UsingimageAsNewMagickImage()' Attach event handler to warning eventAddHandlerimage.Warning,AddressOfMagickImage_Warning' Read file that will raise a warning.image.Read("FileWithWarning.jpg")EndUsing