[go: nahoru, domu]

CN102013105A - Picture file compression method - Google Patents

Picture file compression method Download PDF

Info

Publication number
CN102013105A
CN102013105A CN2010102580821A CN201010258082A CN102013105A CN 102013105 A CN102013105 A CN 102013105A CN 2010102580821 A CN2010102580821 A CN 2010102580821A CN 201010258082 A CN201010258082 A CN 201010258082A CN 102013105 A CN102013105 A CN 102013105A
Authority
CN
China
Prior art keywords
color
index
picture
length
read
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN2010102580821A
Other languages
Chinese (zh)
Inventor
罗永兵
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Wingtech Electronic Technology Co Ltd
Original Assignee
Shanghai Wingtech Electronic Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shanghai Wingtech Electronic Technology Co Ltd filed Critical Shanghai Wingtech Electronic Technology Co Ltd
Priority to CN2010102580821A priority Critical patent/CN102013105A/en
Publication of CN102013105A publication Critical patent/CN102013105A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Compression Of Band Width Or Redundancy In Fax (AREA)

Abstract

The invention discloses a picture file compression method which is particularly suitable for LOGO pictures. Based on the characteristics of relatively pure color and large area same color of LOGO pictures, the method adopts a compression mode which combines a color table with an RLE (Run Length Encoding) compression algorithm, i.e. only subscripts in the color table are stored for each pixel dot of a picture, and adjacent dots are represented by using color values and the color number of continuous the same colors. The invention achieves the purpose of keeping high picture compression rate as well as easily operating.

Description

