public async Task <FileContentResult> Post() { using var reader = new StreamReader(Request.Body); var requestBody = await reader.ReadToEndAsync(); reader.Close(); if (requestBody.Length < 23) { return(new FileContentResult(new byte[] {}, "text/plain")); } var imageBase64 = RemoveDataUrlPrefix(requestBody); var imageBytes = Convert.FromBase64String(imageBase64); await using var ms = new MemoryStream(imageBytes, 0, imageBytes.Length); _imageProcessor.SetImage(ms); var qrCodeMontage = _imageProcessor.GenerateMontage(); return(File(qrCodeMontage.ToByteArray(MagickFormat.Png), "image/png")); }