|
Re: using IDLnetURL to get an image from a HTTP URL into IDL [message #91366 is a reply to message #91365] |
Mon, 06 July 2015 01:27   |
Helder Marchetto
Messages: 520 Registered: November 2011
|
Senior Member |
|
|
On Monday, July 6, 2015 at 10:01:40 AM UTC+2, Puneeth Shankar wrote:
> I was hoping for some help on ways to get an image(say a screen shot of google maps) from a URL and save it onto the hard disk.
> Currently I'm able to :
> 1)Save the entire http code of a URL to disk(if I want to)
> 2)Save an image from "URls' that straightly lead to images" for ex: ( http://d335hnnegk3szv.cloudfront.net/wp-content/uploads/site s/501/2014/11/Balloons21.jpg )
> Note: Using the below snippet will give you an idea of what i have achieved so far:
>
> Url = ' http://chart.apis.google.com/chart?chs=200x100&cht=p& ;chd=t:10,20,30'
> ourl = obj_new('IDLnetURL')
> png = ourl->get(filename='E:\temp\gchart.png', url=url)
> obj_destroy, ourl
> im = read_png('gchart.png')
> window, xsize=200, ysize=100
> tv, im, true=1
Hi,
I don't understand your question. What was the question again?
If you want to display and save the image AND you have idl version 8.xx then
I would use the following lines:
i = image(im, dimensions=[200,100], margin=0, /no_toolbar)
i.save, 'gchart.jpg', width=200
The save method allows saving in lots of formats, see http://www.exelisvis.com/docs/save_method.html
The thing is, you already have a save image, so I don't think that this is what you're looking for.
If you're trying to get images from google maps, you should have a look at David's article: http://www.idlcoyote.com/map_tips/googlemap.php
(for this, and many other applications, you will need David's Coyote library)
I hope this helps (but I doubt it).
Cheers, Helder
|
|
|
|
Re: using IDLnetURL to get an image from a HTTP URL into IDL [message #91369 is a reply to message #91367] |
Mon, 06 July 2015 14:53   |
Michael Galloy
Messages: 1114 Registered: April 2006
|
Senior Member |
|
|
On 7/6/15 1:19 PM, Puneeth Shankar wrote:
> Hi Helder, Re. "IDLnetURL" as shown in the snippet above, my concern
> is to get an image from a remote server using a URL. I'm half way
> through actually. Meaning that I can now download and store an image
> from only such URLs; which upon opening via a browser, one can notice
> that it will contain only an image(no associated text/paragraphs
> etc). Here's my requirement: I'm hoping to download only images from
> normal URLs that contain both text and images.Let me know your
> thoughts on this. I appreciate your time and patience.Thanks for
> replying :)
>
> Kind Regards, PUNEETH puneeth89@gmail.com
>
I'm not entirely sure of your question, but my guess is that you are
trying to do something like what a web browser does? i.e. download an
.html file which has URL references to various image files?
If that is correct, then you need to make multiple requests via
IDLnetURL. Get the .html file via IDLnetURL, parse the HTML file to find
the img tags, and then download the associated images.
Mike
--
Michael Galloy
www.michaelgalloy.com
Modern IDL: A Guide to IDL Programming (http://modernidl.idldev.com)
|
|
|
Re: using IDLnetURL to get an image from a HTTP URL into IDL [message #91370 is a reply to message #91367] |
Mon, 06 July 2015 17:43   |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
On Monday, July 6, 2015 at 3:19:41 PM UTC-4, Puneeth Shankar wrote:
> Hi Helder,
> Re. "IDLnetURL" as shown in the snippet above, my concern is to get an image from a remote server using a URL. I'm half way through actually. Meaning that I can now download and store an image from only such URLs; which upon opening via a browser, one can notice that it will contain only an image(no associated text/paragraphs etc).
> Here's my requirement: I'm hoping to download only images from normal URLs that contain both text and images.Let me know your thoughts on this. I appreciate your time and patience.Thanks for replying :)
IDL is not the best tool for this. "Normal URLs" as you call them, are links to full HTML pages. HTML can be very complicated and IDL cannot parse them without difficulty.
Wget is a better option because it is able to parse static HTML pages and download all of the linked images.
Wget probably will not handle something like Google Maps because map tiles are loaded dynamically within the browser using Javascript. I personally think your best bet is to run a virtual machine or virtual display, and run a browser within that virtual environment which you remotely control. It won't be easy, but can be done by an experienced developer.
You could also hire someone to make screenshots for you. :-)
CM
|
|
|
|
|
|
|
|
|
|
|
|
|