height=image.getHeight();
System.out.println(height);
输出为零,为什么这样?
关注
码龄 粉丝数 原力等级 --
- 被采纳
- 被点赞
- 采纳率
已采纳
BufferedImage image;image=ImageIo.read(getClass().getResourse("q.png"))
收起
- 写回答
- 好问题 0 提建议
- 关注问题
微信扫一扫点击复制链接分享
- 邀请回答
- 编辑 收藏 删除 结题
- 收藏 举报
1条回答 默认 最新
- 关注
码龄 粉丝数 原力等级 --
- 被采纳
- 被点赞
- 采纳率
饭小粒 2017-07-30 01:41关注你的图片能正常显示吗
要不你贴一下其他的code 或者贴一下图片的图本回答被题主选为最佳回答 , 对您是否有帮助呢? 本回答被专家选为最佳回答 , 对您是否有帮助呢? 本回答被题主和专家选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏举报
微信扫一扫点击复制链接分享
评论按下Enter换行,Ctrl+Enter发表内容
报告相同问题?
提交
- 2021-03-16 19:46旧南的博客 BufferedImage = ImageIO.read(getClass().getResourceAsStream("/Images/player.gif"));首先,是的,我确实将图像文件夹添加到了我的类路径中.为此,我收到错误java.lang.IllegalArgumentException:input == null!我...
- 2021-02-27 04:09ZeroCool的博客 try { this.icon = ImageIO.read(this.getClass().getResourceAsStream("/resources/" + imgName)); } catch (IOException e) { e.printStackTrace(); } When the code runs it results in the following error: ...
- 2019-09-18 22:24chenwenchao0929的博客 image = ImageIO.read(getClass().getResource("column.png")); width=image.getWidth(); height=image.getHeight(); gap=141; distance=260; y=ran.nextInt(156)+172;//[0,100] //172 , 328 x=50+...
- 2018-03-12 10:24jatainong的博客 bi = ImageIO.read(file); } catch (Exception e) { e.printStackTrace(); } int width = bi.getWidth(); int height = bi.getHeight(); int minx = bi.getMinX(); int miny = bi.getMinY(); ...
- 2017-09-14 14:58Steatch的博客 在对图片进行处理过程中,发现java 不支持 某些图片的操作(放大,缩小) ImageIO.read()报:javax.imageio.IIOException: Invalid icc profile: bad sequence number 一般这些图片,是由扫描仪扫描,或者数码...
- 2022-04-10 17:19GoodWay.的博客 import java.awt.image.BufferedImage; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.util.Iterator; import javax.imageio.ImageIO; import java.
- 2021-03-15 23:13Ushaal的博客 ImageLoader.java:public class ImageLoader {private static BufferedImage ...public ImageLoader() {}public BufferedImage loadImage(String filePath) throws IOException {image = ImageIO.read(this.getCl...
- 2021-07-17 09:07Tony_Starkis的博客 import java.awt.image.BufferedImage; //Image IO类读取图片 import javax.imageio.ImageIO; public class Bird { //创建Bufferedlmage对象 BufferedImage image; //新建Bufferedlmage类的数组对象 ...
- 2021-02-12 09:24冰娉的博客 小编典典首先,更改此行:image = ImageIO.read(getClass().getClassLoader().getResource("resources/icon.gif"));对此:image = ImageIO.read(getClass().getResource("/resources/icon.gif"));可以在此线程上找到...
- 2022-09-22 20:49BufferedImage image = ImageIO.read(file); ``` - 如果图像在类路径(classpath)中,可以使用`ClassLoader`获取输入流: ```java InputStream is = getClass().getResourceAsStream("/image.jpg"); ...
- 2020-04-16 11:14爱喝柠檬茶的喵的博客 虽然不是做出来的,但是敲完也挺费事的。 public class BirdGame extends JPanel {... BufferedImage background; // 开始图片 BufferedImage startImage; // 结束图片 BufferedImage gameOverImage; // 地面...
- 2020-08-18 19:33爱吃柠檬的梁小睿的博客 public static BufferedImage readImage(String fileName) { try { BufferedImage img = ImageIO.read(FlyingObject.class.getResource(fileName)); return img; } catch (Exception e)
- 2021-02-15 21:14和乐设计的博客 I want to add an image to a Jpanel Class, I use the method getResource() but it returns Exception in thread "main" java.lang.IllegalArgumentException: input == null!, because the path into the image f...
- 2013-05-11 18:03BOY的博客 利用:String names[] = ImageIO.getReaderFormatNames(); String names[] = ImageIO...得到 ImageIo 可以读取图片的格式 :[BMP, bmp, jpg, JPG, wbmp, jpeg, png, PNG, JPEG, WBMP, GIF, gif] 而当我们读取
- 2011-11-24 09:53iteye_7465的博客 1.在项目中为了处理用户上传的图片,会对图片进行重写处理,故使用了类似下面的代码: ... BufferedImage bi = (BufferedImage)ImageIO.read(src); BufferedImage bi_scale = new BufferedImage(bi.get...
- 2021-02-26 12:40乘风破浪的小小的博客 I don't know why this isn't working, but the program says it can't read the input file. This is also being run in Ubuntu, by the way:Here is the sample code:URI url = new URI("images/GUI/TitleScreen.P...
- 2021-04-09 22:21BufferedImage image = ImageIO.read(imageFile); // 现在你可以对image对象进行操作,如显示、缩放、旋转等 } catch (IOException e) { e.printStackTrace(); } } } ``` 2. **BufferedImage接口**: `java....
- 2018-07-17 09:052. **使用ImageIO.read()**: 要读取图片,首先需要导入`javax.imageio.ImageIO`和`java.awt.image.BufferedImage`。然后,你可以使用`ImageIO.read(file)`方法,其中`file`是一个指向图像文件的`File`对象。例如: ...
- 2022-09-23 11:10java_lujj的博客 BufferedImage watermarkImage = ImageIO.read(new File(waterImgPath)); int height = targetImg.getHeight(); int width = targetImg.getWidth(); System.out.println("width:" + width + "; height:" +...
- 2015-06-23 16:19雪天不下雪的博客 上传图片的公共类 import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileOutputStream;...import java.io.IOException;... public static BufferedImage readImage(String fileName) { ...
- 没有解决我的问题, 去提问