[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Picturebox: load image from string data?

Posted on 2006-06-18
1
Medium Priority
?
366 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 2000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses
Course of the Month18 days, 8 hours left to enroll

825 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