/// <summary>
        /// Create the negative of a given image
        /// </summary>
        /// <param name="fileName"></param>
        /// <param name="outputFile"></param>
        /// <returns></returns>
        public static bool NegativePicture(string fileName, string outputFile)
        {
            Bitmap img = CreateBitmap(fileName);

            if (img != null)
            {
                int width  = img.Width;
                int height = img.Height;

                Bitmap newImg = CreateBitmap(width, height);

                for (int i = 0; i < width; i++)
                {
                    for (int j = 0; j < height; j++)
                    {
                        System.Drawing.Color p         = img.GetPixel(i, j);
                        System.Drawing.Color pNegative = NegativePixel(p);
                        newImg.SetPixel(i, j, pNegative); // Set the pixel
                    }
                }
                img.Dispose(); // Allow to override the loaded picture without crashing
                if (System.IO.File.Exists(outputFile))
                {
                    FileUtilsShared.TryDeleteFile(outputFile); // Delete the file if it already exists
                }
                return(TrySaveImageDispose(newImg, outputFile));
            }

            return(false);
        }
        /// <summary>
        /// Flip a given image horizontally and/or vertically
        /// </summary>
        /// <param name="fileName"></param>
        /// <param name="outputFile"></param>
        /// <param name="horizontal"></param>
        /// <param name="vertical"></param>
        /// <returns></returns>
        public static bool FlipTexture(string fileName, bool horizontal, bool vertical, string outputFile)
        {
            Bitmap img = CreateBitmap(fileName);

            if (img != null)
            {
                Bitmap newImg = CreateBitmap(img);

                if (horizontal && vertical)
                {
                    newImg.RotateFlip(RotateFlipType.RotateNoneFlipXY);
                }
                else
                {
                    if (horizontal)
                    {
                        newImg.RotateFlip(RotateFlipType.RotateNoneFlipX);
                    }
                    else if (vertical)
                    {
                        newImg.RotateFlip(RotateFlipType.RotateNoneFlipY);
                    }
                }
                img.Dispose(); // Allow to override the loaded picture without crashing
                if (System.IO.File.Exists(outputFile))
                {
                    FileUtilsShared.TryDeleteFile(outputFile); // Delete the file if it already exists
                }
                return(TrySaveImageDispose(newImg, outputFile));
            }

            return(false);
        }
        /// <summary>
        /// Mirror a given image horizontally and/or vertically
        /// </summary>
        /// <param name="fileName"></param>
        /// <param name="outputFile"></param>
        /// <param name="horizontal"></param>
        /// <param name="vertical"></param>
        /// <returns></returns>
        public static bool MirrorTexture(string fileName, bool horizontal, bool vertical, string outputFile)
        {
            Bitmap img = CreateBitmap(fileName);

            if (img != null)
            {
                int width    = img.Width;
                int maxWidth = horizontal ? width * 2 : width;

                int height    = img.Height;
                int maxHeight = vertical ? height * 2 : height;

                Bitmap newImg = CreateBitmap(maxWidth, maxHeight);

                for (int i = 0; i < width; i++)
                {
                    for (int j = 0; j < height; j++)
                    {
                        System.Drawing.Color p = img.GetPixel(i, j);
                        newImg.SetPixel(i, j, p); // Set the pixel
                        int newWidth  = maxWidth - 1 - i;
                        int newHeight = maxHeight - 1 - j;
                        if (horizontal)
                        {
                            newImg.SetPixel(newWidth, j, p); // Set the mirrored pixel
                        }
                        if (vertical)
                        {
                            newImg.SetPixel(i, newHeight, p); // Set the mirrored pixel
                        }
                        if (horizontal && vertical)
                        {
                            newImg.SetPixel(newWidth, newHeight, p); // Set the mirrored pixel
                        }
                    }
                }
                img.Dispose(); // Allow to override the loaded picture without crashing
                if (System.IO.File.Exists(outputFile))
                {
                    FileUtilsShared.TryDeleteFile(outputFile); // Delete the file if it already exists
                }
                return(TrySaveImageDispose(newImg, outputFile));
            }

            return(false);
        }
        /// <summary>
        /// Create a transparent image using the original image and its alpha
        /// </summary>
        /// <param name="alphaFile"></param>
        /// <param name="textureFile"></param>
        /// <param name="outputFile"></param>
        /// <returns></returns>
        public static bool MakeTransparent(string alphaFile, string textureFile, string outputFile)
        {
            Bitmap BmpA = CreateBitmap(alphaFile);
            Bitmap BmpC = CreateBitmap(textureFile);

            if (BmpA != null && BmpC != null)
            {
                if (AreSameSize(BmpA, BmpC))
                {
                    int    width  = BmpA.Width;
                    int    height = BmpA.Height;
                    Bitmap newImg = CreateBitmap(width, height);

                    for (int i = 0; i < width; i++)
                    {
                        for (int j = 0; j < height; j++)
                        {
                            System.Drawing.Color alphaPixel   = BmpA.GetPixel(i, j);
                            System.Drawing.Color texturePixel = BmpC.GetPixel(i, j);
                            if (alphaPixel.R == 255 && alphaPixel.G == 255 && alphaPixel.B == 255) // White pixel
                            {
                                newImg.SetPixel(i, j, transparentPixel);                           // Set transparent pixel
                            }
                            else
                            {
                                newImg.SetPixel(i, j, texturePixel); // Set the texture pixel
                            }
                        }
                    }

                    BmpA.Dispose(); // Dispose the file streams so we can overwrite the files
                    BmpC.Dispose();
                    if (System.IO.File.Exists(outputFile))
                    {
                        FileUtilsShared.TryDeleteFile(outputFile); // Delete the file if it already exists
                    }
                    return(TrySaveImageDispose(newImg, outputFile));
                }
            }
            return(false);
        }