473,387 Members | 1,486 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

How to get image from Webbrowser page

Hi

How can I programmatically save an image from a page locally?

The same as right-click the image and select 'Save as'

Tanks Paul S
Jul 28 '08 #1
8 1618
"Paul S" <Pa***@discussions.microsoft.comwrote in message
news:DB**********************************@microsof t.com...
How can I programmatically save an image from a page locally?

The same as right-click the image and select 'Save as'
You can't, at least, not natively...

Every modern browser is written specifically to prevent this sort of
programmatic interaction with the hardware and software on which the client
browser is running...

The only possible solution would be to write an ActiveX control, but that
would limit your web app to Microsoft IE, and you would need to seriously
compromise browser security just to get it to run at all...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Jul 28 '08 #2
Hi

I thought it could be done reading bytes out of the httprequest or perhaps
scripting

I know the layout of the page and I know the name of the image

<img border="0" src="http://www.xyz.dk/UI/Images/Charts/APCP100_da_36.png"/>

Paul S
Jul 29 '08 #3
Not familiar with the web browser control but yes, you shouldn't have those
limitations that applies to a stand alone browser as you are working from
your own application.

So you could :
- parse the page to get the image location and download the image
- you could also perhaps get the image from the cache avoiding to download
it again

Or if each and every request is seen by your application you could capture
those bytes (but I'm not sure wether you can get an event for image requests
triggered by the main doucment ??)

--
Patrice

"Paul S" <Pa***@discussions.microsoft.coma écrit dans le message de groupe
de discussion : A0**********************************@microsoft.com...
Hi

I thought it could be done reading bytes out of the httprequest or perhaps
scripting

I know the layout of the page and I know the name of the image

<img border="0"
src="http://www.xyz.dk/UI/Images/Charts/APCP100_da_36.png"/>

Paul S

Jul 29 '08 #4
"Patrice" <http://www.chez.com/scribe/wrote in message
news:A5**********************************@microsof t.com...

[top-posting corrected]
"Paul S" <Pa***@discussions.microsoft.coma écrit dans le message de
groupe de discussion :
A0**********************************@microsoft.com...
>Hi

I thought it could be done reading bytes out of the httprequest or
perhaps
scripting

I know the layout of the page and I know the name of the image

<img border="0"
src="http://www.xyz.dk/UI/Images/Charts/APCP100_da_36.png"/>

Paul S

Not familiar with the web browser control but yes, you shouldn't have
those limitations that applies to a stand alone browser as you are working
from your own application.
If that's the case, then I misinterpreted the OP and believed that he was
referring to a browser-based app since he posted in the ASP.NET newsgroup...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Jul 29 '08 #5
On Jul 28, 5:39*pm, Paul S <Pa...@discussions.microsoft.comwrote:
Hi

How can I programmatically save an image from a page locally?

The same as right-click the image and select 'Save as'

Tanks Paul S
do you mean something like this: ?

System.Net.HttpWebRequest httpRequest = (HttpWebRequest)
System.Net.WebRequest.Create(imageURL);
System.Net.HttpWebResponse httpResponse =
(HttpWebResponse) httpRequest.GetResponse();
System.IO.Stream httpResponseStream =
httpResponse.GetResponseStream();

System.Drawing.Image imageIn =
System.Drawing.Image.FromStream(httpResponseStream );

httpResponseStream.Close();
httpResponse.Close();
more at http://www.siccolo.com/articles.asp
Jul 29 '08 #6

Sorry Mark
What would the proper forum be then ?

Paul S
"Mark Rae [MVP]" wrote:
"Patrice" <http://www.chez.com/scribe/wrote in message
news:A5**********************************@microsof t.com...

[top-posting corrected]
"Paul S" <Pa***@discussions.microsoft.coma écrit dans le message de
groupe de discussion :
A0**********************************@microsoft.com...
Hi

I thought it could be done reading bytes out of the httprequest or
perhaps
scripting

