473,769 Members | 2,372 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Create Image From Stream

Does anyone know how to create an image (JPEG) from an HTTPResponse object? I
am working on system that has a map pop up from our GIS department. I want
create an image at runtime from this popup and display that image on the main
page instead of opening a new window. This image will be a memory stream
only, but will need to be kept from page to page, and printer if required.

Any help will be much appreciated. If anyone knows of any articles, etc
please forward. Thanks.
Mar 30 '06 #1
4 10516
Use the Image.FromStrea m method.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

Show me your certification without works,
and I'll show my certification
*by* my works.

"John Daly" <Jo******@discu ssions.microsof t.com> wrote in message
news:52******** *************** ***********@mic rosoft.com...
Does anyone know how to create an image (JPEG) from an HTTPResponse
object? I
am working on system that has a map pop up from our GIS department. I want
create an image at runtime from this popup and display that image on the
main
page instead of opening a new window. This image will be a memory stream
only, but will need to be kept from page to page, and printer if required.

Any help will be much appreciated. If anyone knows of any articles, etc
please forward. Thanks.

Mar 30 '06 #2
Kevin,
Thanks for the reply. Maybe if I post some code you will have a better
understanding as to what I want to do.

CODE:
Imports System
Imports System.Net
Imports System.Drawing
Imports System.Drawing. Image
Imports System.IO

Public Class Form1
Private Sub Form1_Load(ByVa l sender As Object, ByVal e As
System.EventArg s) Handles Me.Load
'create the web request
Dim wr As WebRequest =
WebRequest.Crea te("http://localhost/eventcalendar/calHome.aspx")

'get the response into a stream
Dim st As Stream = wr.GetResponse. GetResponseStre am

'create the image
Dim bm As Image = Image.FromStrea m(st)
End Sub
End Class

The last line where I am using Image.FromStrea m is throughing an error
"Parameter is vot valid".

I am guesing that I have to get the data into a browser control, then copy
the contents of the browser to the clipboard and create my image that way. Is
it possible to do something like that?

"Kevin Spencer" wrote:
Use the Image.FromStrea m method.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

Show me your certification without works,
and I'll show my certification
*by* my works.

"John Daly" <Jo******@discu ssions.microsof t.com> wrote in message
news:52******** *************** ***********@mic rosoft.com...
Does anyone know how to create an image (JPEG) from an HTTPResponse
object? I
am working on system that has a map pop up from our GIS department. I want
create an image at runtime from this popup and display that image on the
main
page instead of opening a new window. This image will be a memory stream
only, but will need to be kept from page to page, and printer if required.

Any help will be much appreciated. If anyone knows of any articles, etc
please forward. Thanks.


Mar 30 '06 #3
It doesn't look to me like you're requesting an image. It looks like you're
requesting an ASPX page.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

Show me your certification without works,
and I'll show my certification
*by* my works.

"John Daly" <Jo******@discu ssions.microsof t.com> wrote in message
news:A4******** *************** ***********@mic rosoft.com...
Kevin,
Thanks for the reply. Maybe if I post some code you will have a better
understanding as to what I want to do.

CODE:
Imports System
Imports System.Net
Imports System.Drawing
Imports System.Drawing. Image
Imports System.IO

Public Class Form1
Private Sub Form1_Load(ByVa l sender As Object, ByVal e As
System.EventArg s) Handles Me.Load
'create the web request
Dim wr As WebRequest =
WebRequest.Crea te("http://localhost/eventcalendar/calHome.aspx")

'get the response into a stream
Dim st As Stream = wr.GetResponse. GetResponseStre am

'create the image
Dim bm As Image = Image.FromStrea m(st)
End Sub
End Class

The last line where I am using Image.FromStrea m is throughing an error
"Parameter is vot valid".

I am guesing that I have to get the data into a browser control, then copy
the contents of the browser to the clipboard and create my image that way.
Is
it possible to do something like that?

