CN107220000A - Picture compression method and picture compression device - Google Patents
Picture compression method and picture compression device Download PDFInfo
- Publication number
- CN107220000A CN107220000A CN201710259718.6A CN201710259718A CN107220000A CN 107220000 A CN107220000 A CN 107220000A CN 201710259718 A CN201710259718 A CN 201710259718A CN 107220000 A CN107220000 A CN 107220000A
- Authority
- CN
- China
- Prior art keywords
- picture
- compressed
- compression
- target photo
- entity information
- 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
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0602—Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
- G06F3/0608—Saving storage space on storage systems
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0628—Interfaces specially adapted for storage systems making use of a particular technique
- G06F3/0638—Organizing or formatting or addressing of data
- G06F3/0643—Management of files
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0628—Interfaces specially adapted for storage systems making use of a particular technique
- G06F3/0655—Vertical data movement, i.e. input-output transfer; data movement between one or more hosts and one or more storage devices
- G06F3/0656—Data buffering arrangements
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Human Computer Interaction (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Information Transfer Between Computers (AREA)
- Compression Or Coding Systems Of Tv Signals (AREA)
Abstract
The invention provides a kind of picture compression method and a kind of picture compression device, wherein, the picture compression method includes:Obtain the first picture entity information of picture to be compressed;The compressed configuration information of the picture to be compressed is set;By the picture compression to be compressed it is Target Photo according to the first picture entity information and the compressed configuration information;The Target Photo is cached into static resource server, so that the client device matched with the Target Photo is obtained., can be by picture compression into the picture with the specification for adapting to different client devices by technical scheme, and can guarantee that the picture after compression has preferable display effect and transmission rate simultaneously, lift Consumer's Experience.
Description
Technical field
The present invention relates to picture Processing Technique field, in particular to a kind of picture compression method and a kind of picture pressure
Compression apparatus.
Background technology
At present, BufferedImage (buffers images) is Image (display image) subclass, and Image is one and taken out
As row, BufferedImage is Image realization, and Image and BufferedImage main function are to add a secondary picture
It is downloaded in internal memory, i.e. the picture of BufferedImage generations has an image buffer in internal memory, can using this buffering area
Very easily to operate this picture, such as picture carry out include size conversion, picture it is graying, setting picture it is transparent or
Modification operation including opaque grade.
In the process of construction of website, there is substantial amounts of picture resource, and need to show not in different terminals or position
The picture of same specification, and traditional CSS (Cascading Style Sheets, CSS) control figure chip technology is easily made
It is slow into picture distorting transformation and client loading, especially when mobile phone terminal is transmitted, and also it is original in mobile phone terminal transmission every time
Big consumption of the figure to network traffics is also larger, causes the wasting of resources.
Therefore, how picture compression can be protected into the picture with the specification for adapting to different client devices, and simultaneously
Picture after card compression has preferable display effect and transmission rate, and lifting Consumer's Experience turns into urgently to be resolved hurrily at present and asked
Topic.
The content of the invention
The present invention is based on above mentioned problem, it is proposed that a kind of new technical scheme, and difference is adapted to by pre-setting
The compressed configuration information of client device, with based on the compressed configuration information by picture compression into adapting to different clients
The picture of the specification of equipment, and can guarantee that the picture after compression has preferable display effect and transmission rate simultaneously, so as to carry
Rise Consumer's Experience.
In view of this, according to the first aspect of the invention, it is proposed that a kind of picture compression method, including:Obtain to be compressed
First picture entity information of picture;The compressed configuration information of the picture to be compressed is set;According to the first picture entity
The picture compression to be compressed is Target Photo by information and the compressed configuration information;The Target Photo is cached to static state
In Resource Server, so that the client device matched with the Target Photo is obtained.
In the technical scheme, when needing to treat compressed picture progress picture compression processing, based on the picture to be compressed
The first original picture entity information and the compressed configuration information that sets compress it into Target Photo, and will be obtained after compression
Target Photo be buffered in static resource server for adaptation client device obtain, i.e., adapted to not by pre-setting
With the compressed configuration information of client device, with based on the compressed configuration information by picture compression into adapting to different clients
The picture of the specification of end equipment is cached, in this way, can avoid the picture distorting transformation after compression and cause client to set
Standby loading is slow, waste network traffics etc., that is, ensure that the picture after compression has preferable display effect and transmission rate, from
And lift Consumer's Experience.
Wherein it is possible to perform the operation of above-mentioned picture compression using BufferedImage components;Moreover, by that will compress
Target Photo afterwards is buffered in static resource server, can avoid continually carrying out identical pressure to same picture to be compressed
Contracting operation, you can so that the different client devices with same requirements quickly and efficiently gets the figure of compressed processing
Piece, that is to say, that whether client device first looks for having cached in static resource server in the picture after obtaining compression
Corresponding Target Photo, if directly being obtained if having cached from the static resource server, is otherwise performed in above-mentioned technical proposal
The picture compression operation of record;Further, in order that static resource server can cache successfully newly-generated target all the time
Picture, then can carry out periodically removing the operation of caching to it.
In the above-mentioned technical solutions, it is preferable that described to wrap the step of the compressed configuration information of the picture to be compressed is set
Include:Picture classification according to belonging to the first picture entity information determines the picture to be compressed;According to the picture classification
The compressed configuration information is set.
In the technical scheme, after the first picture entity information of picture to be compressed is got, its compression is set to match somebody with somebody
Before confidence breath, picture classification that can first according to belonging to its first picture entity information determines it, such as according to picture size
And/or definition carries out picture category division, the compressed configuration information with the picture categorical match belonging to it is then set, with true
The definition for the Target Photo protected after being compressed according to the compressed configuration information, so that it is guaranteed that display effect.
In any of the above-described technical scheme, it is preferable that the first picture entity information includes:Picture identification code, picture
Type, picture header, image link, picture application identities, the first picture specifications parameter;The compressed configuration information includes:Visitor
Family end equipment type, picture show scene, picture display type, second picture specifications parameter.
In the technical scheme, the first picture entity information of picture to be compressed can at least include:Picture identification code, i.e.,
It is only used for ID (Identification, identity) identification number of consistency operation identification;Picture/mb-type, such as with relatively abundant
Color and the big BMP of space-consuming (Bitmap, image file format), with more rich color and occupy little space
The weaker GIF of JPG (full name JPEG, Joint Photographic Experts Group, JPEG), color
(Dynamic Graph) etc.;Picture header, i.e. picture name, for being presented to user for the different pictures of its identification differentiation;Image link,
URL (Uniform Resource Locator, URLs) of such as picture etc.;Picture application identities, that is, represent that this is treated
The applied business scene of compressed picture;First picture specifications parameter, such as length, width, size, space-consuming of picture etc.;
To be accurately positioned the picture to be compressed based on above-mentioned first picture entity information, and effective picture compression is carried out based on it;
It is determined it is possible to further the picture/mb-type according to the picture to be compressed, picture application identities and the first picture specifications parameter
Affiliated picture classification.
And be used to believe with reference to the compressed configuration that the first picture entity information of picture to be compressed compresses it into Target Photo
Breath can at least include:Client device type, such as by the picture after compression be applied to PC (Personal Computer, it is individual
People's computer) hold or mobile terminal;Picture shows scene, such as, to the less demanding common display of picture clarity, is generally used for
The display at PC ends, or it is generally used for the display of mobile terminal for marking in the form of small icon;Picture display type, than
Shown such as in the form of the large icons of opening, medium icon, small icon or list;Second picture specifications parameter, such as scheme
Length, width, size, space-consuming of piece etc..
Further, when carrying out picture compression operation based on above-mentioned compressed configuration information, its client can be set first
End equipment type, then sets picture to show that scene, picture display type, picture specification are joined according to the client device type
Number, so that the picture after compression is better adapted to corresponding client device.
In any of the above-described technical scheme, it is preferable that described to be matched somebody with somebody according to the first picture entity information and the compression
The step of picture compression to be compressed is Target Photo by confidence breath, including:According to the first picture specifications parameter and institute
State the compression factor that second picture specifications parameter determines the picture to be compressed;According to the compression factor by the figure to be compressed
Target Photo described in piece boil down to.
In the technical scheme, according to the first picture entity information of picture to be compressed and the compressed configuration information pressure set
During contract drawing piece, the picture specification for the Target Photo that can be wanted according to the original picture specifications parameter of picture to be compressed and user
Parameter is determined to be changed into the compression factor of second picture specifications parameter from the first picture specifications parameter, then entered according to the compression factor
Row accurately compression, to obtain the picture specification matched with client device, further, when setting compressed configuration information,
Second picture specifications parameter can be directly disposed as to the compression factor of adaptation;In addition, when carrying out picture compression, specifically can be with
The form contracted using level specific pressure.
In any of the above-described technical scheme, it is preferable that described to cache the target icon to static resource server
Step also includes:Obtain the second picture entity information of the Target Photo;According to the first picture entity information and described
The picture to be compressed and the Target Photo are associated storage by second picture entity information.
In the technical scheme, for the ease of that can be directed within a period of time with quick response by same picture pressure to be compressed
The request of same Target Photo is condensed to, then its second picture entity information can be obtained after generation Target Photo, and be based on being somebody's turn to do
Picture to be compressed and matched Target Photo are associated and deposited by the first picture entity information and second picture entity information
Storage, wherein, second picture entity information should at least include picture identification code, picture/mb-type, picture header, the picture of Target Photo
Link, picture application identities and picture specifications parameter, it is possible to further set up picture to be compressed based on unique picture identification code
The accurate incidence relation between Target Photo.
According to the second aspect of the invention, it is proposed that a kind of picture compression device, including:Acquisition module, is treated for obtaining
First picture entity information of compressed picture;Setup module, the compressed configuration information for setting the picture to be compressed;Compression
Module, the pressure set for the first picture entity information obtained according to the acquisition module and the setup module
The picture compression to be compressed is Target Photo by contracting configuration information;Memory module, for the Target Photo to be cached to quiet
In state Resource Server, so that the client device matched with the Target Photo is obtained.
In the technical scheme, when needing to treat compressed picture progress picture compression processing, based on the picture to be compressed
The first original picture entity information and the compressed configuration information that sets compress it into Target Photo, and will be obtained after compression
Target Photo be buffered in static resource server for adaptation client device obtain, i.e., adapted to not by pre-setting
With the compressed configuration information of client device, with based on the compressed configuration information by picture compression into adapting to different clients
The picture of the specification of end equipment is cached, in this way, can avoid the picture distorting transformation after compression and cause client to set
Standby loading is slow, waste network traffics etc., that is, ensure that the picture after compression has preferable display effect and transmission rate, from
And lift Consumer's Experience.
Wherein it is possible to perform the operation of above-mentioned picture compression using BufferedImage components;Moreover, by that will compress
Target Photo afterwards is buffered in static resource server, can avoid continually carrying out identical pressure to same picture to be compressed
Contracting operation, you can so that the different client devices with same requirements quickly and efficiently gets the figure of compressed processing
Piece, that is to say, that whether client device first looks for having cached in static resource server in the picture after obtaining compression
Corresponding Target Photo, if directly being obtained if having cached from the static resource server, is otherwise performed in above-mentioned technical proposal
The picture compression operation of record;Further, in order that static resource server can cache successfully newly-generated target all the time
Picture, then can carry out periodically removing the operation of caching to it.
In the above-mentioned technical solutions, it is preferable that the setup module includes:First determination sub-module, for according to described
The first picture entity information that acquisition module is obtained determines the picture classification belonging to the picture to be compressed;Submodule is set
Block, the picture classification for being determined according to the determination sub-module sets the compressed configuration information.
In the technical scheme, after the first picture entity information of picture to be compressed is got, its compression is set to match somebody with somebody
Before confidence breath, picture classification that can first according to belonging to its first picture entity information determines it, such as according to picture size
And/or definition carries out picture category division, the compressed configuration information with the picture categorical match belonging to it is then set, with true
The definition for the Target Photo protected after being compressed according to the compressed configuration information, so that it is guaranteed that display effect.
In any of the above-described technical scheme, it is preferable that the first picture entity information includes:Picture identification code, picture
Type, picture header, image link, picture application identities, the first picture specifications parameter;The compressed configuration information includes:Visitor
Family end equipment type, picture show scene, picture display type, second picture specifications parameter.
In the technical scheme, the first picture entity information of picture to be compressed can at least include:Picture identification code, i.e.,
It is only used for the ID identification numbers of consistency operation identification;Picture/mb-type, such as big with more rich color and space-consuming
BMP, with more rich color and the weaker GIF of the JPG occupied little space, color etc.;Picture header, i.e. picture name, are used
The different pictures of differentiation are recognized for it in being presented to user;URL of image link, such as picture etc.;Picture application identities, i.e. table
Show the applied business scene of the picture to be compressed;First picture specifications parameter, such as length, width, size, the occupancy of picture is empty
Between etc.;To be accurately positioned the picture to be compressed based on above-mentioned first picture entity information, and effective picture is carried out based on it
Compression;It is true it is possible to further the picture/mb-type according to the picture to be compressed, picture application identities and the first picture specifications parameter
Determine the picture classification belonging to it.
And be used to believe with reference to the compressed configuration that the first picture entity information of picture to be compressed compresses it into Target Photo
Breath can at least include:Client device type, such as be applied to PC ends or mobile terminal by the picture after compression;Picture is shown
Scene, such as, to the less demanding common display of picture clarity, be generally used for the display at PC ends, or in the form of small icon
For marking, the display of mobile terminal is generally used for;Picture display type, such as with the large icons of opening, medium icon, small figure
The form of mark or list etc. is shown;Length, width, size, space-consuming of second picture specifications parameter, such as picture etc..
Further, when carrying out picture compression operation based on above-mentioned compressed configuration information, its client can be set first
End equipment type, then sets picture to show that scene, picture display type, picture specification are joined according to the client device type
Number, so that the picture after compression is better adapted to corresponding client device.
In any of the above-described technical scheme, it is preferable that the compression module includes:Second determination sub-module, for basis
The first picture specifications parameter and the second picture specifications parameter determine the compression factor of the picture to be compressed;Compression
Module, by the picture compression to be compressed is the mesh for the compression factor that is determined according to second determination sub-module
Mark on a map piece.
In the technical scheme, according to the first picture entity information of picture to be compressed and the compressed configuration information pressure set
During contract drawing piece, the picture specification for the Target Photo that can be wanted according to the original picture specifications parameter of picture to be compressed and user
Parameter is determined to be changed into the compression factor of second picture specifications parameter from the first picture specifications parameter, then entered according to the compression factor
Row accurately compression, to obtain the picture specification matched with client device, further, when setting compressed configuration information,
Second picture specifications parameter can be directly disposed as to the compression factor of adaptation;In addition, when carrying out picture compression, specifically can be with
The form contracted using level specific pressure.
In any of the above-described technical scheme, it is preferable that the memory module includes:Acquisition submodule, it is described for obtaining
The second picture entity information of Target Photo;Submodule is associated, for according to the first picture entity information and described second
The picture to be compressed and the Target Photo are associated storage by picture entity information.
In the technical scheme, for the ease of that can be directed within a period of time with quick response by same picture pressure to be compressed
The request of same Target Photo is condensed to, then its second picture entity information can be obtained after generation Target Photo, and be based on being somebody's turn to do
Picture to be compressed and matched Target Photo are associated and deposited by the first picture entity information and second picture entity information
Storage, wherein, second picture entity information should at least include picture identification code, picture/mb-type, picture header, the picture of Target Photo
Link, picture application identities and picture specifications parameter, it is possible to further set up picture to be compressed based on unique picture identification code
The accurate incidence relation between Target Photo.
According to the third aspect of the invention we, it is proposed that a kind of server, including:As above it is any in second aspect technical scheme
Picture compression device described in, therefore, the server have picture as above any one of second aspect technical scheme
All beneficial effects of compression set, will not be repeated here.
Technical scheme, the compressed configuration information of different client devices is adapted to by pre-setting, with base
Picture compression can guarantee that into the picture with the specification for adapting to different client devices, and simultaneously in the compressed configuration information
Picture after compression has preferable display effect and transmission rate, so as to lift Consumer's Experience.
Brief description of the drawings
Fig. 1 shows the schematic flow sheet of the picture compression method of embodiments of the invention;
Fig. 2 shows the method flow schematic diagram of the setting compressed configuration information of embodiments of the invention;
Fig. 3 show embodiments of the invention by picture compression to be compressed be Target Photo method flow schematic diagram;
Fig. 4 shows the method flow schematic diagram of the caching of target picture of embodiments of the invention;
Fig. 5 shows the picture compression processing of embodiments of the invention and subsequent uses schematic flow sheet;
Fig. 6 shows the schematic block diagram of the picture compression device of embodiments of the invention;
Fig. 7 shows the schematic block diagram of the setup module shown in Fig. 6;
Fig. 8 shows the schematic block diagram of the compression module shown in Fig. 6;
Fig. 9 shows the schematic block diagram of the memory module shown in Fig. 6.
Embodiment
It is below in conjunction with the accompanying drawings and specific real in order to be more clearly understood that the above objects, features and advantages of the present invention
Mode is applied the present invention is further described in detail.It should be noted that in the case where not conflicting, the implementation of the application
Feature in example and embodiment can be mutually combined.
Many details are elaborated in the following description to facilitate a thorough understanding of the present invention, still, the present invention may be used also
Implemented with being different from other modes described here using other, therefore, protection scope of the present invention is not by described below
Specific embodiment limitation.
Fig. 1 shows the schematic flow sheet of the picture compression method of embodiments of the invention.
As shown in figure 1, picture compression method according to an embodiment of the invention, can specifically include below scheme step:
Step 102, the first picture entity information of picture to be compressed is obtained.
Step 104, the compressed configuration information of the picture to be compressed is set.
For the step, the compressed configuration information can be specifically set by embodiment as shown in Figure 2, including:
Step S20, the picture classification according to belonging to the first picture entity information determines the picture to be compressed.
Step S22, the compressed configuration information is set according to the picture classification.
In this embodiment, after the first picture entity information of picture to be compressed is got, its compressed configuration is set
Before information, picture classification that can first according to belonging to its first picture entity information determines it, such as according to picture size and/
Or definition carries out picture category division, the compressed configuration information with the picture categorical match belonging to it is then set, to ensure
The definition of Target Photo after being compressed according to the compressed configuration information, so that it is guaranteed that display effect.
Further, the first picture entity information of above-mentioned picture to be compressed can at least include:Picture identification code, i.e., only
The one ID identification numbers recognized for consistency operation;Picture/mb-type, such as big with more rich color and space-consuming
BMP, with more rich color and the weaker GIF of the JPG occupied little space, color etc.;Picture header, i.e. picture name, are used
The different pictures of differentiation are recognized for it in being presented to user;URL of image link, such as picture etc.;Picture application identities, i.e. table
Show the applied business scene of the picture to be compressed;First picture specifications parameter, such as length, width, size, the occupancy of picture is empty
Between etc.;To be accurately positioned the picture to be compressed based on above-mentioned first picture entity information, and effective picture is carried out based on it
Compression;It is true it is possible to further the picture/mb-type according to the picture to be compressed, picture application identities and the first picture specifications parameter
Determine the picture classification belonging to it.
And be used to believe with reference to the compressed configuration that the first picture entity information of picture to be compressed compresses it into Target Photo
Breath can at least include:Client device type, such as be applied to PC ends or mobile terminal by the picture after compression;Picture is shown
Scene, such as, to the less demanding common display of picture clarity, be generally used for the display at PC ends, or in the form of small icon
For marking, the display of mobile terminal is generally used for;Picture display type, such as with the large icons of opening, medium icon, small figure
The form of mark or list etc. is shown;Length, width, size, space-consuming of second picture specifications parameter, such as picture etc..
Further, when carrying out picture compression operation based on above-mentioned compressed configuration information, its client can be set first
End equipment type, then sets picture to show that scene, picture display type, picture specification are joined according to the client device type
Number, so that the picture after compression is better adapted to corresponding client device.
Step 106, according to the first picture entity information and the compressed configuration information by the picture pressure to be compressed
It is condensed to Target Photo.
Further, as shown in figure 3, picture compression to be compressed is included for the idiographic flow step of Target Photo:
Step S30, is determined described to be compressed according to the first picture specifications parameter and the second picture specifications parameter
The compression factor of picture.
Step S32, according to the compression factor by the picture compression to be compressed be the Target Photo.
In this embodiment, according to the first picture entity information of picture to be compressed and the compressed configuration Information Compression set
During picture, the picture specification ginseng for the Target Photo that can be wanted according to the original picture specifications parameter of picture to be compressed and user
Number is determined to be changed into the compression factor of second picture specifications parameter from the first picture specifications parameter, then carried out according to the compression factor
Accurately compression, further, can when setting compressed configuration information to obtain the picture specification matched with client device
So that second picture specifications parameter to be directly disposed as to the compression factor of adaptation;In addition, when carrying out picture compression, can specifically adopt
The form contracted with level specific pressure.
Step 108, the Target Photo is cached into static resource server, for what is matched with the Target Photo
Client device is obtained.
Further, as shown in figure 4, the process of caching of target picture also includes:
Step S40, obtains the second picture entity information of the Target Photo.
Step S42, according to the first picture entity information and the second picture entity information by the figure to be compressed
Piece and the Target Photo are associated storage.
In this embodiment, for the ease of can be directed within a period of time with quick response by same picture compression to be compressed
For the request of same Target Photo, then can obtain its second picture entity information after generation Target Photo, and based on this
Picture to be compressed and matched Target Photo are associated storage by one picture entity information and second picture entity information,
Wherein, second picture entity information should at least include picture identification code, picture/mb-type, picture header, the picture chain of Target Photo
Connect, picture application identities and picture specifications parameter, it is possible to further based on unique picture identification code set up picture to be compressed and
Accurate incidence relation between Target Photo.
To sum up, in an embodiment of the present invention, when needing to treat compressed picture progress picture compression processing, treated based on this
The first original picture entity information of compressed picture and the compressed configuration information set compress it into Target Photo, and will pressure
The client device that the Target Photo obtained after contracting is buffered in static resource server for adaptation is obtained, i.e., by pre-setting
Adapt to the compressed configuration information of different client devices, with based on the compressed configuration information by picture compression into adapting to
The picture of the specification of different client devices is cached, in this way, can avoid the picture distorting transformation after compression and cause
Client device loading is slow, waste network traffics etc., that is, ensure that the picture after compression has preferable display effect and biography
Defeated speed, so as to lift Consumer's Experience.
Wherein it is possible to perform the operation of above-mentioned picture compression using BufferedImage components;Moreover, by that will compress
Target Photo afterwards is buffered in static resource server, can avoid continually carrying out identical pressure to same picture to be compressed
Contracting operation, you can so that the different client devices with same requirements quickly and efficiently gets the figure of compressed processing
Piece, that is to say, that whether client device first looks for having cached in static resource server in the picture after obtaining compression
Corresponding Target Photo, if directly being obtained if having cached from the static resource server, is otherwise performed in above-mentioned technical proposal
The picture compression operation of record;Further, in order that static resource server can cache successfully newly-generated target all the time
Picture, then can carry out periodically removing the operation of caching to it.
In other embodiments of the invention, figure component is cut to being uploaded in website by using BufferedImage pictures
Artwork carry out cut figure, artwork is compressed into the picture of different size as required, you can with based on predefined compressed configuration
Information, and it is a variety of to be adapted into the picture of different size according to the dynamic level specific pressure contracting compressed picture of the compressed configuration information
Client device.
Specifically, the source difference held according to UI (User Interface, user interface), compressed configuration information can spirit
Living is configured.Such as:If the browser of PC ends (i.e. client device), then compressed configuration information can include various rule
The height of lattice × wide information, while also supporting proportionally to zoom in and out;If the browser of mobile phone terminal (i.e. client device), then
Because mobile phone screen is of different sizes and the difference of resolution ratio, predefined height can be unified, according to the ratio of the artwork obtained automatically
According to the picture of the height level specific pressure contracting generation different size of configuration, and it is stored under the config directory automatically generated.
Realize that step is as follows:
(1) create picture configuration entity and initialize associated compression configuration information, specifically:
The compressed configuration information at PC ends is:
'MANAGE','SCENE','BIG','1000×550';Or
'MANAGE','SCENE','WEB_LIST','200×150'。
The compressed configuration information of mobile phone terminal is:
'MOBILE','NOTES','BIG',”;Or
'MOBILE','NOTES','MOBILE_MID','600';Or
'MOBILE','NOTES','MOBILE_SMALL','250'。
Compressed configuration information is described as follows shown in table 1:
Table 1
Table 1 shows the essential information of the Target Photo after compression.
The critical field information of picture configuration information entity is as shown in table 2 below:
Table 2
Table 2 shows related configuration information of the picture in client device after compression, i.e. client device is shown
The primary demand of picture, such as realize and different size picture deposited to the different mesh of static resource server automatically according to configuration information
Record.
(2) picture entity (referring to picture to be compressed) is created
The critical field information of picture entity is as shown in table 3 below:
Table 3
Table 3 shows the essential information of picture to be compressed, wherein:Picture unique mark is to refer to picture identification code;Picture is closed
Connection ID is to refer to picture application identities, the service application scene for indicating icon;And picture specification type is to refer to picture to be compressed
Picture specifications parameter.
(3) according to configuration picture configuration information, the depth-width ratio example that figure component obtains artwork automatically is cut, JAVA language meter is run
Level specific pressure contracting relation is calculated, (in specified location and is pressed by the DrawImage of Graphic (graph and image processing instrument) a kind of
Original size draws the image specified) the corresponding catalogue that configuring after calculating generates picture to static resource server is combined, together
When by artwork and generation pictorial information recorded in pictorial information entity.
(4) client UI accesses static resource picture, and corresponding picture is obtained according to different UI client devices selections
Absolute URL link, realizes that picture adapts to the displaying of all size in different client devices.
To sum up, the embodiment devises picture entity information and picture configuration entity information;Devise reading picture compression
Configuration information method;Devise according to artwork and the automatic compressed picture method of compressed configuration information;Different size picture is according to matching somebody with somebody
The automatic storage static resource server different directories of confidence breath.
As shown in figure 5, being divided to two flows:One is consumption flow, is initiated by specifically accessing user;Two be production procedure by
Pictures management person initiates.Correspond to respectively at following 2 points:
(1) picture consumption flow:Client's browser interface of client device (mobile terminal or PC ends) → pass through static resource
Compressed picture in server → Resource Server docking picture compression assembly → acquisition internal memory.
(2) usage scenario flow:Keeper initiate uploading pictures ask → select picture will PC and be mobile terminal show
Show → picture compression component using JAVA BufferedImage (picture vector caching technology)+Graphic → picture compression
Size into specified specification is cached in internal memory.
Fig. 6 shows the schematic block diagram of the picture compression device of embodiments of the invention.
As shown in fig. 6, picture compression device 600 according to an embodiment of the invention, including:Acquisition module 602, setting mould
Block 604, compression module 606 and memory module 608.
Wherein, the acquisition module 602 is used for the first picture entity information for obtaining picture to be compressed;The setup module
The 604 compressed configuration information for setting the picture to be compressed;The compression module 606 is used for according to the acquisition module
The compressed configuration information that 602 the first picture entity informations obtained and the setup module 604 are set is treated described
Compressed picture boil down to Target Photo;The memory module 608 is used to cache the Target Photo to static resource server
In, so that the client device matched with the Target Photo is obtained.
In this embodiment, when needing to treat compressed picture progress picture compression processing, based on the picture to be compressed
Original the first picture entity information and the compressed configuration information set compresses it into Target Photo, and will be obtained after compression
The client device that Target Photo is buffered in static resource server for adaptation is obtained, i.e., adapt to difference by pre-setting
The compressed configuration information of client device, with based on the compressed configuration information by picture compression into adapting to different clients
The picture of the specification of equipment is cached, in this way, can avoid the picture distorting transformation after compression and cause client device
Loading is slow, waste network traffics etc., that is, ensure that the picture after compression has preferable display effect and transmission rate, so that
Lift Consumer's Experience.
Wherein it is possible to perform the operation of above-mentioned picture compression using BufferedImage components;Moreover, by that will compress
Target Photo afterwards is buffered in static resource server, can avoid continually carrying out identical pressure to same picture to be compressed
Contracting operation, you can so that the different client devices with same requirements quickly and efficiently gets the figure of compressed processing
Piece, that is to say, that whether client device first looks for having cached in static resource server in the picture after obtaining compression
Corresponding Target Photo, if directly being obtained if having cached from the static resource server, is otherwise performed in above-mentioned technical proposal
The picture compression operation of record;Further, in order that static resource server can cache successfully newly-generated target all the time
Picture, then can carry out periodically removing the operation of caching to it.
Further, in the above-described embodiments, as shown in fig. 7, the setup module 604 includes:First determination sub-module
6042 and set submodule 6044.
Wherein, first determination sub-module 6042 is used for first picture obtained according to the acquisition module 602
Entity information determines the picture classification belonging to the picture to be compressed;The setting submodule 6044 is used to determine son according to described
The picture classification that module is determined sets the compressed configuration information.
In this embodiment, after the first picture entity information of picture to be compressed is got, its compressed configuration is set
Before information, picture classification that can first according to belonging to its first picture entity information determines it, such as according to picture size and/
Or definition carries out picture category division, the compressed configuration information with the picture categorical match belonging to it is then set, to ensure
The definition of Target Photo after being compressed according to the compressed configuration information, so that it is guaranteed that display effect.
Further, in any of the above-described embodiment, the first picture entity information of picture to be compressed can at least include:
Picture identification code, that is, be only used for ID (Identification, identity) identification number of consistency operation identification;Picture/mb-type,
Such as there is more rich color and the big BMP of space-consuming, with more rich color and the JPG occupied little space, color
Weaker GIF etc.;Picture header, i.e. picture name, for being presented to user for the different pictures of its identification differentiation;Picture chain
Connect, such as URL (Uniform Resource Locator, URLs) of picture etc.;Picture application identities, that is, representing should
The applied business scene of picture to be compressed;First picture specifications parameter, such as length, width, size, the space-consuming of picture
Deng;To be accurately positioned the picture to be compressed based on above-mentioned first picture entity information, and effective picture pressure is carried out based on it
Contracting;Determined it is possible to further the picture/mb-type according to the picture to be compressed, picture application identities and the first picture specifications parameter
Picture classification belonging to it.
And be used to believe with reference to the compressed configuration that the first picture entity information of picture to be compressed compresses it into Target Photo
Breath can at least include:Client device type, such as by the picture after compression be applied to PC (Personal Computer, it is individual
People's computer) hold or mobile terminal;Picture shows scene, such as, to the less demanding common display of picture clarity, is generally used for
The display at PC ends, or it is generally used for the display of mobile terminal for marking in the form of small icon;Picture display type, than
Shown such as in the form of the large icons of opening, medium icon, small icon or list;Second picture specifications parameter, such as scheme
Length, width, size, space-consuming of piece etc..
Further, when carrying out picture compression operation based on above-mentioned compressed configuration information, its client can be set first
End equipment type, then sets picture to show that scene, picture display type, picture specification are joined according to the client device type
Number, so that the picture after compression is better adapted to corresponding client device.
Further, in any of the above-described embodiment, as shown in figure 8, the compression module 606, which includes second, determines submodule
Block 6062 and compression submodule 6064.
Wherein, second determination sub-module 6062 is used for according to the first picture specifications parameter and the second picture
Specifications parameter determines the compression factor of the picture to be compressed;The compression submodule 6064 is used to determine son according to described second
The picture compression to be compressed is the Target Photo by the compression factor that module 6062 is determined.
In this embodiment, according to the first picture entity information of picture to be compressed and the compressed configuration Information Compression set
During picture, the picture specification ginseng for the Target Photo that can be wanted according to the original picture specifications parameter of picture to be compressed and user
Number is determined to be changed into the compression factor of second picture specifications parameter from the first picture specifications parameter, then carried out according to the compression factor
Accurately compression, further, can when setting compressed configuration information to obtain the picture specification matched with client device
So that second picture specifications parameter to be directly disposed as to the compression factor of adaptation;In addition, when carrying out picture compression, can specifically adopt
The form contracted with level specific pressure.
Further, in any of the above-described embodiment, as shown in figure 9, the memory module 608 includes:Acquisition submodule
6082 with associate submodule 6084.
Wherein, the acquisition submodule 6082 is used for the second picture entity information for obtaining the Target Photo;It is described to close
Joining submodule 6084 is used for the figure to be compressed according to the first picture entity information and the second picture entity information
Piece and the Target Photo are associated storage.
In this embodiment, for the ease of can be directed within a period of time with quick response by same picture compression to be compressed
For the request of same Target Photo, then can obtain its second picture entity information after generation Target Photo, and based on this
Picture to be compressed and matched Target Photo are associated storage by one picture entity information and second picture entity information,
Wherein, second picture entity information should at least include picture identification code, picture/mb-type, picture header, the picture chain of Target Photo
Connect, picture application identities and picture specifications parameter, it is possible to further based on unique picture identification code set up picture to be compressed and
Accurate incidence relation between Target Photo.
In any of the above-described embodiment, acquisition module 602, setup module 604, compression module 606 and memory module 608 can
To be CPU (Central Processing Unit, CPU), microprocessor or digital signal processor
(Digital Signal Processor, DSP) etc..
, can be by the picture compression device 600 any one of above-described embodiment as one embodiment of the present of invention
For server, therefore, there are the server all of picture compression device 600 as any one of above-mentioned embodiment to have
Beneficial effect, will not be repeated here.
Technical scheme is described in detail above in association with accompanying drawing, adapts to different clients by pre-setting and sets
Standby compressed configuration information, with based on the compressed configuration information by picture compression into the rule for adapting to different client devices
The picture of lattice, and can guarantee that the picture after compression has preferable display effect and transmission rate simultaneously, so as to lift user's body
Test.
The preferred embodiments of the present invention are the foregoing is only, are not intended to limit the invention, for the skill of this area
For art personnel, the present invention can have various modifications and variations.Within the spirit and principles of the invention, that is made any repaiies
Change, equivalent substitution, improvement etc., should be included in the scope of the protection.
Claims (10)
1. a kind of picture compression method, it is characterised in that including:
Obtain the first picture entity information of picture to be compressed;
The compressed configuration information of the picture to be compressed is set;
By the picture compression to be compressed it is Target Photo according to the first picture entity information and the compressed configuration information;
The Target Photo is cached into static resource server, so that the client device matched with the Target Photo is obtained
Take.
2. picture compression method according to claim 1, it is characterised in that the compression of the setting picture to be compressed
The step of configuration information, includes:
Picture classification according to belonging to the first picture entity information determines the picture to be compressed;
The compressed configuration information is set according to the picture classification.
3. picture compression method according to claim 1 or 2, it is characterised in that
The first picture entity information includes:Picture identification code, picture/mb-type, picture header, image link, picture application mark
Knowledge, the first picture specifications parameter;
The compressed configuration information includes:Client device type, picture show scene, picture display type, second picture rule
Lattice parameter.
4. picture compression method according to claim 3, it is characterised in that described according to the first picture entity information
With the compressed configuration information by the picture compression to be compressed be Target Photo the step of, including:
The compression ratio of the picture to be compressed is determined according to the first picture specifications parameter and the second picture specifications parameter
Example;
According to the compression factor by the picture compression to be compressed be the Target Photo.
5. picture compression method according to claim 1 or 2, it is characterised in that it is described by the target icon cache to
The step of static resource server, also includes:
Obtain the second picture entity information of the Target Photo;
According to the first picture entity information and the second picture entity information by the picture to be compressed and the target
Picture is associated storage.
6. a kind of picture compression device, it is characterised in that including:
Acquisition module, the first picture entity information for obtaining picture to be compressed;
Setup module, the compressed configuration information for setting the picture to be compressed;
Compression module, is set for the first picture entity information obtained according to the acquisition module and the setup module
The compressed configuration information by the picture compression to be compressed be Target Photo;
Memory module, for the Target Photo to be cached into static resource server, for being matched with the Target Photo
Client device obtain.
7. picture compression device according to claim 6, it is characterised in that the setup module includes:
First determination sub-module, for waiting to press according to the first picture entity information determination that the acquisition module is obtained
Picture classification belonging to contract drawing piece;
Submodule is set, and the picture classification for being determined according to the determination sub-module sets the compressed configuration information.
8. the picture compression device according to claim 6 or 7, it is characterised in that
The first picture entity information includes:Picture identification code, picture/mb-type, picture header, image link, picture application mark
Knowledge, the first picture specifications parameter;
The compressed configuration information includes:Client device type, picture show scene, picture display type, second picture rule
Lattice parameter.
9. the picture compression device according to described in claim 8, it is characterised in that the compression module includes:
Second determination sub-module, described in being determined according to the first picture specifications parameter and the second picture specifications parameter
The compression factor of picture to be compressed;
Submodule is compressed, for the compression factor that is determined according to second determination sub-module by the picture pressure to be compressed
It is condensed to the Target Photo.
10. the picture compression device according to claim 6 or 7, it is characterised in that the memory module includes:
Acquisition submodule, the second picture entity information for obtaining the Target Photo;
Submodule is associated, for will be described to be compressed according to the first picture entity information and the second picture entity information
Picture and the Target Photo are associated storage.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710259718.6A CN107220000A (en) | 2017-04-19 | 2017-04-19 | Picture compression method and picture compression device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710259718.6A CN107220000A (en) | 2017-04-19 | 2017-04-19 | Picture compression method and picture compression device |
Publications (1)
Publication Number | Publication Date |
---|---|
CN107220000A true CN107220000A (en) | 2017-09-29 |
Family
ID=59928294
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710259718.6A Pending CN107220000A (en) | 2017-04-19 | 2017-04-19 | Picture compression method and picture compression device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN107220000A (en) |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107798706A (en) * | 2017-10-30 | 2018-03-13 | 广州木铎信息技术有限公司 | Intelligent picture compressibility |
CN107994994A (en) * | 2017-11-24 | 2018-05-04 | 深圳中兴网信科技有限公司 | Image authentication code verification method, system, server and terminal |
CN110070501A (en) * | 2019-03-25 | 2019-07-30 | 成都品果科技有限公司 | A kind of system, method and apparatus promoting image Gaussian Blur treatment effeciency |
CN110471593A (en) * | 2019-07-31 | 2019-11-19 | 成都摹客科技有限公司 | The method, apparatus, system and storage medium of figure are cut based on web terminal compression |
CN110580242A (en) * | 2018-06-07 | 2019-12-17 | 深圳艾派网络科技股份有限公司 | picture storage and display method and system in network disk application |
CN110913088A (en) * | 2019-11-22 | 2020-03-24 | 合肥高维数据技术有限公司 | Picture transmission method and system for IM software platform |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103646036A (en) * | 2012-12-04 | 2014-03-19 | 乐视致新电子科技(天津)有限公司 | Automatic updating method for loading of advertising pictures |
CN104616263A (en) * | 2015-02-10 | 2015-05-13 | 深圳中兴网信科技有限公司 | Image processing method and device |
WO2016206556A1 (en) * | 2015-06-25 | 2016-12-29 | 阿里巴巴集团控股有限公司 | Method of processing warehouse resource information and providing inventory information and device utilizing same |
-
2017
- 2017-04-19 CN CN201710259718.6A patent/CN107220000A/en active Pending
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103646036A (en) * | 2012-12-04 | 2014-03-19 | 乐视致新电子科技(天津)有限公司 | Automatic updating method for loading of advertising pictures |
CN104616263A (en) * | 2015-02-10 | 2015-05-13 | 深圳中兴网信科技有限公司 | Image processing method and device |
WO2016206556A1 (en) * | 2015-06-25 | 2016-12-29 | 阿里巴巴集团控股有限公司 | Method of processing warehouse resource information and providing inventory information and device utilizing same |
Cited By (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107798706A (en) * | 2017-10-30 | 2018-03-13 | 广州木铎信息技术有限公司 | Intelligent picture compressibility |
CN107994994A (en) * | 2017-11-24 | 2018-05-04 | 深圳中兴网信科技有限公司 | Image authentication code verification method, system, server and terminal |
CN110580242A (en) * | 2018-06-07 | 2019-12-17 | 深圳艾派网络科技股份有限公司 | picture storage and display method and system in network disk application |
CN110070501A (en) * | 2019-03-25 | 2019-07-30 | 成都品果科技有限公司 | A kind of system, method and apparatus promoting image Gaussian Blur treatment effeciency |
CN110471593A (en) * | 2019-07-31 | 2019-11-19 | 成都摹客科技有限公司 | The method, apparatus, system and storage medium of figure are cut based on web terminal compression |
CN110913088A (en) * | 2019-11-22 | 2020-03-24 | 合肥高维数据技术有限公司 | Picture transmission method and system for IM software platform |
CN110913088B (en) * | 2019-11-22 | 2021-11-09 | 合肥高维数据技术有限公司 | Picture transmission method and system for IM software platform |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107220000A (en) | Picture compression method and picture compression device | |
JP4852674B2 (en) | Imaging system that provides dynamic viewport tiering optimized for specific client device types | |
US9071651B2 (en) | Dynamic content delivery to network-enabled static display device | |
US9497341B2 (en) | Methods and systems for user-association of visual stimuli with corresponding responses | |
US7418673B2 (en) | Thumbnail image browsing method in an embedded system | |
CN102685357B (en) | Album system, photographing device, and server | |
US8538149B2 (en) | Data processing apparatus, image registration method, and program product | |
US20090307571A1 (en) | Image acquisition from dynamic content for delivery to network-enabled static display devices | |
US8520967B2 (en) | Methods and apparatuses for facilitating generation images and editing of multiframe images | |
CN107977371A (en) | Requesting method, display methods and the client of page elements | |
CN104616263A (en) | Image processing method and device | |
CN104243923B (en) | A kind of method and system of picture processing and preview picture | |
CN106453572B (en) | Method and system based on Cloud Server synchronous images | |
CN104572847B (en) | A kind of method and device of photo name | |
CN110188216B (en) | Photo live broadcasting system with character recognition and method thereof | |
US9438858B1 (en) | Techniques for sharing image data remotely | |
CN106375454A (en) | Method and system for uploading file by scanning graphic identifier | |
CN104156251A (en) | Picture processing method and device | |
CN108804610A (en) | Picture compression display method and device, computer equipment and storage medium | |
KR20170001792A (en) | Personal customized contents service system and method | |
US20030159065A1 (en) | Apparatus and method for inspecting the copyright of digital data on a network, and recording medium on which is recorded a copyright inspection program | |
US8964063B2 (en) | Camera resolution modification based on intended printing location | |
CN105897927B (en) | A method of parsing Google longitude and latitude | |
CN104699729B (en) | Device and method for identifying authenticity of social network site photo | |
JP2007334629A (en) | Id card issuing system and method |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20170929 |