Toss your browser-scale down an image of 10000x10000 to 200 bytes!

Source: Internet
Author: User

Don't be nervous, don't doubt, the landlord is not fooling around :) In fact, this is not the smallest! I hope you can continue to explore it.

This article does not have any tricks and is the most basic technology. Even the rookie knows that it is impossible to save a 0.1 billion pixel photo to several hundred bytes, not to mention lossless. In fact, it is indeed impossible, because the title of this article does not refer to pictures, but images without actual content :)

  

But it must also be standard and general,Images that can be recognized by various browsers. Of course, the definition of your own code cannot be calculated ~

  
We have also encountered that some save to PNG format will be much smaller, and the image quality has not changed completely. The reason is simple: there are few colors in the image, and there are a large number of duplicates. After Zip compression, the same binary data is merged, resulting in a small amount of redundant data. And it is lossless compression, so the image quality will not drop.

So now I want to create a graph with a lot of repeated data. Since I have not studied the specific implementation of Zip, I don't know how to calculate the most redundant data. However, it is certain that the redundancy of a solid color image is very large. To make it simple, use a paint brush to create a 10000x10000 bitmap, fill in any color, and save it. Mygod, 286 m! (In fact, it's okay if it's bigger, but some programs won't recognize it)

Then use the well-known toolPngoutSevere pressure. It's time to finish a cup of tea... Is it 200 bytes? Of course it is ---- impossible. But the score is also good: 11.9 K. It's more than 20000 times smaller than normal ~

However, more than 99.9999% of the m images share the same content. The actual content is only dozens of bytes of file headers, and the results are still more than 10 K, somewhat unwilling. HoweverImages cannot be identified because there is a file header and no actual data content.. Maybe the compression algorithms such as deflate have done their best. Will there be large redundancy in the 11.9k data? In general, it is meaningless to compress the compressed files, or even increase.

However, for a supernov, even if it collapsed for tens of thousands of times, it was far from reaching its density. Only black holes were its real targets.

However, the image can only be compressed once. What is the significance of further compression? Don't forget, this is not a general image, it is an image on the network. You may have thought that we can use gzip to compress it during network transmission!

This is a huge pressure, and a real black hole is born-202 bytes!

How terrible is this 202 byte volatile? If you embed it in the stickers of the forum, you can get MB of memory for only one! Just embed a few more images --

  

  

  

At the beginning, this is not the limit. This is only created by using ready-made tools.Deflate AlgorithmThe details in, it will certainly create a more dense black hole !!!

Because the image size is huge, it will not be embedded in this article. You can preview it here:
Http://www.etherdream.com/Test/blackhole.html

Final compressed file:
Http://www.etherdream.com/Test/blackhole.png.gz

  

Of course, even if the memory consumption is several hundred MB, it can be completely ignored for computers that are prone to several GB of memory. However, if you can create a zip file with a compression ratio of several thousand times, you can play a prank: After a user accesses an embedded image of several hundred kb in the Forum, the hard disk contains several hundred MB of cached files! Isn't that a malicious attack?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.