Clone() public static method

Clone image.
The original Bitmap.Clone() does not produce the desired result - it does not create an actual clone (it does not create a copy of the image). That is why this method was implemented to provide the functionality.
public static Clone ( Bitmap source ) : Bitmap
source System.Drawing.Bitmap Source image.
return System.Drawing.Bitmap
 public static Bitmap OpenImage(this TextStructure filePath)
 {
     try
     {
         using (var bitmap = new Bitmap(filePath.Value))
         {
             return(Image.Clone(bitmap, PixelFormat.Format24bppRgb));
         }
     }
     catch (Exception ex)
     {
         throw new Exception($"Could not open the image file '{filePath.Value}'. Message: {ex.Message}", ex);
     }
 }
Example #2
0
        private static readonly double _pokemonCardRatio = 63.0 / 88; // Width / Height

        public static Bitmap Format(Bitmap bitmap)
        {
            return(Image.Clone(bitmap, PixelFormat.Format24bppRgb));
        }