Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
The Aspose.OCR recognition engine can handle images of any size. However, very small and very large image sizes can adversely affect recognition:
Aspose.OCR offers flexible preprocessing filters that allow you to upscale small images, shrink large images, or resize an image to predefined width and height.
To scale images up or down proportionally, use the Scale
preprocessing filter. The filter takes a scaling ratio (floating point number) as a parameter:
Scaling ratio | Result | Example |
---|---|---|
0 to 1 |
Shrink the image proportionally to the specified percentage. | Scale(0.3F) - proportionally reduce the width and height of the image down to 30%. |
1 |
Keep the original image size. | |
Above 1 |
Upscale the image proportionally to the specified percentage. | Scale(2) - proportionally increase the width and height of the image to twice its original size. |
Scale
filter also allows you to select an interpolation algorithm as an optional parameter.
AsposeOCR api = new AsposeOCR();
// Scale the image to twice its original size using bilinear interpolation
PreprocessingFilter filters = new PreprocessingFilter();
filters.add(PreprocessingFilter.Scale(2, InterpolationFilterType.Triangle));
// Prepare batch
OcrInput images = new OcrInput(InputType.SingleImage, filters);
images.add("image.png");
// Save processed images to the folder
ImageProcessing.Save(images, "C:\\images");
You can manually define the width and height of the target image (in pixels) using the Resize
preprocessing filter. It also allows you to select an interpolation algorithm as an optional parameter.
AsposeOCR api = new AsposeOCR();
// Resize the image to 1000x1000 pixels with bilinear interpolation
PreprocessingFilter filters = new PreprocessingFilter();
filters.add(PreprocessingFilter.Resize(1000, 1000, InterpolationFilterType.Triangle));
// Prepare batch
OcrInput images = new OcrInput(InputType.SingleImage, filters);
images.add("image.png");
// Save processed images to the folder
ImageProcessing.Save(images, "C:\\images");
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.