public static WorldIconImage fromPixelTransparency(BufferedImage image){
  int imageMarginTop=findFirstSolidPixelFromTop(image);
  int imageMarginBottom=findFirstSolidPixelFromBottom(image);
  int frameHeight=Math.max(0,image.getHeight() - imageMarginTop - imageMarginBottom);
  return new WorldIconImage(image,0,imageMarginTop,image.getWidth(),frameHeight);
}

public static WorldIconImage fromPixelTransparency ( BufferedImage image ) { int imageMarginTop = findFirstSolidPixelFromTop ( image ) ; int imageMarginBottom = findFirstSolidPixelFromBottom ( image ) ; int frameHeight = Math . max ( 0 , image . getHeight ( ) - imageMarginTop - imageMarginBottom ) ; return new WorldIconImage ( image , 0 , imageMarginTop , image . getWidth ( ) , frameHeight ) ; }
use pixel transparency along the left edge of the icon to automatically determine the vertical frame position . assumes the image has no horizontal out of frame effects . if you want transparency on the left side of the image without adjusting its frame , or if you want to control where the frame starts , use a pixel that is mostly transparent . ( spawn . png and witch . png do this )
