Hello, Is anyone there to help me? I am looking to Reduce the Size of my Image in Actor method...Could someone help me with this problem!!


1 2 3 4 | //global GreenfootImage img= new GreenfootImage( "xyz.png" ); //Method img.getImage().scale( 50 , 50 ); |
1 2 | //Method img.getImage().scale( 50 , 50 ); |
1 | img.scale( 50 , 50 ); |
1 2 | double scale= 0.5 ; // for example img.scale(( int )(img.getWidth() * scale), ( int )(img.getHeight() * scale)); |
1 2 3 4 5 6 7 | public static void scaleToWidth(GreenfootImage img, int width) { img.scale(width, ( int )(img.getHeight() * width / ( double )img.getWidth())); } public static void scaleToHeight(GreenfootImage img, int height) { img.scale(( int )(img.getWidth() * height / ( double )img.getHeight()), height); } |