A kind of method of compressed picture file
Technical field
The present invention relates to the picture process field, particularly a kind of method of compressed picture file.
Background technology
During mobile phone power-on, first width of cloth picture of demonstration generally is a LOGO picture, may be the LOGO of operator, also may be the LOGO of manufacturer.Because all restrictions during mobile phone power-on have little time to load large-scale pattern storehouse this moment, therefore can not show the picture of conventional form.More common way is in the flash memory of mobile phone at present, stores original picture pixel data.But these pixel datas relatively take up space, and the QCIF on-screen data of storing one 16 needs 176 * 220 * 2=77440 byte, and one 16 QVGA on-screen data needs 240 * 320 * 2=153600 byte.In the at present more common mobile phone hardware configuration, flash memory space does not wait to the 128M byte from the 8M byte, and especially for the configuration than low side, as the configuration of 16M, this width of cloth figure has taken 153600/ (1024*1024*16) ≈ 1%.Perhaps, 1% is not a big figure, still, in the mobile phone development process of reality, sometimes in order to reduce the space hold of 10K, all is quite difficult.
Summary of the invention
The method that the purpose of this invention is to provide a kind of compressed picture file, it can be realized with less storage space picture file.
The invention provides a kind of method of compressed picture file, may further comprise the steps:
1.1, the storage format of described picture is set;
1.2, the color in the described picture is compiled color table, for its each pixel, the subscript in the color table that it is corresponding is stored in the concordance list;
1.3, the concordance list in the read step 1.2, and picture is carried out the RLE compression according to the picture format in the step 1.1, adjacent point is represented with color value and the homochromy color number of external phase.
The picture format that described step 1.1 is provided with comprises picture width, picture height, color depth, color table length, color table and image content.
Described step 1.2 may further comprise the steps;
1.2.1, read next pixel color in the picture, be designated as color C;
If 1.2.2 color C in the color table of setting up, changes step 1.2.4, otherwise change step 1.2.3;
1.2.3, color C is deposited in the color table;
1.2.4, the subscript of color C is deposited in the color index table;
If, then carry out step 1.3, otherwise change step 1.2.1 1.2.5 run through last pixel of picture.
Described step 1.3 may further comprise the steps:
1.3.1, read next index in the described color index table, be designated as index I;
If 1.3.2 index I catch up with one identical, change step 1.3.3, otherwise change step 1.3.4;
1.3.3, the last item of an index numerical table L is added 1;
1.3.4, index I is added index value table K, an index numerical table L end increases one newly, its value is 1;
If, change step 1.3.6 1.3.5 run through all index; Otherwise, change step 1.3.1;
1.3.6, read the next item down among the index value table K, and deposit it in compaction table Z; Read the next item down among the index numerical table L, be designated as λ;
1.3.7 if λ is zero, changes step 1.3.6, otherwise change step 1.3.8;
1.3.8 if λ>maximum length is changeed step 1.3.9; Otherwise change step 1.3.10, wherein, the maximum integer that the byte number that maximum length needs for the largest index in the expression concordance list can be represented deducts maximum index value;
1.3.9, will represent that the maximum integer that the byte number of the largest index needs in the concordance list can be represented deposits compaction table in, λ=λ-maximum length;
1.3.10 if λ is zero, changes step 1.3.12, otherwise change step 1.3.11;
1.3.11, deposit the color number in λ-color table in compaction table;
1.3.12, with the picture width, highly, color depth, color table length write compressed file successively;
1.3.13, color table is write compressed file;
1.3.14, compaction table is write compressed file.
Described method also comprises the picture decompression step:
Step S1, read the picture width, highly, color depth, color table length, be designated as LC;
Step S2, read next color, and deposit this color in color table;
If the color number that step S3 has read surpasses LC, change step S4; Otherwise, change step S2;
If step S4 is LC<and 200, index length L I=1; If 200=<LC<65000; Index length L I=2; If LC>65000, index length L I=4;
Step S5, read the data that length is the LI byte, be designated as D;
If step S6 is D<LC, change step S7; Otherwise, change step S8;
Step S7, deposit D in the pixel table;
Step S8, the last element of pixel table is deposited 1+D-LC time again;
Do not finish if step S9 reads, change step S5; Otherwise, change step S10;
Step S10, according to the pixel table, Show Picture.
Adopt the method for a kind of compressed picture file of the present invention, be specially adapted to the LOGO picture, the characteristics that this method is simple relatively at LOGO picture color, exist the large tracts of land same color, adopt the compress mode of color table in conjunction with the RLE compression algorithm, promptly to each pixel of picture, only store the subscript in the color table, and adjacent point is represented with color value and the homochromy color number of external phase, the present invention has reached the picture compression rate that both keeps higher, again the purpose of easy operating realization.
Description of drawings
Fig. 1 is a compression algorithm process flow diagram of the present invention;
Fig. 2 is a decompression algorithm process flow diagram of the present invention.
Embodiment
Further specify technical scheme of the present invention below in conjunction with drawings and Examples.
Referring to Fig. 1, the invention provides a kind of method of compressed picture file, may further comprise the steps:
1.1, the storage format of described picture is set.
The picture format that described step 1.1 is provided with comprises picture width, picture height, color depth, color table length, color table and image content.Form specifically sees the following form 1:
Byte number Content
2 The picture width
?2 The picture height
?1 Color depth (in byte)
?4 Color table length
Color depth * color table length Color table
Indefinite length Image content
1.2, the color in the described picture is compiled color table, for its each pixel, the subscript in the color table that it is corresponding is stored in the concordance list.
1.3, the concordance list in the read step 1.2, and picture is carried out the RLE compression according to the picture format in the step 1.1, adjacent point is represented with color value and the homochromy color number of external phase.
Referring to Fig. 1, Fig. 1 has shown flow process Figure 100 of compression algorithm of the present invention:
S1, read next pixel color in the picture, be designated as color C;
If S2 color C in the color table of setting up, changes step S4, otherwise change step S3;
S3, color C is deposited in the color table;
S4, the subscript of color C is deposited in the color index table;
If S5 has run through last pixel of picture, then carry out step 1.3, otherwise change step S1.
S6, read next index in the described color index table, be designated as index I;
If S7 index I catch up with one identical, change step S8, otherwise change step S9;
S8, the last item of an index numerical table L is added 1;
S9, index I is added index value table K, an index numerical table L end increases one newly, and its value is 1;
If S10 has run through all index, change step 11; Otherwise, change step S6;
S11, read the next item down among the index value table K, and deposit it in compaction table Z; Read the next item down among the index numerical table L, be designated as L;
If S12 L is zero, changes step S11, otherwise change step S13;
If S13 L>maximum length is changeed step S14; Otherwise change step S15, wherein, the maximum integer that the byte number that maximum length needs for the largest index in the expression concordance list can be represented deducts maximum index value;
S14, will represent that the maximum integer that the byte number of the largest index needs in the concordance list can be represented deposits compaction table in, the L=L-maximum length;
If S15 L is zero, changes step S17, otherwise change step S16;
S16, deposit the color number in the L-color table in compaction table;
S17, with the picture width, highly, color depth, color table length write compressed file successively;
S18, color table is write compressed file;
S19, compaction table is write compressed file.
The process of above process for picture is compressed is the file of the defined form of table 1 with a width of cloth LOGO picture compression, and this document is stored on the flash memory of mobile phone.
Referring to Fig. 2, Fig. 2 has shown decompression algorithm flow process Figure 200 of the present invention:
C1, read the picture width, highly, color depth, color table length, be designated as LC;
C2, read next color, and deposit this color in color table;
If the color number that C3 has read surpasses LC, change C4; Otherwise, change C2;
If C4 is LC<and 200, index length L I=1; If 200=<LC<65000; Index length L I=2; If LC>65000, index length L I=4;
C5, read the data that length is the LI byte, be designated as D;
If C6 is D<LC, change C7; Otherwise, change C8;
C7, deposit D in the pixel table;
C8, the last element of pixel table is deposited 1+D-LC time again;
Do not finish if C9 reads, change C5; Otherwise, change C10;
C10, according to the pixel table, Show Picture.
Above process is the picture decompression process: the decompression algorithm that adopts Fig. 2 to provide, this document is reduced into original pixel matrix, and obtain the width of picture, highly, information such as color depth simultaneously.The pixel matrix that obtains according to top decompression and the information such as width, height and color depth of picture show corresponding LOGO picture on mobile phone screen.
Those of ordinary skill in the art will be appreciated that, above embodiment is used for illustrating the present invention, and be not to be used as limitation of the invention, as long as in connotation scope of the present invention, all will drop in claims scope of the present invention variation, the modification of above embodiment.

