Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static class Function1
- {
- /* public static void Run(string background, string overlay, CloudBlockBlob outputBlob, TraceWriter log) */
- [FunctionName("ConvertMe")]
- public async static Task RunASync([HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] HttpRequest req,
- [Blob("Test", FileAccess.ReadWrite)]CloudBlockBlob Image1,
- [Blob("Test", FileAccess.ReadWrite)]CloudBlockBlob Image2,
- CloudBlockBlob outputBlob,ILogger log)
- {
- log.LogInformation($"Function triggered with blob\n Background: {Image1.Name} \n Overlay: {Image2.Name}");
- ConvertMe Converter = new ConvertMe(System.Drawing.Color.Black);
- Bitmap _Main = new Bitmap(Image1.StorageUri.PrimaryUri.AbsolutePath);
- Bitmap Overlay = Converter.MakeTransparent(Image2.StorageUri.PrimaryUri.AbsolutePath);
- using (MemoryStream memory = new MemoryStream())
- {
- Converter.ComebineBitmap(_Main, Overlay).Save(memory, ImageFormat.Jpeg);
- memory.Position = 0;
- outputBlob.Properties.ContentType = "image/jpeg";
- await outputBlob.UploadFromStreamAsync(memory);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment