CN102073983B - Method and device for optimization processing of PNG (portable network graphic) image resources - Google Patents
Method and device for optimization processing of PNG (portable network graphic) image resources Download PDFInfo
- Publication number
- CN102073983B CN102073983B CN2010106069515A CN201010606951A CN102073983B CN 102073983 B CN102073983 B CN 102073983B CN 2010106069515 A CN2010106069515 A CN 2010106069515A CN 201010606951 A CN201010606951 A CN 201010606951A CN 102073983 B CN102073983 B CN 102073983B
- Authority
- CN
- China
- Prior art keywords
- png
- picture
- file
- data
- image data
- 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.)
- Expired - Fee Related
Links
Images
Landscapes
- Compression Of Band Width Or Redundancy In Fax (AREA)
- Image Processing (AREA)
Abstract
The invention discloses a method and device for optimization processing of PNG (portable network graphic) image resources. The method comprises the following steps: respectively extracting palette data of each PNG image and image data of any one PNG image from N PNG image files with the same pattern; and combining the image data and the palette data of the N PNG images to generate a new PNG image group file. By calling the PNG image group file during the development process of J2ME (Java 2 micro edition) terminal applications, the invention can reduce the data redundancy of the PNG image files in this group, thereby reducing the volume of application package and saving storage resources.
Description
Technical field
The present invention relates to field of computer technology, relate in particular to PNG picture resource optimization processing method and device in the J2ME terminal.
Background technology
J2ME (Java 2 Micro Edition) is a kind of Java Runtime Environment of height optimization, is primarily aimed at electronic equipment for consumption, for example cell phone and videophone, top box of digital machine, auto-navigation system etc.
In the J2ME framework; Connected; The target of Limited Device Configuration (be called for short CLDC) is for resource-constrained and have the equipment of network accessibility; The java application development platform of standardized, highly transplantable, a little memory size is provided, and the equipment of support comprises mobile phone terminal; Mobile Information Device Profile (being called for short MIDP) has created the application environment of an exploitation for small-sized, resource-constrained mobile device.
The exploitation of J2ME application program of mobile phone just is being based on CLDC and MIDP standard, and the capacity of mobile phone EMS memory resource is very limited, and the picture format of being supported is PNG (Portable Network Graphic Format, a streaming network graphic form).PNG is a kind of bitmap file storage format, and when it was used for storing gray level image, how the degree of depth of gray level image was can be to 16, and during the storage color image, how the degree of depth of coloured image is can be to 48, and can store many α channel datas to 16.PNG uses the lossless data compression algorithms that derives from from LZ77, and its picture compression is than high, and the spanned file capacity is little, and has characteristics such as hi-fi, the transparency, is widely used in JAVA program, webpage or the S60 program.
In J2ME application program of mobile phone exploitation, use the picture resource of PNG form through regular meeting; When using identical and the picture that color is inequality (data relevant with pattern that are this set of diagrams sheet are identical) of set of diagrams case according to the actual requirements; Present way is to regard this set of diagrams sheet as many independently different pictures, calls a plurality of different picture files respectively.The situation that identical data are repeated to call can appear in this disposal route, and the image data amount of redundancy is big, makes that the capacity of application package is big, takies the valuable storage resources of mobile phone.
Summary of the invention
Technical matters to be solved by this invention is; A kind of PNG picture resource optimization processing method and device are provided; When in J2ME end application exploitation, using identical and the PNG picture that color is different of set of diagrams case; The data redundancy amount of this group PNG picture file be can reduce, thereby the capacity of application package, conserve memory resource reduced.
For solving above technical matters, the embodiment of the invention provides a kind of PNG picture resource optimization processing method, comprising:
Input N opens the PNG picture file with identical patterns; Every PNG picture file comprises image data, palette data, and said image data is used to describe the pattern of PNG picture, and said palette data is used to describe the color of PNG picture; Described N opens the PNG picture and has identical image data;
Open the palette data that extracts every PNG picture the PNG picture file with identical patterns respectively from said N, and the image data of any PNG picture; The palette data that the image data and the N of said any PNG picture opened the PNG picture makes up, and generates new PNG set of pictures file; Wherein, N >=2.
Correspondingly, the embodiment of the invention also provides a kind of PNG picture resource optimization process device, comprising:
The original image input block is used to import N and opens the PNG picture file with identical patterns; Every PNG picture file comprises image data, palette data, and said image data is used to describe the pattern of PNG picture, and said palette data is used to describe the color of PNG picture; Described N opens the PNG picture and has identical image data;
The set of pictures file generating unit is used for opening the palette data that the PNG picture file with identical patterns extracts every PNG picture respectively from said N, and the image data of any PNG picture; The palette data that the image data and the N of said any PNG picture opened the PNG picture makes up, and generates new PNG set of pictures file; Wherein, N >=2.
PNG picture resource optimization processing method and device that the embodiment of the invention provides; Open extraction image data and palette data the PNG picture file with identical patterns from N; After the palette data combination that the image data and the N of any PNG picture opened the PNG picture, generate new PNG set of pictures file.Newly-generated PNG set of pictures file has not only comprised the information of N pictures, has also reduced the data redundancy amount, has optimized the PNG picture resource.If in J2ME end application performance history, need to use above-mentioned N to open the PNG picture, call above-mentioned PNG set of pictures file, can reduce the capacity of application package, the conserve memory resource.
Description of drawings
Fig. 1 is the process flow diagram of an embodiment of PNG picture resource optimization processing method provided by the invention;
Fig. 2 is the synoptic diagram of an embodiment of the set of diagrams sheet file before the optimization provided by the invention;
Fig. 3 is the synoptic diagram of an embodiment of the PNG set of pictures file after the optimization provided by the invention;
Fig. 4 is the structural drawing of an embodiment of PNG picture resource optimization process device provided by the invention.
Embodiment
To combine the accompanying drawing in the embodiment of the invention below, the technical scheme in the embodiment of the invention is carried out clear, intactly description, obviously, described embodiment only is the present invention's part embodiment, rather than whole embodiment.Based on the embodiment among the present invention, those of ordinary skills are not making the every other embodiment that is obtained under the creative work prerequisite, all belong to the scope of the present invention's protection.
Referring to Fig. 1, be the process flow diagram of an embodiment of PNG picture resource optimization processing method provided by the invention.It is following that one group of PNG picture with identical patterns is optimized processed steps:
A101, input N opens the PNG picture file with identical patterns; Wherein, N >=2;
As shown in Figure 2, be the synoptic diagram of set of diagrams sheet file, comprise that N opens the PNG picture file.Every PNG picture file comprises image data, palette data, and other the data item that is used for description document information, and is specific as follows:
PNG sign: be used to indicate whether this document is the PNG file;
File header: be used to describe the essential information of picture, comprise that picture is wide, picture is high, picture color depth, color type, compress mode, filtering mode, scan mode etc.;
Palette data: the color that is used to describe the PNG picture;
Image data: the pattern that is used to describe the PNG picture;
End mark: be end-of-data mark.
The N of above-mentioned steps A101 input opens the PNG picture file, total N part image data and N part palette data.And because the pattern of every PNG picture is identical, therefore the image data of every PNG picture is identical, and promptly N part image data is identical data.
Need to prove, the employed PNG picture file of the embodiment of the invention, its form and data structure are prior aries, above-mentioned is that example describes with one of them PNG picture file structure only.
A102 opens the palette data that extracts every PNG picture the PNG picture file with identical patterns respectively from N, and the image data of any PNG picture; The palette data of said image data and N being opened the PNG picture makes up, and generates new PNG set of pictures file.
As shown in Figure 3, be the synoptic diagram of an embodiment of the new PNG set of pictures file that generates.This PNG set of pictures file comprises PNG file data, palette quantity and size, N part palette data and a image data.Wherein, the PNG file data comprises PNG sign, picture is wide, picture is high, at least a in the picture color depth, color type, check code (the CRC CRC of PNG image data piece), compress mode, filtering mode, scan mode, end mark information.
Because newly-generated PNG set of pictures file ultimate demand is reduced into each PNG picture file on the J2ME terminal, therefore known PNG file identifier data can leave on the J2ME terminal, as public data.Above-mentioned steps A102 can upset the storage order of data when generating new PNG set of pictures file.Follow-uply on the J2ME terminal, during reduction PNG picture file, from PNG set of pictures file, read proper data according to the identifier data of storing on the J2ME terminal again, realize the reduction of PNG picture, thereby reach the purpose of protecting the PNG data better.
Newly-generated PNG set of pictures file has comprised the information of N pictures, opens the PNG picture file with the preceding N of optimization and compares, and has reduced the amount of redundancy of (N-1) part image data.For example the beneficial effect of newly-generated PNG set of pictures file is described below:
With one big little be 1200 bytes; Number of colors is that 16 kinds PNG index picture is an example, and the size of palette data piece is 60 bytes so, and remaining image data size is 1140 bytes (1200 subtract 60); If there is N (N is more than or equal to 2) to open the picture of different colours; Its data redundancy amount multiply by 1140 bytes for (N-1), can the data redundancy amount be reduced to (N-1) through the integration palette data and multiply by 60 bytes, and the minimizing of data redundancy amount reaches 95 percent.The picture of different capabilities and color category, effect is different, and the redundant data that the high capacity picture is saved obviously is superior to little picture.
During practical implementation; In the process of application development of J2ME terminal (for example J2ME mobile phone), need to use N to open to have identical patterns and during the different PNG picture of color; Adopt said method that N is opened PNG picture file resource and be optimized, generate new PNG set of pictures file.Newly-generated PNG set of pictures file not only comprises the information that N opens the PNG picture, has also reduced the data redundancy amount.Call the capacity that newly-generated PNG set of pictures file can reduce application package, the conserve memory resource.
Further, as shown in Figure 1, the PNG picture resource optimization processing method that the embodiment of the invention provides also comprises the step of J2ME terminal use PNG set of pictures file, as follows;
B101 in the operational process of J2ME end application, reads said PNG set of pictures file;
B102 reads the palette data of image data and every PNG picture from said PNG set of pictures file, with the palette data of every PNG picture respectively with said image data combination after, generate N and open the PNG picture file.
During practical implementation, different palette datas can be read according to actual operating position in the J2ME terminal from PNG set of pictures file, generates actual PNG picture file with the image data combination again, realizes the reduction of PNG picture, can also reach the effect of PNG picture colour changing.
Correspondingly, the present invention also provides a kind of PNG picture resource optimization process device, can realize in the foregoing description PNG picture resource optimization processing method the institute in steps.
Referring to Fig. 4, be the structural drawing of an embodiment of PNG picture resource optimization process device provided by the invention.This PNG picture resource optimization process device comprises:
Original image input block 1 is used to import N and opens the PNG picture file with identical patterns; Every PNG picture file comprises image data, palette data, and said image data is used to describe the pattern of PNG picture, and said palette data is used to describe the color of PNG picture; Described N opens the PNG picture and has identical image data;
Set of pictures file generating unit 2 is used for opening the palette data that the PNG picture file with identical patterns extracts every PNG picture respectively from said N, and the image data of any PNG picture; The palette data of said image data and N being opened the PNG picture makes up, and generates new PNG set of pictures file; Wherein, N >=2.
Wherein, said PNG set of pictures file also comprises PNG file data, palette quantity and size information; Said PNG file data comprises PNG sign, picture is wide, picture is high, at least a in the picture color depth, color type, check code, compress mode, filtering mode, scan mode, end mark information.
Further, as shown in Figure 4, this PNG picture resource optimization process device also comprises:
Set of pictures document reading unit 3 is used for the operational process at the J2ME end application, reads said PNG set of pictures file;
Need to prove, the PNG picture resource optimization process device that the embodiment of the invention provides, it is to the optimization process flow of PNG picture, and is identical with the flow process of PNG picture resource optimization method in the foregoing description, repeats no more at this.
PNG picture resource optimization processing method and device that the embodiment of the invention provides; Open extraction image data and palette data the PNG picture file with identical patterns from N; After the palette data combination that the image data and the N of any PNG picture opened the PNG picture, generate new PNG set of pictures file.Newly-generated PNG set of pictures file has not only comprised the information of N pictures, has also reduced the data redundancy amount, has optimized the PNG picture resource.If in J2ME end application performance history, need to use above-mentioned N to open the PNG picture, call above-mentioned PNG set of pictures file, can reduce the capacity of application package, the conserve memory resource.
The above is a preferred implementation of the present invention; Should be pointed out that for those skilled in the art, under the prerequisite that does not break away from the principle of the invention; Can also make some improvement and retouching, these improvement and retouching also are regarded as protection scope of the present invention.
Claims (6)
1. a PNG picture resource optimization processing method is characterized in that, comprising:
Input N opens the PNG picture file with identical patterns; Every PNG picture file comprises image data, palette data, and said image data is used to describe the pattern of PNG picture, and said palette data is used to describe the color of PNG picture; Described N opens the PNG picture and has identical image data;
Open the palette data that extracts every PNG picture the PNG picture file with identical patterns respectively from said N, and the image data of any PNG picture; The palette data that the image data and the N of said any PNG picture opened the PNG picture makes up, and generates new PNG set of pictures file; Wherein, N >=2.
2. PNG picture resource optimization processing method as claimed in claim 1 is characterized in that, said PNG set of pictures file also comprises PNG file data, palette quantity and size information;
Said PNG file data comprises PNG sign, picture is wide, picture is high, at least a in the picture color depth, color type, check code, compress mode, filtering mode, scan mode, end mark information.
3. according to claim 1 or claim 2 PNG picture resource optimization processing method is characterized in that said method also comprises:
In the operational process of J2ME end application, read said PNG set of pictures file;
From said PNG set of pictures file, read the palette data of image data and every PNG picture, with the palette data of every PNG picture respectively with said image data combination after, generate N and open the PNG picture file.
4. a PNG picture resource optimization process device is characterized in that, comprising:
The original image input block is used to import N and opens the PNG picture file with identical patterns; Every PNG picture file comprises image data, palette data, and said image data is used to describe the pattern of PNG picture, and said palette data is used to describe the color of PNG picture; Described N opens the PNG picture and has identical image data;
The set of pictures file generating unit is used for opening the palette data that the PNG picture file with identical patterns extracts every PNG picture respectively from said N, and the image data of any PNG picture; The palette data that the image data and the N of said any PNG picture opened the PNG picture makes up, and generates new PNG set of pictures file; Wherein, N >=2.
5. PNG picture resource optimization process device as claimed in claim 4 is characterized in that said PNG set of pictures file also comprises PNG file data, palette quantity and size information;
Said PNG file data comprises PNG sign, picture is wide, picture is high, at least a in the picture color depth, color type, check code, compress mode, filtering mode, scan mode, end mark information.
6. like claim 4 or 5 described PNG picture resource optimization process devices, it is characterized in that said PNG picture resource optimization process device also comprises:
The set of pictures document reading unit is used for the operational process at the J2ME end application, reads said PNG set of pictures file;
The picture reduction unit is used for reading from said PNG set of pictures file the palette data of image data and every PNG picture, with the palette data of every PNG picture respectively with said image data combination after, generate N and open the PNG picture file.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN2010106069515A CN102073983B (en) | 2010-12-27 | 2010-12-27 | Method and device for optimization processing of PNG (portable network graphic) image resources |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN2010106069515A CN102073983B (en) | 2010-12-27 | 2010-12-27 | Method and device for optimization processing of PNG (portable network graphic) image resources |
Publications (2)
Publication Number | Publication Date |
---|---|
CN102073983A CN102073983A (en) | 2011-05-25 |
CN102073983B true CN102073983B (en) | 2012-04-25 |
Family
ID=44032514
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN2010106069515A Expired - Fee Related CN102073983B (en) | 2010-12-27 | 2010-12-27 | Method and device for optimization processing of PNG (portable network graphic) image resources |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN102073983B (en) |
Families Citing this family (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102833463A (en) * | 2012-08-13 | 2012-12-19 | 华为技术有限公司 | Picture processing method and picture processing equipment |
CN102982502B (en) * | 2012-11-26 | 2018-10-12 | 康佳集团股份有限公司 | A kind of picture Batch conversion method and system |
CN103258167A (en) * | 2013-05-10 | 2013-08-21 | 广州杰赛科技股份有限公司 | Method for protecting png picture in handheld device |
CN106325838B (en) * | 2015-06-24 | 2020-11-03 | 腾讯科技(深圳)有限公司 | Picture processing method and device for application program compiling flow |
Family Cites Families (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1136730C (en) * | 2002-01-25 | 2004-01-28 | 安凯(广州)软件技术有限公司 | Cartoon compressing method for radio network and hand-held radio equipment |
JP2007089136A (en) * | 2005-08-23 | 2007-04-05 | Ricoh Co Ltd | Image processing method, image processing program, recording medium, and composite device |
CN1909672A (en) * | 2006-08-18 | 2007-02-07 | 北京金山软件有限公司 | Storage method and system for displaying pictures |
JP2010028603A (en) * | 2008-07-23 | 2010-02-04 | Nec Access Technica Ltd | Image data processing apparatus, image data processing method and image data processing program |
CN101499172A (en) * | 2009-03-06 | 2009-08-05 | 深圳华为通信技术有限公司 | ActiveX drafting method and device |
-
2010
- 2010-12-27 CN CN2010106069515A patent/CN102073983B/en not_active Expired - Fee Related
Also Published As
Publication number | Publication date |
---|---|
CN102073983A (en) | 2011-05-25 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN1163093C (en) | Transferring start-up mobile telephone for inspecting types and formats of receptable multimedia messages by target mobile telephone in multimedia communication system | |
CN102882963B (en) | A kind of data transmission method, associated terminal and system | |
CN101102565B (en) | A processing method, device and equipment of user data in communication terminal | |
CN102073983B (en) | Method and device for optimization processing of PNG (portable network graphic) image resources | |
CN101833542A (en) | Method and device for rendering fonts of user interface | |
CN106776677A (en) | Document conversion method, device and document transmission system | |
CN102857763B (en) | A kind of coding/decoding method based on infra-frame prediction and decoding device | |
CN104679405A (en) | Terminal | |
CN109635525A (en) | Adding method, device, equipment and the storage medium of watermark | |
CN102508919A (en) | Data processing method and system | |
CN102082873B (en) | Starting method, mobile terminal and user identification card | |
CN101938560A (en) | Mobile communication terminal message management method and mobile communication terminal | |
CN107292136A (en) | A kind of pdf document anti-counterfei waterprint embedding grammar and system based on micro services | |
CN102378123A (en) | Processing method of temporary group and group system | |
CN1599497A (en) | Double modular card and access terminal and method for read of different network short message | |
CN103716445A (en) | Dynamic barcode-based data exchange method | |
CN101082969A (en) | Method and system for categorized displaying multiple sets kalendar affair in unified kalendar views | |
CN104836892A (en) | Information display method, information display device and information display terminal | |
CN1741638A (en) | Short message network address communication system based on two-dimensional bar code identification technology | |
CN1315342C (en) | Method for implementing self-adaptive selection of information transmission mode | |
CN103049253A (en) | System for mobile phone client development | |
CN102316415A (en) | Mobile communication terminal and communication service sharing method thereof | |
US8090362B2 (en) | Mobile electronic device and method for displaying characters on a bluetooth device | |
CN1946106A (en) | Method and system for obtaining personal information based on radio communication network | |
KR100498513B1 (en) | Variable-depth image format for a wireless internet and method for loading and outputting an image thereof |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C14 | Grant of patent or utility model | ||
GR01 | Patent grant | ||
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20120425 Termination date: 20201227 |
|
CF01 | Termination of patent right due to non-payment of annual fee |