Claims (5)

1. the method for a compressed picture file is characterized in that, may further comprise the steps:
1.1, the storage format of described picture is set;
1.2, the color in the described picture is compiled color table, for its each pixel, the subscript in the color table that it is corresponding is stored in the concordance list;
1.3, the concordance list in the read step 1.2, and picture is carried out the RLE compression according to the picture format in the step 1.1, adjacent point is represented with color value and the homochromy color number of external phase.
2. the method for claim 1 is characterized in that, the picture format that described step 1.1 is provided with comprises picture width, picture height, color depth, color table length, color table and image content.
3. method as claimed in claim 2 is characterized in that described step 1.2 may further comprise the steps;
1.2.1, read next pixel color in the picture, be designated as color C;
If 1.2.2 color C in the color table of setting up, changes step 1.2.4, otherwise change step 1.2.3;
1.2.3, color C is deposited in the color table;
1.2.4, the subscript of color C is deposited in the color index table;
If, then carry out step 1.3, otherwise change step 1.2.1 1.2.5 run through last pixel of picture.
4. method as claimed in claim 3 is characterized in that, described step 1.3 may further comprise the steps:
1.3.1, read next index in the described color index table, be designated as index I;
If 1.3.2 index I catch up with one identical, change step 1.3.3, otherwise change step 1.3.4;
1.3.3, the last item of an index numerical table L is added 1;
1.3.4, index I is added index value table K, an index numerical table L end increases one newly, its value is 1;
If, change step 1.3.6 1.3.5 run through all index; Otherwise, change step 1.3.1;
1.3.6, read the next item down among the index value table K, and deposit it in compaction table Z; Read the next item down among the index numerical table L, be designated as λ;
1.3.7 if λ is zero, changes step 1.3.6, otherwise change step 1.3.8;
1.3.8 if λ>maximum length is changeed step 1.3.9; Otherwise change step 1.3.10, wherein, the maximum integer that the byte number that maximum length needs for the largest index in the expression concordance list can be represented deducts maximum index value;
1.3.9, will represent that the maximum integer that the byte number of the largest index needs in the concordance list can be represented deposits compaction table in, λ=λ-maximum length;
1.3.10 if λ is zero, changes step 1.3.12, otherwise change step 1.3.11;
1.3.11, deposit the color number in λ-color table in compaction table;
1.3.12, with the picture width, highly, color depth, color table length write compressed file successively;
1.3.13, color table is write compressed file;
1.3.14, compaction table is write compressed file.
5. method as claimed in claim 4 is characterized in that, described method also comprises the picture decompression step:
Step S1, read the picture width, highly, color depth, color table length, be designated as LC;
Step S2, read next color, and deposit this color in color table;
If the color number that step S3 has read surpasses LC, change step S4; Otherwise, change step S2;
If step S4 is LC<and 200, index length L I=1; If 200=<LC<65000; Index length L I=2; If LC>65000, index length L I=4;
Step S5, read the data that length is the LI byte, be designated as D;
If step S6 is D<LC, change step S7; Otherwise, change step S8;
Step S7, deposit D in the pixel table;
Step S8, the last element of pixel table is deposited 1+D-LC time again;
Do not finish if step S9 reads, change step S5; Otherwise, change step S10;
Step S10, according to the pixel table, Show Picture.
CN2010102580821A 2010-08-19 2010-08-19 Picture file compression method Pending CN102013105A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN2010102580821A CN102013105A (en) 2010-08-19 2010-08-19 Picture file compression method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN2010102580821A CN102013105A (en) 2010-08-19 2010-08-19 Picture file compression method

Publications (1)

Publication Number Publication Date
CN102013105A true CN102013105A (en) 2011-04-13

Family

ID=43843268

Family Applications (1)

Application Number Title Priority Date Filing Date
CN2010102580821A Pending CN102013105A (en) 2010-08-19 2010-08-19 Picture file compression method

