public GlowServerIcon(BufferedImage image) throws Exception {
  checkNotNull(image,"Image must not be null");
  checkArgument(image.getWidth() == 64,"Must be 64 pixels wide");
  checkArgument(image.getHeight() == 64,"Must be 64 pixels high");
  ByteBuf png=Unpooled.buffer();
  ImageIO.write(image,"PNG",new ByteBufOutputStream(png));
  ByteBuf encoded=Base64.encode(png);
  png.release();
  data="data:image/png;base64," + encoded.toString(Charsets.UTF_8);
  encoded.release();
}

public GlowServerIcon ( BufferedImage image ) throws Exception { checkNotNull ( image , "Image must not be null" ) ; checkArgument ( image . getWidth ( ) == 64 , "Must be 64 pixels wide" ) ; checkArgument ( image . getHeight ( ) == 64 , "Must be 64 pixels high" ) ; ByteBuf png = Unpooled . buffer ( ) ; ImageIO . write ( image , "PNG" , new ByteBufOutputStream ( png ) ) ; ByteBuf encoded = Base64 . encode ( png ) ; png . release ( ) ; data = "data:image/png;base64," + encoded . toString ( Charsets . UTF_8 ) ; encoded . release ( ) ; }
create icon from an image .
