As problem solving series 3-iccp:not recognizing known SRGB profile

Source: Internet
Author: User

1. Description of the problem

During compilation under Android Studio 1.2.2, the following warning message appears: '

... \res\drawable-hdpi\add_green.png:libpng warning:iCCP:Not Recognizing known SRGB profile it has been edited

This article first learn the PNG file format, then understand the next libpng, and then to analyze and resolve this warning message.

2. png file Format

[2] is the specification of the WWW png, [3] is an example to introduce the PNG file format written in Chinese, the following materials are mainly from the two documents.

each PNG file is made up of a PNG identifier (signature) followed by a number of data blocks (Chunk), each Chunk with a Chunk type to identify its functionality.


2.1 png identification (signature)

The first 8 bytes of each PNG file always contain the following values:

Decimal 137 80 78 71 13 10 26 106 binary 4E 0D 0A 1 a 0A

The first byte 0x89 is outside the range of ASCII characters, in order to prevent some software from treating PNG files as text files .

2.2 Data Block (chunk)

In the PNG specification [2] A total of 18 chunk are defined, of which 4 classes of chunk are critical data blocks (critical chunk), each PNG file must contain them, and the remaining 14 classes are auxiliary blocks (ancillary chunks). This is an optional block of data.

2.2.1 Class 4 key chunk

Ihdr:image header, the position in the PNG file is the first block of chunk.

Plte: Palette (palette table), before Idat block

IDAT: Image data block, can have multiple contiguous IDAT blocks

Iend:image trailer, the position in the PNG file is the last chunk.

2.2.2 Class 14 auxiliary chunk

Class 14 auxiliary chunk can be categorized into the following categories:

A. Transparency information (transparent information)

Trns (transparency-Transparent)


B. Colour space information (color space information)

CHRM (Primary chromaticities and white point: base colors and whites)

GAMA (Image gamma: gamma)

ICCP (Embedded ICC profile: Embedded ICC profile)

Sbit (Significant bits: sample valid bit)

SRGB (standard RGB colour space: normal RGB color spaces)


C. Textual information (text message)

iTXt (International Textual Data: International text)

Text (Textual data: textual)

Ztxt (compressed textual data: Compressed text)


D. Miscellaneous information (other information)

BKGD (Background colour: background color)

HIST (Image histogram: graph histogram)

PHYs (Physical pixel dimensions: physical pixel size)

SPLT (Suggested palette: Recommended color grading)


E. Time information (timing information)

Time (Image last-modification: Image last modified)

2.2.3 Chunk Format

Each piece of chunk consists of 3 or 4 fields.

Length 4 bytes Specifies the length of the data field in chunk, which can be 0, not exceeding (2^31-1) bytes

Chunk Type (data block type ) 4 byte block type consists of ASCII letters (A-Z and A-Z),

bit 5 per byte represents the chunk property, See also in [2] 5.4 Chunk Naming conventions

Chunk Data (data block data) variable length Storage According to Chunk Type code specified

CRC (cyclic redundancy detection) 4 bytes storage of cyclic redundancy codes to detect errors


[2] 5.6 Chunk ordering describes the order of each class of Chunk in a PNG file.

There is no data field in Iend chunk, so the length field is 0 and iend Chunk is the following 12 bytes (hex):

4E (42 60 82) for the XX

The first 4 bytes are 00,type always iend (4E 44), so the CRC is always AE, and the last 12 bytes of each PNG file are the same.

3. Libpng

Cond.

4. Problem Analysis and Resolution

To be continued.

5. References

[1] Libpng 1.6.17-march, Http://www.libpng.org/pub/png/src/libpng-1.6.17-README.txt

[2] Portable Network Graphics (PNG) specification (Second Edition), http://www.w3.org/TR/2003/ pr-png-20030520/

[3] PNG file structure analysis: Http://wenku.baidu.com/view/b87e978583d049649b66586a.html?re=view

As problem solving series 3-iccp:not recognizing known SRGB profile

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.