优质的屏幕截图COM pression损失 [英] Screenshot compression loss of quality

查看:166
本文介绍了优质的屏幕截图COM pression损失的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

也许别人面临着这样的问题:
正如标题所说,从上传截图的设备时,我们的服务器的图像质量下降是相当高的。你可以看到下面的链接,一个例子
http://cdn.voicebo.com/7507-05e6a7b3bf91d96b2d08da649c2ef590.jpg

Maybe someone else was faced with this problem: As the title says, when uploading screenshots from devices to our server image quality degradation is quite high. You can see one example on the following link http://cdn.voicebo.com/7507-05e6a7b3bf91d96b2d08da649c2ef590.jpg

该画面是采取的Nexus 4,但同样的事情发生在银河S2,S3和Note 2。不幸的是,我们没有更多的手机来测试现在这个权利,但考虑到以下车型的普及这种影响大量的使用者

This screenshot was taken on Nexus 4 but same thing happens on Galaxy S2, S3 and Note 2. Unfortunately we don't have more phones to test for this right now but considering popularity of following models this affect large number of our users.

我已经搜索相当长的一段时间,答案或原因,这可能发生,发现下面的链接,是不是真的是我一直在寻找,但包含了一些信息
<一href=\"http://www.google.rs/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&ved=0CCYQFjAA&url=http%3A%2F%2Fandroidforums.com%2Fsamsung-galaxy-s3%2F580114-screenshot-glitch.html&ei=1dKdUbPNA8nBO7G9gPgE&usg=AFQjCNECq7UNMp16pU8WLMlLwZVb4i2Ofw\" rel=\"nofollow\">http://www.google.rs/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&ved=0CCYQFjAA&url=http%3A%2F%2Fandroidforums.com%2Fsamsung-galaxy-s3%2F580114-screenshot-glitch.html&ei=1dKdUbPNA8nBO7G9gPgE&usg=AFQjCNECq7UNMp16pU8WLMlLwZVb4i2Ofw

I have searched for quite some time to answers or reasons why this might happen and found the following link which is not really what I was looking for but contains some information http://www.google.rs/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&ved=0CCYQFjAA&url=http%3A%2F%2Fandroidforums.com%2Fsamsung-galaxy-s3%2F580114-screenshot-glitch.html&ei=1dKdUbPNA8nBO7G9gPgE&usg=AFQjCNECq7UNMp16pU8WLMlLwZVb4i2Ofw

我也来到了结论,而截图从相机中的图像是JPEG图像保存为PNG文件(我认为这是同为所有ROMS,但可能是错误的),所以这可能是问题了。第一部分我不明白的是,为什么会变成这样一个问题,因为正如我当你从任何支持的格式读取的图像文件理解你得到的图像数据的原始字节所以在输出COM $ P $输入的格式不应该扮演的角色pssion如果读了没有错误原始字节。结果
在图像融为一体pression code的相关部分仅这一点,但如果需要更多的信息,我可以添加更多的:

I have also came to conclusion that screenshot images are saved as png files while images from the camera are in jpeg (I think this is same for all ROMS but might be wrong) so this might be the problem too. Part I don't get is why would this be an issue, because as I understand when you read image file from any supported format you get raw bytes of data for that image so input format shouldn't play role in output compression if raw bytes were read without errors.
Relevant part of code in image compression is only this but if more info is required I can add more:

bitmap.compress(Bitmap.CompressFormat.JPEG, 90, fos);

问题我问是:
有没有其他人遇到这个问题,你是如何解决的呢?
我应该如何COM preSS PNG图像(使用哪些设置),以获得合理的文件大小达到最佳效果?

Questions I am asking are: Has anyone else faced this problem and how did you solve it? How should I compress png images (using what settings) to get best results at reasonable file size?

奖励:目前我正在试图找到一个方法来检测图像是一种文件格式,但如果有人用它来解决类似的问题,请提到,在回答了。
编辑:<一href=\"http://stackoverflow.com/questions/9414487/how-to-get-the-image-format-of-the-images-from-gallery\">How摆脱图库图像是我现在使用的获取图像格式的一部分,但是这并不能真正回答问题的图像格式。感谢所有的人在那里有用的讨论。

Bonus:I am currently trying out a way to detect which file format the image is but if someone used this to solve similar issue please mention that in answer too. How to get the Image Format of the images from Gallery is the part I am using now to get format of image but this doesn't actually answer the question. Thanks to all the guys there for useful discussion.

推荐答案

现在你所提到的 options.inSampleSize 设置,似乎令人难以置信的可能是你的问题造成受此:设置 options.inSampleSize = 4 讲述了EN codeR扔像素远(显然字面;适当的采样看起来比你更好的例子),而这正是你所看到的。

Now you've mentioned the options.inSampleSize setting, it seems incredibly likely that your problem is caused by this: setting options.inSampleSize = 4 tells the encoder to throw pixels away (apparently literally; proper resampling would look better than your example), which is exactly what you're seeing.

您需要做什么应该被缩小,有些决定什么不​​应该 - 你比这个设置应该由输入范围来确定您的评论说,这样听起来好像你已经这样做了,也许你需要一些调试那里。

You need to make some decisions about what should be reduced in size and what shouldn't - you say in your comment than this setting should be determined by input bounds, so it sounds like you're already doing this and perhaps you need some debugging there.

我要重申,改变的PNG到JPEG文件可能不是最好的选择,除非你的截图通常包含照片内容。正如你可能知道,PNG对COM $ P $很差pssing照片内容,但反过来说,JPEG是在保持与各种图像质量上的电脑/设备屏幕中发现很差。 PNG往往会产生这样的情况下比接受JPEG图像较小的文件。

I'd reiterate that changing PNGs to JPEGs might not be the best option, unless your screenshots often contain photographic content. As you may know, PNG is very poor at compressing photographic content, but conversely, JPEG is very poor at maintaining quality with the sorts of images commonly found on computer / device screens. PNG can often produce smaller files in such circumstances than acceptable JPEG images.

这篇关于优质的屏幕截图COM pression损失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