Community

ArgumentException

In the following code snippet:

var imageStream = new ReadStream(myByteArrayFile); 
var image = imageTools.OpenImageFileFromStream(imageStream); 

if (improveQuality) 
{ 
     for (var pageIndex = 0; pageIndex < image.PagesCount; pageIndex++) 
     { 
           var page = image.OpenImagePage(pageIndex); 
           page = imageTools.RemoveNoise(page, null); 
           // Image quality improvements ... 
      } 
} 

 When attempting to execute the RemoveNoise() method, the following exception is being thrown:

System.ArgumentException: Arguments check failed. Expected: _sourceImage->GetInternalImageFormat() == Image::IIF_RGB    
at FCEngine.IImageProcessingTools.RemoveNoise(IImage Image, IDenoiseFilterParams Params)

 I would like to know the possible reasons why this exception is being thrown, and how to circumvent it.

Was this article helpful?

0 out of 0 found this helpful

Comments

1 comment

  • Avatar
    Daria Zvereva

    Hello!

    The RemoveNoise method of the ImageProcessingTools object can be used for color images only. Kindly check the article API Reference→Objects→Image-Related Objects→ImageProcessingTools→RemoveNoise in the Developer’s Help for more details. Please make sure you are trying to preprocess the color image (not black-and-white). 

    Please note that some methods require images of the specific color type. You can check this in the Developer’s Help if necessary.  

    Hope the information will be helpful!

     

    0

Please sign in to leave a comment.