Have a Snippet?

Keep, track and share your code snippets with your friends



C#: Image to byte array 2 Share on Vkontakte

Image to byte array 2

      public static class ImageExtentions
        {
                public static byte[] ToByteArray(this Image image, ImageFormat imageFormat)
                {
                        using (MemoryStream ms = new MemoryStream())
                        {
                                image.Save(ms, imageFormat);
                                return ms.ToArray();
                        }
                }
        }


Tag: C#, Extensions, image

0 Comments