Solved

Picturebox: load image from string data?

Posted on 2006-06-18
1
312 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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

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…
If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

708 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

13 Experts available now in Live!

Get 1:1 Help Now