Azure / azure-sdk-for-net

This repository is for active development of the Azure SDK for .NET. For consumers of the SDK we recommend visiting our public developer docs at https://learn.microsoft.com/dotnet/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-net.
MIT License
5.36k stars 4.79k forks source link

Can you download a figure similar to the functionality in Document Intelligence Studio? #46552

Open dccrain opened 4 days ago

dccrain commented 4 days ago

Library name and version

Azure.AI.DocumentIntelligence 1.0.0-beta.3

Query/Question

Currently in Document Intelligence Studio, once a document is analyzed you can download figures from the document as .png files  Image

Is this functionality supported by the latest version of this package? If not is this something that is planned for future support? I would like to be able to send a document and extract the images from it for direct handling and use.

Environment

No response

jsquire commented 3 days ago

Thank you for your feedback. Tagging and routing to the team member best able to assist.

kinelski commented 3 days ago

Hello @dccrain,

This feature is currently supported by the SDK version you're using. The following snippet illustrates how to use it:

// Specify the output options to enable figure extraction.
IEnumerable<AnalyzeOutputOption> outputOptions = new[] { AnalyzeOutputOption.Figures };
Operation<AnalyzeResult> analyzeOperation = client.AnalyzeDocument(WaitUntil.Completed, <model-id>, <content>, output: outputOptions);
AnalyzeResult result = analyzeOperation.Value;

// All extracted figures should be listed in 'result.Figures'. Suppose we want to download the figure at index 1:
string figureId = result.Figures[1].Id;

// Get a BinaryData instance with the bytes of the figure.
Response<BinaryData> response = client.GetAnalyzeResultFigure(<model-id>, new Guid(analyzeOperation.Id), figureId);
BinaryData data = response.Value;
github-actions[bot] commented 3 days ago

Hi @dccrain. Thank you for opening this issue and giving us the opportunity to assist. We believe that this has been addressed. If you feel that further discussion is needed, please add a comment with the text "/unresolve" to remove the "issue-addressed" label and continue the conversation.