imageWithData image size become bigger?

浪子不回头ぞ 提交于 2019-12-04 20:30:06

Because it still represents an image of that resolution stored with the least amount of data loss that JPEG allows.

Here's an (imperfect) analogy. Imagine taking a CD (full quality audio) and ripping it to a very low-quality MP3 file. That file would be very small, and sound terrible. Now burn that MP3 file onto a CD-R using iTunes. If you play that CD, it will still sound terrible, but that is a full size storage of the terrible sound data. Now rip that CD-R to the highest quality kind of MP3. Do you expect it to yield the same size as the low-quality MP3 with which you burned the CD? No, because you're asking iTunes to encode a full size sound signal at very high quality. You're doing a lot of work to "preserve" in high quality what happens to be a crummy sound data stream.

Same with your images. You are taking an original bitmap at some resolution X*Y. You are encoding it very lossily, which is designed to take up a small amount of disk space by throwing out a bunch of information. Then you are decoding that, back to a full X*Y size bitmap, which now has its own set of (different) complexities that emerged from the way it happened to be compressed. Then you are encoding that bitmap at very high quality. Which will preserve nearly all of its visible complexity but still be crummy to look at.

(You do see a material difference between your data1 and data30, which is the closest apples-to-apples comparison here. data1 is what happens when you keep as much information as JPEG allows. The drop in size to data30 is showing what you lost when you went through the step of encoding it into data2 first.)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!