app/src/main/java/fi/finwe/orion360/sdk/pro/examples/MainMenu.java
public static Bitmap scaleBitmapToHeight(Bitmap bitmap, int targetHeightPx) {
        if (null == bitmap) return null;
        int currentHeightPx = bitmap.getHeight();
        if (currentHeightPx != targetHeightPx) {
            float scalingFactor = ((float)targetHeightPx) / bitmap.getHeight();
            int w = Math.round(scalingFactor * bitmap.getWidth());
            int h = Math.round(scalingFactor * bitmap.getHeight());
            bitmap = Bitmap.createScaledBitmap(bitmap, w, h, true);
        }
        return bitmap;
    }
/**
     * Scale given bitmap image to given target height in pixels, if not already that high.
     *
     * Maintains aspect ratio by scaling the width with the same scaling factor, if necessary.
     *
     * @param bitmap The bitmap image to scale.
     * @param targetHeightPx The target height in pixels.
     * @return The original bitmap, or a new scaled bitmap if scaling was performed.
     */
Scale given bitmap image to given target height in pixels, if not already that high.
Maintains aspect ratio by scaling the width with the same scaling factor, if necessary.

@param bitmap The bitmap image to scale.
@param targetHeightPx The target height in pixels.
@return The original bitmap, or a new scaled bitmap if scaling was performed.
Scale given bitmap image to given target height in pixels if not already that high . Maintains aspect ratio by scaling the width with the same scaling factor if necessary . @param bitmap The bitmap image to scale . @param targetHeightPx The target height in pixels . @return The original bitmap or a new scaled bitmap if scaling was performed .
public static Bitmap scaleBitmapToHeight(Bitmap bitmap, int targetHeightPx) {
        if (null == bitmap) return null;
        int currentHeightPx = bitmap.getHeight();
        if (currentHeightPx != targetHeightPx) {
            float scalingFactor = ((float)targetHeightPx) / bitmap.getHeight();
            int w = Math.round(scalingFactor * bitmap.getWidth());
            int h = Math.round(scalingFactor * bitmap.getHeight());
            bitmap = Bitmap.createScaledBitmap(bitmap, w, h, true);
        }
        return bitmap;
    }
public static Bitmap scaleBitmapToHeight ( Bitmap bitmap , int targetHeightPx ) { if ( null == bitmap ) return null ; int currentHeightPx = bitmap . getHeight ( ) ; if ( currentHeightPx != targetHeightPx ) { float scalingFactor = ( ( float ) targetHeightPx ) / bitmap . getHeight ( ) ; int w = Math . round ( scalingFactor * bitmap . getWidth ( ) ) ; int h = Math . round ( scalingFactor * bitmap . getHeight ( ) ) ; bitmap = Bitmap . createScaledBitmap ( bitmap , w , h , true ) ; } return bitmap ; }
Scale given bitmap image to given target height in pixels, if not already that high.
Scale given bitmap image to given target height in pixels if not already that high .