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 OCR_IMG_PREPROCESS_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. | OCR_IMG_PREPROCESS_SCALE(0.3) - 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. | OCR_IMG_PREPROCESS_SCALE(2) - proportionally increase the width and height of the image to twice its original size. |
std::string image_path = "source.png";
custom_preprocessing_filters filters_;
filters_.filter_1 = OCR_IMG_PREPROCESS_SCALE(0.8);
asposeocr_preprocess_page_and_save(image_path.c_str(), "result.png", filters_);
You can manually define the width and height of the target image (in pixels) using the OCR_IMG_PREPROCESS_RESIZE
preprocessing filter.
std::string image_path = "source.png";
custom_preprocessing_filters filters_;
filters_.filter_1 = OCR_IMG_PREPROCESS_RESIZE(1500, 2500);
asposeocr_preprocess_page_and_save(image_path.c_str(), "result.png", filters_);
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.