Solved

Picturebox: load image from string data?

Posted on 2006-06-18
1
334 Views
Last Modified: 2008-03-04
Hello

I am saving jpeg-files in an xml-file. Then I read the data of the jpeg-file into a string, how can I now load it into a picturebox without saving it to a jpeg-file and loa it from there?

Thanks

sven
0
Comment
Question by:Ruttensoft
1 Comment
 
LVL 96

Accepted Solution

by:
Bob Learned earned 500 total points
ID: 16934724
Here is a class for memory image conversions:

Imports System.IO
Imports System.Drawing.Imaging

Public Class MemoryImage

  Public Shared Function ByteArrayToImage(ByVal buffer() As Byte, ByVal fileName As String) As Image

    Dim ms As New MemoryStream(buffer)
    Dim img As Image = Image.FromStream(ms)
    Return img

  End Function

  Public Shared Function ImageToByteArray(ByVal img As Image, ByVal format As ImageFormat) As Byte()

    Dim ms As New MemoryStream
    img.Save(ms, format)

    Return ms.ToArray()

  End Function

End Class

Bob
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now