huangyz0918/AndroidWM

Does it strange for that set image size to 1024??

huhuang03 opened this issue · 0 comments

If I have image that width and height is both < 1024. This lib create the bitmap set one to 1024.

    private WatermarkBuilder(@NonNull Context context, @NonNull Bitmap backgroundImg) {
        this.context = context;
        this.backgroundImg = resizeBitmap(backgroundImg, MAX_IMAGE_SIZE);
    }

    public static Bitmap resizeBitmap(Bitmap inputBitmap, int maxImageSize) {
        float ratio = Math.min(
                (float) maxImageSize / inputBitmap.getWidth(),
                (float) maxImageSize / inputBitmap.getHeight());
        int width = Math.round(ratio * inputBitmap.getWidth());
        int height = Math.round(ratio * inputBitmap.getHeight());

        return Bitmap.createScaledBitmap(inputBitmap, width,
                height, true);
    }

Does this necessary, or it's bug?