"Kevin Spencer" wrote:
Use the Image.FromStrea m method.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

Show me your certification without works,
and I'll show my certification
*by* my works.

"John Daly" <Jo******@discu ssions.microsof t.com> wrote in message
news:52******** *************** ***********@mic rosoft.com...
> Does anyone know how to create an image (JPEG) from an HTTPResponse
> object? I
> am working on system that has a map pop up from our GIS department. I
> want
> create an image at runtime from this popup and display that image on
> the
> main
> page instead of opening a new window. This image will be a memory
> stream
> only, but will need to be kept from page to page, and printer if
> required.
>
> Any help will be much appreciated. If anyone knows of any articles, etc
> please forward. Thanks.


Mar 30 '06 #4

You shouldn't have to display in the browser and copy to clipboard. It
is possible to create an image directly from the web stream as long as
the stream represents an image. I have done it before with a URL that
denoted an jpeg

Try placing a jpeg on the server and downloading it. If it works, then
the problem is the aspx.
hth,
Alan.

Mar 31 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
4411
by: John Scott | last post by:
I am storing an image in an SQL database and have one field as an image datatype. I am also using a webservice to transport data. I want to be able to resize the image and pass back a thumbnail image in a byte of what is in the database. I also want to be able to display this image in an <asp:image></asp:image> control. Is there any way to do this? Most of the examples that I've seen have used
6
3037
by: David W. Simmonds | last post by:
I know that I can create an Image object by using a path like C:\MyPictures\pic.jpg, but how can I create an Image object by using a path like /MyPictures/pic.jpg where the path is relative to the site. For instance, if the site is http://www.foobar.com, then /MyPictures/pic.jpg would be fully qualified by http://www.foobar.com/MyPictures/pic.jpg. Presumably there is a way to get the fully qualified path by giving the relative path.
9
8782
by: Tom John | last post by:
Hi I am storing images in an access database, based on an MSDN article. The code i use to store is as follows: <code> 'Create the command object Dim command As New OleDbCommand("ImageBlobUpdate", dataConnection) Command.CommandType = CommandType.StoredProcedure)
3
2678
by: christiang | last post by:
Hi guys, I'd like to use Alexia thumbnail service. It's an interesting service, you pass an url to its cgi and you get a thumbnail of that url. Of course they don't have the screenshots of all the websites so I have to check if the image returned is fine or not. This is not that problematic, I can read the headers and understand if it is a jpg or a gif (the error one). The problem that I have is that sometimes although they have the...
8
2234
by: paraidy | last post by:
Hi all, as from object i need to read all byte from a file example c: \myphoto.jpg and recreate the file with another name to another directory c:\photo\recreatedphoto.jpg can someone write a small example to do it? thx a lot men :)
2
4133
by: Adam Teale | last post by:
hey guys Is there a builtin/standard install method in python for retrieving or finding out an image's dimensions? A quick google found me this: http://www.pythonware.com/library/pil/handbook/introduction.htm but it looks like it is something I will need to install - I'd like to be able to pass my script around to people without them needing any
3
4660
by: pedrito | last post by:
I've got an app that downloads images off the internet using anywhere from 1-20 threads concurrently (though generally around 4 threads). I have a preview page that shows the images as they're downloading. The threads that do the downloading trigger an event every 32K (the size of the chunks I receive), at which point the images are drawn in the Preview page. To create the images, I create a memory stream from the data and then use...
11
5382
by: Mark B | last post by:
I want to display a pre-designed graphical 'performance badge' on certain webpages (round, about 2cm diameter) next to a salesperson's details. I have a function, fGetPerformanceGrade(SalesPersonID as Long) as String to retrieve that salesperson's grade (e.g. A+, A, A-, B+, B... D). Also one other function, fGetMonthlySales(SalesPersonID as Long) as String to get their sales figure, e.g. "$87K". I want web visitors to be able to click...
0
9579
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9416
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10035
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9981
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8862
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7396
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5436
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3551
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2810
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.