An output binding lets an Azure Function send produced data to an external resource. In a practical image-processing flow, the function writes a resized image to Blob Storage without handling storage access directly. section 8.2.2
A typical output-binding workflow:
- Declare a Blob output binding alongside the HTTP trigger. section 8.2.2
- Receive the destination as a writable stream, resize the image, and save it to the stream. section 8.2.2
- Test locally with images in an Azurite Blob container before deploying from VS Code. section 8.2.2
[FunctionName("ProcessNFT")]
public static void Run(
[HttpTrigger(AuthorizationLevel.Anonymous,
"get", "post", Route = "nft/{nftid}")] HttpRequest req, #1
[Blob("originalnfts/{nftid}", FileAccess.Read)]
Stream nftImage, #2
[Blob("copynfts/{nftid}", FileAccess.Write)]
Stream nftSmall) #3
{
IImageFormat format;
using (Image<Rgba32> input =
Image.Load<Rgba32>(nftImage, out format)) #4
{
input.Mutate(x => x.Resize(320, 200)); #5
input.Save(nftSmall, format); #6
}
}
The annotated function shows the output binding writing the resized image to copynfts/{nftid}. section 8.2.2
