Android 缩放Bitmap到指定比例大小
伊谢尔伦
伊谢尔伦 2017-04-17 16:45:28
0
3
631
伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

reply all(3)
黄舟

You can use it firstinSampleSize获得一张近似大小的图片,再用Matrix进行缩放到指定大小嘛╮(╯_╰)╭

左手右手慢动作

First of all, Android can only compress integers, not decimal compression. It is impossible to compress the image to a width of 720
Secondly, the image is usually reduced to a photo smaller than 720 before displaying it. The area less than 720 can be left empty. Draw the default background color, you can crop it, etc., depending on the specific situation

黄舟

Bitmap bitmap = getCompressForQualitySize(os, (int) sampleSize);
ByteArrayOutputStream osSecond = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.JPEG, options, osSecond);
Use equal scaling, get it first Just set the width and height of the image and then scale it down to 720, but there may be some deviations

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template