I know the layout of the page and I know the name of the image

<img border="0"
src="http://www.xyz.dk/UI/Images/Charts/APCP100_da_36.png"/>

Paul S
Not familiar with the web browser control but yes, you shouldn't have
those limitations that applies to a stand alone browser as you are working
from your own application.

If that's the case, then I misinterpreted the OP and believed that he was
referring to a browser-based app since he posted in the ASP.NET newsgroup...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Jul 29 '08 #7
Hi Siccolo

I think this is close, but it looks as if you see the url to only contain
the image. The image is contained in a page. I know both name of the image
and the structure of the page. It does not change - only the image - it's a
weather report and for scurity reason this is the only way I can get the
image.

Thanks for the effort
Paul S

"siccolo" wrote:
On Jul 28, 5:39 pm, Paul S <Pa...@discussions.microsoft.comwrote:
Hi

How can I programmatically save an image from a page locally?

The same as right-click the image and select 'Save as'

Tanks Paul S

do you mean something like this: ?

System.Net.HttpWebRequest httpRequest = (HttpWebRequest)
System.Net.WebRequest.Create(imageURL);
System.Net.HttpWebResponse httpResponse =
(HttpWebResponse) httpRequest.GetResponse();
System.IO.Stream httpResponseStream =
httpResponse.GetResponseStream();

System.Drawing.Image imageIn =
System.Drawing.Image.FromStream(httpResponseStream );

httpResponseStream.Close();
httpResponse.Close();
more at http://www.siccolo.com/articles.asp
Jul 29 '08 #8
"Paul S" <Pa***@discussions.microsoft.comwrote in message
news:9F**********************************@microsof t.com...

[top-posting corrected again]
Not familiar with the web browser control but yes, you shouldn't have
those limitations that applies to a stand alone browser as you are
working
from your own application.

If that's the case, then I misinterpreted the OP and believed that he was
referring to a browser-based app since he posted in the ASP.NET
newsgroup...

What would the proper forum be then ?
That really depends on what programming software you're using...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Jul 29 '08 #9

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

Similar topics

6
by: Sharon | last post by:
Hi all. My goal is to convert html elements to bitmap. So the first step would be to parse the html. System.Windows.Forms.WebBrowser even has a method called DrawToBitmap, which makes the whole...
8
by: UJ | last post by:
I've got some HTML that produces what I need. I need to make an image of it to display on pages of my web site (I won't go in to why - just trust me - I need the image of it). The user enters some...
2
by: C Williams | last post by:
Hi, What I am trying to build is an image created on-the-fly to be displayed in an aspx page. I can do this, using GDI+, no problem. The catch is that now I would like the ability to carry out...
12
by: Alex Clark | last post by:
Greetings, (.NET 2.0, WinXP Pro/Server 2003, IE6 with latest service packs). I've decided to take advantage of the layout characteristics of HTML documents to simplify my printing tasks, but...
15
by: dgk | last post by:
I'm trying to save the image of a webbrowser control. Not a particular image being shown on the page, but rather the visible display of the webbrowser. Using VS2005 I figured that maybe...
0
by: Wayne Sepega | last post by:
I have a process that loads pages using the WebBrowser component in VS 2005. I have to load each page as I only know the ID of the page, once the page is loaded I then find all the images and use...
3
Robbie
by: Robbie | last post by:
Hi yet again! I'm trying to save an image in a webbrowser in VB6. The image is the only thing on the webbrowser (because I gave the image URL to WebBrowser.Navigate()). I can not use the Inet...
10
by: Johnny Jörgensen | last post by:
Does anybody know how you can extract an image fron a webpage loaded into a webbrowser control and either save it to file OR save it in a database? Cheers, Johnny J.
1
by: heyi | last post by:
hi, i'm making an app which uses a webbrowser control to show some offline (not cache) html pages like a slide show. let's say pages in a folder on the desktop etc... when it came to testing...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...

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.