快速而肮脏的获取图像尺寸的方法

tech2024-05-13  92

…posted by davidjmedlock:

…由 davidjmedlock 发布 :

img = tk.getDefaultToolkit().getImage("C:image.jpg"); width = img.getWidth(); height = img.getHeight(); #width##height#

img = tk.getDefaultToolkit().getImage("C:image.jpg"); width = img.getWidth(); height = img.getHeight(); #width##height# img = tk.getDefaultToolkit().getImage("C:image.jpg"); width = img.getWidth(); height = img.getHeight(); #width##height#

I’m by no means a master of all things Java, but this is an easy way to grab the height and width of an image. I haven’t tried it with GIF’s just yet, but I think it’ll work… Enjoy!

我绝不是Java的所有人,但是这是获取图像高度和宽度的简单方法。 我还没有在GIF上尝试过,但是我认为它可以工作……尽情享受!

翻译自: https://www.sitepoint.com/quick-and-dirty-way-to-get-image-dimensions/

相关资源:jdk-8u281-windows-x64.exe
最新回复(0)