Share via

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 Document Intelligence in Foundry Tools
Foundry Tools
Foundry Tools

Formerly known as Azure AI Services or Azure Cognitive Services is a unified collection of prebuilt AI capabilities within the Microsoft Foundry platform

Azure Vision in Foundry Tools

1 answer

Sort by: Most helpful
  1. YutongTie-9091 54,021 Reputation points Moderator
    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.

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.