Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

how to resize image in android programmatically

public static Bitmap resizeImage(Bitmap realImage, float maxImageSize,
        boolean filter) {
    float ratio = Math.min(
            (float) maxImageSize / realImage.getWidth(),
            (float) maxImageSize / realImage.getHeight());
    int width = Math.round((float) ratio * realImage.getWidth());
    int height = Math.round((float) ratio * realImage.getHeight());

    Bitmap newBitmap = Bitmap.createScaledBitmap(realImage, width,
            height, filter);
    return newBitmap;
}
Comment

PREVIOUS NEXT
Code Example
Java :: java random uuid 
Java :: java random 
Java :: iterator java 
Java :: Spring boot fix cors problem 
Java :: java ioexception 
Java :: android translate string java 
Java :: java jframe example 
Java :: get username from jwt token request spring boot 
Java :: Unsupported Modules Detected 
Java :: java remainder sign 
Java :: HttpServer example java 
Java :: check instance of java 
Java :: check if string contains only letters java 
Java :: how to minimize jframe in java 
Java :: slice a list java 
Java :: get request java 
Java :: java observer pattern 
Java :: java string to lower case 
Java :: java read keyboard input 
Java :: why bufferedreader is faster than scanner 
Java :: android studio change image on button click 
Java :: replace substring at index java 
Java :: java list distinct by attribute 
Java :: how to read file from console in java 
Java :: UTC in Java 
Java :: send whatsapp message java android studio 
Java :: load file as string java 
Java :: queue implementation in java using arraylist 
Java :: map string string to java object 
Java :: java nested loop 
ADD CONTENT
Topic
Content
Source link
Name
5+7 =