Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Picturebox: load image from string data?

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Expression Evaluater 3 38
SSRS 2016 Rendering HTML tables 3 29
run a stored procedure from vb.net 1 27
MYSQL responding very slow 3 23
Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
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…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

839 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