Bad Request while reading the image stream (ReadInStreamAsync) in some of the images

Adeel Kamran 0 Reputation points
2024-01-08T15:24:10.4166667+00:00

Hi, I am facing bad request error in some of the images using this function:

var textHeaders = await client.ReadInStreamAsync(imgStream).ConfigureAwait(false);

I am using OCR cognitive services function in Azure and I want to extract text from image (OCR), two images are quite identical but one image is passing the above function while the other one providing the bad request error message.

looking forward to hear.

Azure Computer Vision
Azure Computer Vision
An Azure artificial intelligence service that analyzes content in images and video.
329 questions
Azure AI Document Intelligence
Azure AI Document Intelligence
An Azure service that turns documents into usable data. Previously known as Azure Form Recognizer.
1,462 questions
Azure AI services
Azure AI services
A group of Azure services, SDKs, and APIs designed to make apps more intelligent, engaging, and discoverable.
2,490 questions
{count} votes

1 answer

Sort by: Most helpful
  1. YutongTie-MSFT 47,416 Reputation points
    2024-01-09T00:30:53.8633333+00:00

    @Adeel Kamran Thanks for reaching out to us, if your first call is successful but the second call failed, it maybe caused by your input is not following the requirements.

    The Read call takes images and documents as its input. They have the following requirements:

    • Supported file formats: JPEG, PNG, BMP, PDF, and TIFF
    • For PDF and TIFF files, up to 2000 pages (only the first two pages for the free tier) are processed.
    • The file size of images must be less than 500 MB (4 MB for the free tier) and dimensions at least 50 x 50 pixels and at most 10000 x 10000 pixels. PDF files do not have a size limit.
    • The minimum height of the text to be extracted is 12 pixels for a 1024 x 768 image. This corresponds to about 8 font point text at 150 DPI.

    If you believe your input is good enough, please share the API version you are working on, and your input image if that is not confidential.

    Regards,

    Yutong

    -Please kindly accept the answer if you feel helpful to support the community, thanks a lot.

    1 person found this answer helpful.
    0 comments No comments