When I try to recognize .jpg file with a QR code on a cloud from C# using this line:
BarcodeResponseList recognized = api.PostBarcodeRecognizeFromUrlOrContent(
new PostBarcodeRecognizeFromUrlOrContentRequest(image: imageStream)
);
it doesn’t get recognized because the operation timed out.
QR recognition doesn’t finish in 60 seconds.
But when I use same image on a site then QR code gets recognized.
So, the problem can be slow Aspose cloud response or something else.
While you scan QR barcode from an image in C# with Aspose.BarCode REST API, please set explicit barcode type hint for the respective barcode type as follows. Hopefully, it will resolve the issue. Otherwise, please share your source image with us for investigation.
Read QR Barcode From Image in C# With Aspose.BarCode REST API
BarcodeApi api = new BarcodeApi(ClientSecret, ClientId);
string filePath = @"C:/Downloads/QR.jpg";
using (Stream image = File.Open(filePath, FileMode.Open, FileAccess.Read))
{
// Act
BarcodeResponseList response = api.PostBarcodeRecognizeFromUrlOrContent(
new PostBarcodeRecognizeFromUrlOrContentRequest(
image: image,
preset: PresetType.HighPerformance.ToString(),
// Scan QR codes
type: DecodeBarcodeType.QR.ToString()
)
);
Console.WriteLine(response);
}