Пример #1
0
        public static Tuple <Bitmap, Bitmap> DropShadow(Bitmap img, int RangeX, int RangeY, Color C, float sigma, int range, float Opacity)
        {
            Bitmap DropShadowImage = DropShadowIMG(img, RangeX, RangeY, C, sigma, range, Opacity);

            List <Bitmap> imgsToOverlay = new List <Bitmap>();

            imgsToOverlay.Add(DropShadowImage);
            imgsToOverlay.Add(img);

            return(new Tuple <Bitmap, Bitmap>(ImageMultiFilter.OverlayImages(imgsToOverlay, 1, 1), DropShadowImage));
        }
Пример #2
0
        public static Bitmap AddBackgroundImage(Bitmap img, Color C)
        {
            Bitmap background = ImageConstruct.MatchColorImage(img, C);

            List <Bitmap> imagesToOverlay = new List <Bitmap>();

            imagesToOverlay.Add(background);
            imagesToOverlay.Add(img);

            return(ImageMultiFilter.OverlayImages(imagesToOverlay, 1, 1));
        }
Пример #3
0
        //Colorize Rename, Colorize Using IMG
        public static Bitmap TintImage(Bitmap img, Color C, float Value)
        {
            Bitmap coloredIMG = ImageConstruct.MatchColorImage(img, C);
            Bitmap greyScale  = Grayscale.CommonAlgorithms.RMY.Apply(img);
            Bitmap getAlpha   = ImageUtil.getARGBA(greyScale).Item1;

            coloredIMG = ImageMultiFilter.RGBA_replaceChannel(coloredIMG, null, null, null, getAlpha);
            coloredIMG = opacityFilter(coloredIMG, Value);

            List <Bitmap> imgsToOverlay = new List <Bitmap>();

            imgsToOverlay.Add(img);
            imgsToOverlay.Add(coloredIMG);
            return(ImageMultiFilter.OverlayImages(imgsToOverlay, 1, 1));
        }
Пример #4
0
        /// <summary>
        /// Get a bunch of image and array them in a grid. Make sure each image would fit one rectagular section that is of equal size with everyone else.
        /// </summary>
        /// <param name="imgs">Images to Combine</param>
        /// <param name="warp">The grid cells in one dimention</param>
        /// <param name="pad">Padding between the images</param>
        /// <param name="dir">Array Images Horizontally first</param>
        /// <returns></returns>
        public static Bitmap GridImagesRectangular(List <Bitmap> imgs, int warp, int pad, Boolean dir)
        {
            //Split Lists into multiple lists
            var s          = ImageUtil.maxSize(imgs);
            var background = new Bitmap(s.Item1, s.Item2);
            var resized    = imgs.Select(x => ImageShape.MatchMinDimention(background, x));
            List <IEnumerable <Bitmap> > listOfLists = ImageUtil.splitList(resized.ToList(), warp);
            //List To place the images for One Direction
            List <Bitmap> firstPassBitmaps = new List <Bitmap>();

            //For each List
            foreach (IEnumerable <Bitmap> myList in listOfLists)
            {
                List <Bitmap> CastList = myList.ToList();
                if (CastList.Count == warp)
                {
                    firstPassBitmaps.Add(ArrayImages(CastList, 1, dir, pad));
                }
                else
                {
                    var    imageLess = ArrayImages(CastList, 1, dir, pad);
                    Bitmap img, joined;
                    if (dir)
                    {
                        img    = new Bitmap(CastList[0].Width * warp, CastList[0].Height);
                        joined = ImageMultiFilter.OverlayImages(new List <Bitmap> {
                            img, imageLess
                        }, 0, 1);
                    }
                    else
                    {
                        img    = new Bitmap(CastList[0].Width, CastList[0].Height * warp);
                        joined = ImageMultiFilter.OverlayImages(new List <Bitmap> {
                            img, imageLess
                        }, 1, 0);
                    }
                    firstPassBitmaps.Add(joined);
                }
            }


            //Repeat with the other direction
            List <Bitmap> firstPassBitmapsMod = ImageShape.resizeImage(firstPassBitmaps, dir);
            Bitmap        finalBitmap         = ArrayImages(firstPassBitmapsMod, 1, !dir, pad);

            return(finalBitmap);
        }
Пример #5
0
        public static Bitmap MatchMinDimention(Bitmap reference, Bitmap toMatch)
        {
            float scaleX = reference.Width / (float)toMatch.Width;
            float scaleY = reference.Height / (float)toMatch.Height;

            var newHeight = scaleX * toMatch.Height;

            var    newWidth = scaleY * toMatch.Width;
            Bitmap BitmapNew;

            if (newHeight > reference.Height)
            {
                BitmapNew = new Bitmap(toMatch, (int)(scaleY * toMatch.Width), (int)(scaleY * toMatch.Height));
            }
            else
            {
                BitmapNew = new Bitmap(toMatch, (int)(scaleX * toMatch.Width), (int)(scaleX * toMatch.Height));
            }
            var backGround = new Bitmap(reference.Width, reference.Height);

            return(ImageMultiFilter.OverlayImages(new List <Bitmap> {
                backGround, BitmapNew
            }, 1, 1));
        }