简体   繁体   English

缩放图像而不损失质量

[英]Scaling image without losing quality

Is it possible to scale image without loosing its quality?I have seen posts that say to use Ninepatch images but how can we download an image and convert it to ninepatch image so that i can show it in ImageView. 我可以看到有帖子说使用Ninepatch图像,但是我们如何下载图像并将其转换为ninepatch图像,以便可以在ImageView中显示它。 Is there any other way so that my images with smaller size can be scaled like in whats app 还有什么其他方法可以像我在Whats App中一样缩放较小尺寸的图像

Everytime you scale an image it's losing quality, the only thing you can do to keep the quality is keeping a copy of the original image (which doesn't make much sense since you can just load it again from resources). 每次缩放图像时,它都会失去质量,要保持质量,唯一可以做的就是保留原始图像的副本(这没有多大意义,因为您可以从资源中再次加载它)。

If you mean the problem was that android was scaling your images (and changing the quality) you can put images on a folder named "raw" inside res. 如果您的意思是问题在于android正在缩放图像(并更改质量),则可以将图像放在res内名为“ raw”的文件夹中。

Ninepatch images can be made manually by you, you just paint an image that has two extra pixels on width and two on height, and when you save it , name it something.9.png if you want to know how to draw them correctly follow this: http://developer.android.com/tools/help/draw9patch.html Ninepatch图像可以由您手动制作,只需绘制一个图像,该图像在宽度上有两个额外的像素,在高度上有两个额外的像素,保存时将其命名为something.9.png(如果您想知道如何正确绘制它们)这个: http : //developer.android.com/tools/help/draw9patch.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM