473,320 Members | 2,080 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,320 software developers and data experts.

Extracting Images from Internet

ashsa
45
Hi,

Am trying to extract an image from a URL as follows:

Expand|Select|Wrap|Line Numbers
  1.  
  2. try
  3. {
  4. BufferedImage input = ImageIO.read(new URL("http://www.google.co.in/images/close_sm.gif"));
  5. File outputFile = new File("image.png");
  6. ImageIO.write(input, "PNG", outputFile);
  7. }
  8. catch(Exception e)
  9. {
  10. System.out.println(e);
  11. }
  12.  
The URL is a valid one. But still I get the following error :
Expand|Select|Wrap|Line Numbers
  1.  javax.imageio.IIOException: Can't get input stream from URL! 
Any idea where I am going wrong ?
Thanks for any help ..
Oct 9 '07 #1
2 3677
ashsa
45
Got it !!
Jus gotta set my server's proxy settings.
Included
Expand|Select|Wrap|Line Numbers
  1.  System.setProperty("http.proxyHost","xyz.com"); 
  2. System.setProperty("http.proxyPort", 8080);
  3.  
before creating the BufferedImage and it works fine :-)
An alternative to this could be specifying the proxy details thru command prompt during execution.
Eg:
Expand|Select|Wrap|Line Numbers
  1. java -Dhttp.proxyHost=xyz.com -Dhttp.proxyPort=8080 MyJavaClass
Oct 9 '07 #2
r035198x
13,262 8TB
Got it !!
Jus gotta set my server's proxy settings.
Included
Expand|Select|Wrap|Line Numbers
  1.  System.setProperty("http.proxyHost","xyz.com"); 
  2. System.setProperty("http.proxyPort", 8080);
  3.  
before creating the BufferedImage and it works fine :-)
An alternative to this could be specifying the proxy details thru command prompt during execution.
Eg:
Expand|Select|Wrap|Line Numbers
  1. java -Dhttp.proxyHost=xyz.com -Dhttp.proxyPort=8080 MyJavaClass
Very good work indeed.
Oct 9 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Henrik Berg Nielsen | last post by:
Hi group! I need to extract some text (well numbers actually) from a bunch of similarly looking .png images. After extraction the numbers will be fed to a Python script for further processing....
2
by: Dave Griffiths | last post by:
Hi all Very new to JavaScript, I am trying to cache a number of images as the page loads, is there a max number of images or memory usage before the browser stops caching. My PC has 1G ram so...
10
by: John Ortt | last post by:
Hi Everyone, I have created a Javascript menu for my site which uses frames. The first stage loads fine but I want two drill down menus ("About Me Menu" and "Projects Menu"). The pages load...
6
by: Dr. Lince M. Lawrence | last post by:
Is there any method to extract both the images (with and without mouse-over) from a web site. Thanks, Lince M Lawrence
5
by: Ben Long | last post by:
Hi All, A partner of mine has been charged with identifying a performance / load problem currently experienced on one of our websites. I'm thinking it may be a combination of HTML formatting...
3
by: littleark | last post by:
Hi everybody, I have a typical javascript images preloader, it works fine both on Firefox and on IE in my intranet (local server). It works fine on the Internet (remote server) in IE. In...
2
by: OBAFGKM_RNS | last post by:
Let's say I have a Javascript function that loops over and over. In that function i have it alternating images on a button this way: if(var==0){ var myHTML = "<input type='button'...
5
by: royend | last post by:
Is it possible to hide images from the internet, and only have a image available for users that are logged into the intranet? I am hoping to avoid a database-solution as the number of images will...
4
by: Ant | last post by:
Hi all, My kids have a bunch of games that have to be run from CD (on Windows XP). Now they're not very careful with them, and so I have a plan. I've downloaded a utility (Daemon Tools) which...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.