Ejemplo n.º 1
0
        private static byte[] CallFunction(byte[] photoBytes, string textDiplay,
                                           string bubbleFigure, string bubblePos, string filter)
        {
            string assetsPath = ConfigurationManager.AppSettings["ASSETS_ROOT"] ?? @"C:\Temp\images\";

            bubbleFigure = bubbleFigure.ToUpper();
            bubblePos    = bubblePos.ToUpper();
            filter       = filter.ToUpper();

            var imgGen = new MemeImgGen.ImageProcessor(assetsPath);

            BubbleFigure   figure       = (BubbleFigure)Enum.Parse(typeof(BubbleFigure), bubbleFigure);
            BubblePosition position     = (BubblePosition)Enum.Parse(typeof(BubblePosition), bubblePos);
            BubbleFilter   bFilter      = (BubbleFilter)Enum.Parse(typeof(BubbleFilter), filter);
            IMatrixFilter  bubbleFilter = imgGen.GetFilterByName(bFilter);

            // 이미지 변환 메서드 호출
            byte[] outBytes = imgGen.ImageGenerate(photoBytes, textDiplay, figure, position, bubbleFilter);
            return(outBytes);
        }
Ejemplo n.º 2
0
        public static async void Run(
            [QueueTrigger("meme-que")] VisionInfo info,
            string BlobName,
            [Blob("meme-input/{BlobName}", FileAccess.Read)] byte[] inputBlob,
            [Blob("meme-output/{BlobName}", FileAccess.Write)] Stream outputBlob,
            TraceWriter log)
        {
            string assetsPath = ConfigurationManager.AppSettings["ASSETS_ROOT"] ?? @"C:\Temp\images\";

            string bubbleFigure = info.BubbleInfo.Figure.ToUpper();
            string bubblePos    = info.BubbleInfo.Position.ToUpper();
            string filter       = info.BubbleInfo.Filter.ToUpper();
            string textDisplay  = info.BubbleInfo.Text;
            var    imgGen       = new MemeImgGen.ImageProcessor(assetsPath);

            BubbleFigure   figure       = (BubbleFigure)Enum.Parse(typeof(BubbleFigure), bubbleFigure);
            BubblePosition position     = (BubblePosition)Enum.Parse(typeof(BubblePosition), bubblePos);
            BubbleFilter   bFilter      = (BubbleFilter)Enum.Parse(typeof(BubbleFilter), filter);
            IMatrixFilter  bubbleFilter = imgGen.GetFilterByName(bFilter);

            // 이미지 변환 메서드 호출
            byte[] outBytes = imgGen.ImageGenerate(inputBlob, textDisplay, figure, position, bubbleFilter);
            await outputBlob.WriteAsync(outBytes, 0, outBytes.Length);
        }