Transfer Picture Information RRS feed

  • Question

  • How to transfer picture information from any object of the PictureBox, Image, Bitmap and Graphics classes to a different object of the same class or a different one of these classes?
    Monday, June 5, 2017 4:34 AM

All replies

  • Hi jagbir21,

    Thank you for posting here.

    For your question, could you provide more information?

    What picture information you want to transfer? The whole picture? What does the to a different object of the sane class or a different one of these classes mean? Do you want to convert the picture to byte and transfer byte to other class then convert the byte to image?

    I use image for example.

     static void Main(string[] args)
                Image image = Image.FromFile(@"C:\Users\v-wezan\Desktop\1.png");
                byte[] b = imageToByteArray(image);
            public static byte[] imageToByteArray(System.Drawing.Image imageIn)
                MemoryStream ms = new MemoryStream();
                imageIn.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
                return ms.ToArray();
            public static Image byteArrayToImage(byte[] byteArrayIn)
                MemoryStream ms = new MemoryStream(byteArrayIn);
                Image returnImage = Image.FromStream(ms);
                return returnImage;

    Best Regards,


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact

    Tuesday, June 6, 2017 9:41 AM