The Artima Developer Community
Sponsored Link

Java Answers Forum
Create a Buffered Image from .jpg image

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Clinton Muvezwa

Posts: 2
Nickname: worker99
Registered: Jan, 2008

Create a Buffered Image from .jpg image Posted: Feb 4, 2008 12:15 PM
Reply to this message Reply
Advertisement
I have this code which is not working. Does anyone have an idea why? There are many readers coming up when I do a check on the registered readers, and that includes .jpeg and .bmp, which are both giving me the same error! I am using JDK 1.5.0_10

public static BufferedImage loadImage(){
BufferedImage bimg = null;
try{
bimg = ImageIO.read(new File("mySkin.jpg"));
}catch (IOException e) {
e.printStackTrace();
}
return bimg;
}

Errors:

javax.imageio.IIOException: Can't read input file!
at javax.imageio.ImageIO.read(Unknown Source)
at Components.ImageApp.loadImage(ImageApp.java:28)
at Components.ImageApp.loadAndDisplayImage(ImageApp.java:17)
at Components.ImageApp.main(ImageApp.java:40)
Exception in thread "main" java.lang.NullPointerException
at Components.ImageApp.loadAndDisplayImage(ImageApp.java:18)
at Components.ImageApp.main(ImageApp.java:40)

Topic: Create a Buffered Image from .jpg image Previous Topic   Next Topic Topic: Showing Data from 2 tables in JSF

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use