Like and follow, no longer get lost, your support means a lot to me!
🔥 Hi, I am Ugly. This article has been collected by GitHub · Android-Notebook. Welcome to grow with Peng Chouchou. (Contact info on GitHub)
preface
- In the process of in-depth understanding of the underlying principles of pictures, we will be exposed to a variety of concepts, today we simply comb through.
- Please be sure to like and follow if you can help, it really means a lot to me.
series
- The graphics | ready! Say pictures related to the concept of”
- The graphics | new-confucianism. PNG besides lossless what else do you know?”
- The Android | cliche! Screen adaptation principle & plan summary notes”
- The Android | so-accurately weighed various! Tell me about the whole process of loading picture”
directory
1. Storage form
Image storage is mainly divided into File, Stream and Bitmap.
2. Picture classification
2.1 Lossy compression & lossless compression
The so-called loss refers to the quality of the image, according to whether the compression process loss of image quality is divided into two kinds:
- Lossy compression
Part of the information/quality of the image is lost during compression, and this loss is irreversible. The most common method of lossy compression is vector quantization, which is an algorithm to combine a region of similar colors into a single color.
Example: JPEG.
- Lossless Compression
During compression, redundant data is optimized without loss of image quality.
For example: PNG.
2.2 Bitmap & Vector map
- Bitmap (also known as Bitmap, grid map)
- An image is displayed by arranging an array of pixels;
- Pixel is the smallest unit of bitmap, each pixel has its own color information;
- Bitmap scaling will increase/decrease a single pixel, resulting in distortion (sawtooth).
For example, JEPG, PNG, GIF, and WebP.
- Vector
- By recording the image element shape and color algorithm, according to the algorithm operation to display the image;
- Infinite zoom out without distortion.
For example, SVG.
2.3 Direct color & index color
- Index Colour
The pixel data value itself represents a color, for example an ARGB color type value 0xFFFF0000 represents positive red.
- Index Colour (Direct Colour)
The pixel data itself does not represent the color, but is an index number that points to the color index table. The indexed color format is suitable for images with fewer color types and can greatly reduce file size compared to direct colors.
Citing the developer.android.com/topic/perfo… – the Android Developers
3. The color
3.1 Bit Depth
Represents the number of colors that can be rendered by a pixel, usually in data bits. For example, 8 bit color depth divides each color channel into 256 different intensity levels, so the RGB three color channels together can represent a total of 2242^{24}224 colors.
3.2 ColorSpace
Color Gamut, also known as Color Gamut, represents the Color range that can be covered by a pixel. There are mainly the following types:
- CIE XYZ
In 1931, the International Commission on Illumination (CIE) defined an XYZ color space after measuring the exact wavelength of the three primary colors, which for the first time indicated the color range visible to the human eye.
After mathematical operations can be converted to this more intuitive CIE XY chromaticity map:
- sRGB
The most common color gamut standard on the Internet today covers approximately 35% of the CIE XYZ color space.
- YUV
Mainly used to represent the color space of color video (bandwidth saving, each pixel bit depth maximum of 12 bits, minimum of 6 bits)
- CMYK
Color space mainly used for color printing.
Citing the baike.baidu.com/item/%E8%89… — Baidu Encyclopedia
4. File format
Editting…
GIF bits are 8 bits deep, so files are usually small, and support for alpha channels and animation Webp has great advantages in both equal quality size and equal size clarity. SVG is described in XML, and can be used at any resolution without distortion. So image compression is mainly for PNG and JPEG formats
PNG compression using libpng compression, the main scene for the compilation phase and API layer call jpeg compression using libjpeg (Android7 is after) compression, the main scene for the API layer call
Recommended reading
- Algorithm | list problem summary
- | back algorithm framework to solve problems
- Cryptography | is Base64 encryption algorithm?
- Operating system | interruption & system call is analysed
- Data structure | weibo Top 10 hot search is how calculated? (binary heap)
- Computer network | graphic DNS & HTTPDNS principle
- Android | so-accurately weighed various! Talk about the whole process of image loading
- Android | food tasteless! App Startup may be easier than you think
- Android | enough is enough! How does Glide arrange the life cycle clearly