public Image scaledWidth(int width){
  float ratio=((float)width) / ((float)getWidth());
  return scaled(width,Math.max(1,(int)(getHeight() * ratio)));
}

public Image scaledWidth ( int width ) { float ratio = ( ( float ) width ) / ( ( float ) getWidth ( ) ) ; return scaled ( width , Math . max ( 1 , ( int ) ( getHeight ( ) * ratio ) ) ) ; }
scales the image to the given width while updating the height based on the aspect ratio of the width