Country Status (1)

Country Link
CN (1) CN102013105A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103517059A (en) * 2013-07-11 2014-01-15 福建华映显示科技有限公司 Method for storing contents of 3D image
CN112073726A (en) * 2020-09-11 2020-12-11 Oppo广东移动通信有限公司 Compression method and device, computer readable storage medium and electronic device
CN113971702A (en) * 2021-10-29 2022-01-25 深圳市道通科技股份有限公司 Picture compression method, decompression method and electronic equipment
CN115098171A (en) * 2022-05-20 2022-09-23 智绘微电子科技(南京)有限公司 Method for optimizing picture compression processing in VBIOS

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1452388A (en) * 2002-04-17 2003-10-29 佳能株式会社 Picture compression method and device, and picture coding device and method
US6728398B1 (en) * 2000-05-18 2004-04-27 Adobe Systems Incorporated Color table inversion using associative data structures
CN1595452A (en) * 2003-09-10 2005-03-16 联想(北京)有限公司 Lossless compression method for graphic file
CN101546434A (en) * 2008-03-28 2009-09-30 深圳市同洲电子股份有限公司 Method and system for compressing and decompressing BMP picture file

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6728398B1 (en) * 2000-05-18 2004-04-27 Adobe Systems Incorporated Color table inversion using associative data structures
CN1452388A (en) * 2002-04-17 2003-10-29 佳能株式会社 Picture compression method and device, and picture coding device and method
CN1595452A (en) * 2003-09-10 2005-03-16 联想(北京)有限公司 Lossless compression method for graphic file
CN101546434A (en) * 2008-03-28 2009-09-30 深圳市同洲电子股份有限公司 Method and system for compressing and decompressing BMP picture file

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103517059A (en) * 2013-07-11 2014-01-15 福建华映显示科技有限公司 Method for storing contents of 3D image
CN103517059B (en) * 2013-07-11 2015-05-13 福建华映显示科技有限公司 Method for storing contents of 3D image
CN112073726A (en) * 2020-09-11 2020-12-11 Oppo广东移动通信有限公司 Compression method and device, computer readable storage medium and electronic device
CN112073726B (en) * 2020-09-11 2022-07-08 Oppo广东移动通信有限公司 Compression method and device, computer readable storage medium and electronic device
CN113971702A (en) * 2021-10-29 2022-01-25 深圳市道通科技股份有限公司 Picture compression method, decompression method and electronic equipment
CN115098171A (en) * 2022-05-20 2022-09-23 智绘微电子科技(南京)有限公司 Method for optimizing picture compression processing in VBIOS
CN115098171B (en) * 2022-05-20 2024-07-16 智绘微电子科技(南京)有限公司 Method for optimizing picture compression processing in VBIOS

Similar Documents

Publication Publication Date Title
EP2464093B1 (en) Image file generation device, image processing device, image file generation method, and image processing method
EP3334161B1 (en) Image processing device, image processing method, and data structure of moving image file
US20170221182A1 (en) Image transformation
EP3876537A1 (en) Image coding method, decoding method, coding device and decoding device
CN104378644A (en) Fixed-width variable-length pixel sample value string matching strengthened image compression method and device
CN105933708B (en) A kind of method and apparatus of data compression and decompression
CN104956662B (en) data arrangement method and data storage device
AU2018233015B2 (en) System and method for image processing
CN102013105A (en) Picture file compression method
CN106327453B (en) Method for splicing picture resources and picture resource splicing device
CN106254877A (en) Processing system for video
CN102244784A (en) Method for compressing and displaying picture including transparent information
CN106331712A (en) Video image compression method
CN106254865A (en) A kind of picture coding and coding/decoding method, image processing equipment
CN108694733A (en) Superposition Dynamic Graph display system and its display methods on a kind of Background based on MCU
CN106254878A (en) A kind of picture coding and coding/decoding method, image processing equipment
CN110971904A (en) Control method for image compression
CN113223100B (en) Picture compression and decompression processing method
CN103903285B (en) Thumbnail extraction method of PNG image and BMP image
US8064709B2 (en) Method and apparatus for buffering output pixel data of a joint photographic experts group image
US8514253B2 (en) Image data processing method and image display system with reduction of image data transfer amount
CN102231208A (en) Method for compressing types of image colors
JP2005045797A (en) Method and apparatus for reducing bandwidth required to transmit image data
CN103198810B (en) Manufacturing method of ultrahigh resolution high definition splicer
KR102154580B1 (en) Image processing apparatus and method

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
AD01 Patent right deemed abandoned

Effective date of abandoning: 20161130

C20 Patent right or utility model deemed to be abandoned or is abandoned