Only 48 hours left in the trailboss' kickstarter!

New rewards and stretch goals. CLICK HERE!



  • Post Reply Bookmark Topic Watch Topic
  • New Topic

ImageIcon  RSS feed

 
Brendan Fosberry
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it possible to resize ImageIcons? I cant seem to find anything about it. Im using img.paintIcon(null,g,x,y); to draw it. Is there a way to scale the graphics pane, apply an affine transfom on it or on the Icon, or maybe a different way to draw it?
 
Jeff Albertson
Ranch Hand
Posts: 1780
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rather than starting at the ImageIcon, I would try to start with the source of the image: if you are loading the image from a file or URL, you can read it as a BufferedImage, and at that point it is easy to manipulate any way you wish:
 
Brendan Fosberry
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was originally usign Buffered Image, but because the image 7874x7874 image, java just gave me OutOfMemory errors when I tried to load several images, one for each image. I can load them with ImageIcon (I think), but I need to be able to resize them. Either that or a way of loading them as BufferedImage or Image
 
Jeff Albertson
Ranch Hand
Posts: 1780
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
With large images you may need to use the JAI, but I know nothing about that library.
 
Brendan Fosberry
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Fantastic. its a starting point. I'll look into it. thanks m8.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!