CN105787868B - Picture compression method and device and electronic equipment - Google Patents
Picture compression method and device and electronic equipment Download PDFInfo
- Publication number
- CN105787868B CN105787868B CN201610091441.6A CN201610091441A CN105787868B CN 105787868 B CN105787868 B CN 105787868B CN 201610091441 A CN201610091441 A CN 201610091441A CN 105787868 B CN105787868 B CN 105787868B
- Authority
- CN
- China
- Prior art keywords
- target photo
- compression
- short side
- resolution ratio
- electronic equipment
- 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
- 230000006835 compression Effects 0.000 title claims abstract description 202
- 238000007906 compression Methods 0.000 title claims abstract description 202
- 238000000034 method Methods 0.000 title claims abstract description 57
- 238000001514 detection method Methods 0.000 claims description 20
- 238000010586 diagram Methods 0.000 description 10
- 238000005516 engineering process Methods 0.000 description 2
- KUBDPQJOLOUJRM-UHFFFAOYSA-N 2-(chloromethyl)oxirane;4-[2-(4-hydroxyphenyl)propan-2-yl]phenol Chemical compound ClCC1CO1.C=1C=C(O)C=CC=1C(C)(C)C1=CC=C(O)C=C1 KUBDPQJOLOUJRM-UHFFFAOYSA-N 0.000 description 1
- 238000004883 computer application Methods 0.000 description 1
- 238000000151 deposition Methods 0.000 description 1
- 230000005611 electricity Effects 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 238000011084 recovery Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T3/00—Geometric image transformations in the plane of the image
- G06T3/04—Context-preserving transformations, e.g. by using an importance map
Landscapes
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Image Processing (AREA)
- Compression Or Coding Systems Of Tv Signals (AREA)
Abstract
The embodiment of the invention provides a picture compression method, a picture compression device and electronic equipment, wherein the picture compression device comprises the following steps: and obtaining a target picture, detecting whether the target picture needs to be compressed, and if so, compressing the target picture according to the resolution of the target picture and the resolution of the electronic equipment to obtain a target compressed picture. By applying the technical scheme provided by the embodiment of the invention, the picture can be compressed according to the relation between the resolution of the picture and the resolution of the electronic equipment, so that the occupation of a storage space is reduced.
Description
Technical field
The present invention relates to computer application technologies, set more particularly to a kind of picture compression method, apparatus and electronics
It is standby.
Background technique
With popularizing for electronic equipment, more and more people are taken pictures using electronic equipment, such as: using mobile phone or put down
Plate computer is taken pictures, and the picture storage formed after taking pictures is in the electronic device.
The quality of the picture formed after being taken pictures due to current electronic equipment is higher, and a large amount of pictures is caused to be deposited in the electronic device
Chu Shi occupies biggish memory space, influences the use of electronic equipment.
Summary of the invention
The embodiment of the present invention is designed to provide a kind of picture compression method, apparatus and electronic equipment, can solve as
What reduces the problem of occupancy of memory space.Specific technical solution is as follows:
A kind of picture compression method is applied to electronic equipment, which comprises
Obtain Target Photo;
Detect whether the Target Photo needs to compress;
If so, according to the resolution ratio of the Target Photo and the resolution ratio of the electronic equipment, to the target figure
Piece is compressed, and targeted compression picture is obtained.
Optionally, whether the detection Target Photo needs to compress, comprising:
Judge whether the size of the Target Photo is greater than preset first threshold value;If so, determining that the Target Photo needs
It compresses.
Optionally, whether the detection Target Photo needs to compress, comprising:
Judge whether the short side resolution ratio of the Target Photo is greater than default third threshold value;If the Target Photo is short
Side resolution ratio is greater than default third threshold value, determines that the Target Photo needs to compress.
Optionally, described according to the resolution ratio of the Target Photo and the resolution ratio of the electronic equipment, to the mesh
Piece of marking on a map is compressed, comprising:
Judge whether the short side resolution ratio of the Target Photo is greater than the short side resolution ratio of the electronic equipment screen;
In the case where the short side resolution ratio of the Target Photo is greater than the short side resolution ratio of the electronic equipment screen, sentence
Whether the short side resolution ratio of the electronic equipment screen of breaking is less than the default third threshold value;
In the case where the short side resolution ratio of the electronic equipment screen is less than default third threshold value, by the Target Photo
Short side resolution compression to the default third threshold value, it is default to judge whether the long side resolution ratio of the Target Photo is not more than
Second threshold;
If so, by the long side resolution compression of the Target Photo to the default second threshold;
If not, the long side resolution ratio of the Target Photo is subjected to equal proportion compression according to short side compression ratio, it is described short
Side compression ratio is the compression ratio that the short side resolution compression is obtained to the default third threshold value.
Optionally, in the case where the short side resolution ratio of the electronic equipment screen is more than or equal to default third threshold value, institute
State method further include:
By the short side resolution ratio of the short side resolution compression of the Target Photo to the electronic equipment screen, described in judgement
Whether the long side resolution ratio of Target Photo is less than the default second threshold;
If so, by the long side resolution compression of the Target Photo to the default second threshold;
If not, the long side resolution ratio of the Target Photo is subjected to equal proportion compression according to short side compression ratio, it is described short
Side compression ratio is the compression ratio that the short side resolution ratio of the short side resolution compression to the electronic equipment screen obtains.
Optionally, after obtaining targeted compression picture, the method also includes:
The Target Photo is deleted.
Optionally, before deleting the Target Photo, the method also includes:
The Target Photo is sent to server, so that the server after receiving picture, is saved and to be received
The Target Photo.
A kind of picture compression device, is applied to electronic equipment, and described device includes: to obtain module, detection module and compression
Module, wherein
The acquisition module, for obtaining Target Photo;
The detection module, for detecting whether the Target Photo needs to compress;
First compression module is used in the case where the judgment module judges that the Target Photo needs to compress,
According to the resolution ratio of the Target Photo and the resolution ratio of the electronic equipment, the Target Photo is compressed, is obtained
Targeted compression picture.
Optionally, the detection module, is specifically used for:
Judge whether the size of the Target Photo is greater than preset first threshold value;If so, determining that the Target Photo needs
It compresses.
Optionally, the detection module, is specifically used for:
Judge whether the short side resolution ratio of the Target Photo is greater than default third threshold value;If the Target Photo is short
Side resolution ratio is greater than default third threshold value, determines that the Target Photo needs to compress.
Optionally, first compression module, is specifically used for:
Judge whether the short side resolution ratio of the Target Photo is greater than the short side resolution ratio of the electronic equipment screen;
In the case where the short side resolution ratio of the Target Photo is greater than the short side resolution ratio of the electronic equipment screen, sentence
Whether the short side resolution ratio of the electronic equipment screen of breaking is less than the default third threshold value;
In the case where the short side resolution ratio of the electronic equipment screen is less than default third threshold value, by the Target Photo
Short side resolution compression to the default third threshold value, it is default to judge whether the long side resolution ratio of the Target Photo is not more than
Second threshold;
If so, the long side resolution compression of the Target Photo is obtained targeted compression to the default second threshold
Picture;
If not, the long side resolution ratio of the Target Photo is subjected to equal proportion compression according to short side compression ratio, it is described short
Side compression ratio is the compression ratio that the short side resolution compression is obtained to the default third threshold value, obtains targeted compression picture.
Optionally, described device further include:
Second compression module, be greater than for first compression module in the short side resolution ratio of the electronic equipment screen etc.
In the case where default third threshold value, by the short side of the short side resolution compression of the Target Photo to the electronic equipment screen
Resolution ratio, judges whether the long side resolution ratio of the Target Photo is less than the default second threshold;
If so, the long side resolution compression of the Target Photo is obtained targeted compression to the default second threshold
Picture;
If not, the long side resolution ratio of the Target Photo is subjected to equal proportion compression according to short side compression ratio, it is described short
Side compression ratio is the compression ratio that the short side resolution ratio of the short side resolution compression to the electronic equipment screen obtains, and obtains mesh
Mark compressed picture.
Optionally, described device further include:
Removing module deletes the Target Photo for first compression module after obtaining targeted compression picture
It removes.
Optionally, described device further include:
Sending module sends the Target Photo for the removing module before deleting the Target Photo
To server, so that the server after receiving picture, saves the Target Photo received.
A kind of electronic equipment, the electronic equipment include:
Shell, processor, memory, circuit board and power circuit, wherein circuit board is placed in the space that shell surrounds
Portion, processor and memory setting are on circuit boards;Power circuit, for each circuit or the device power supply for electronic equipment;
Memory is for storing executable program code;Processor is run by reading the executable program code stored in memory
Program corresponding with executable program code, for executing following steps:
Obtain Target Photo;
Detect whether the Target Photo needs to compress;
If so, according to the resolution ratio of the Target Photo and the resolution ratio of the electronic equipment, to the target figure
Piece is compressed, and targeted compression picture is obtained.
In order to achieve the above objectives, the embodiment of the present application also provides a kind of storage mediums, wherein the storage medium is for depositing
Application program is stored up, the application program for executing a kind of picture compression method method described herein at runtime.Wherein,
A kind of picture compression method described herein is applied to electronic equipment, which comprises
Obtain Target Photo;
Detect whether the Target Photo needs to compress;
If so, according to the resolution ratio of the Target Photo and the resolution ratio of the electronic equipment, to the target figure
Piece is compressed, and targeted compression picture is obtained.
In order to achieve the above objectives, the embodiment of the present application also provides a kind of application programs, wherein the application program is used for
A kind of picture compression method described herein is executed when operation.Wherein, a kind of picture compression method described herein, application
In electronic equipment, which comprises
Obtain Target Photo;
Detect whether the Target Photo needs to compress;
If so, according to the resolution ratio of the Target Photo and the resolution ratio of the electronic equipment, to the target figure
Piece is compressed, and targeted compression picture is obtained.
It, can be according to the resolution ratio of picture and the resolution ratio of electronic equipment using technical solution provided in an embodiment of the present invention
Between relationship, picture is compressed, the occupancy of memory space is reduced.Certainly, it implements any of the products of the present invention or square
Method must be not necessarily required to reach all the above advantage simultaneously.
Detailed description of the invention
In order to more clearly explain the embodiment of the invention or the technical proposal in the existing technology, to embodiment or will show below
There is attached drawing needed in technical description to be briefly described, it should be apparent that, the accompanying drawings in the following description is only this
Some embodiments of invention for those of ordinary skill in the art without creative efforts, can be with
It obtains other drawings based on these drawings.
Fig. 1 is the first flow diagram of picture compression method provided in an embodiment of the present invention;
Fig. 2 is second of flow diagram of picture compression method provided in an embodiment of the present invention;
Fig. 3 is the third flow diagram of picture compression method provided in an embodiment of the present invention;
Fig. 4 is the 4th kind of flow diagram of picture compression method provided in an embodiment of the present invention;
Fig. 5 is the 5th kind of flow diagram of picture compression method provided in an embodiment of the present invention;
Fig. 6 is the first structural schematic diagram of picture compression device provided in an embodiment of the present invention;
Fig. 7 is second of structural schematic diagram of picture compression device provided in an embodiment of the present invention;
Fig. 8 is the third structural schematic diagram of picture compression device provided in an embodiment of the present invention;
Fig. 9 is the 4th kind of structural schematic diagram of picture compression device provided in an embodiment of the present invention;
Figure 10 is the structural schematic diagram of a kind of electronic equipment provided in an embodiment of the present invention.
Specific embodiment
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, complete
Site preparation description, it is clear that described embodiments are only a part of the embodiments of the present invention, instead of all the embodiments.It is based on
Embodiment in the present invention, it is obtained by those of ordinary skill in the art without making creative efforts every other
Embodiment shall fall within the protection scope of the present invention.
In order to solve prior art problem, the embodiment of the invention provides a kind of picture compression method, apparatus and electronics to set
It is standby.
A kind of picture compression method is provided for the embodiments of the invention first below to be introduced.
It should be noted that a kind of picture compression method provided by the embodiment of the present invention is applied to electronic equipment.In reality
In the application of border, which can be with smart phone, tablet computer, laptop etc., this is all reasonable.
Moreover, it is achieved that a kind of functional software of picture compression method provided by the embodiment of the present invention can be existing visitor
The plug-in unit of family end software;Alternatively, the functional software may be the independent client software for realizing picture compression.
As shown in Figure 1, a kind of picture compression method provided in an embodiment of the present invention, is applied to electronic equipment, may include:
S101: Target Photo is obtained.
One in the picture stored in the electronic device is obtained as Target Photo.
S102: whether detection Target Photo needs to compress, if so, executing step S103.
According to the actual situation, detect whether the Target Photo needs to compress.
S103: according to the resolution ratio of Target Photo and the resolution ratio of electronic equipment, Target Photo is compressed, is obtained
Targeted compression picture.
According to the relationship between the resolution ratio of Target Photo and the resolution ratio of electronic equipment, which is pressed
The image quality of contracting, compressed targeted compression picture is slightly lost, but picture is clear, does not influence normally to browse use.
It, can be according to the resolution ratio of picture and the resolution of electronic equipment using technical solution provided by the embodiment of the present invention
Relationship between rate, compresses picture, reduces the occupancy of memory space.
Specifically, in one implementation, detecting whether the Target Photo needs to compress, may include:
Judge whether the size of the Target Photo is greater than preset first threshold value;If so, determining that the Target Photo needs
It compresses.
Electronic equipment storage picture in, some pictures occupy memory space it is larger, so occupy memory space compared with
Big picture needs to compress.
Such as: preset first threshold value 200K, then the size of picture is required to compress in the picture of 200K or more.
Specifically, in another implementation, detecting whether the Target Photo needs to compress, may include:
Judge whether the short side resolution ratio of the Target Photo is greater than default third threshold value;If the Target Photo is short
Side resolution ratio is greater than default third threshold value, determines that the Target Photo needs to compress.
It can judge whether Target Photo needs by way of by the short side resolution ratio of Target Photo and preset threshold comparison
It compresses, indicates that the Target Photo needs to compress when short side resolution ratio is greater than preset threshold for Target Photo.
Further, as shown in Fig. 2, a kind of picture compression method provided by the invention, it is applied to electronic equipment, it can be with
Include:
S201: Target Photo is obtained.
S202: whether detection Target Photo needs to compress, if so, executing step S203.
Specifically, step S201 is identical as the step S101 of Fig. 1, step S202 is identical as the step S102 of Fig. 1, herein not
It repeats again.
S203: judging whether the short side resolution ratio of Target Photo is greater than the short side resolution ratio of electronic equipment screen, if so,
Execute step S204.
In the case where Target Photo needs to compress, by the short side resolution ratio of Target Photo and the short side of electronic equipment screen
Resolution ratio compares, in the case where the short side resolution ratio of Target Photo is greater than the short side resolution ratio of electronic equipment screen, into
Row subsequent step.
S204: judging whether the short side resolution ratio of electronic equipment screen is less than default third threshold value, if so, executing step
S205。
S205: by the short side resolution compression of Target Photo to default third threshold value, judge that the long side of Target Photo is differentiated
Whether rate is not more than default second threshold, if so, step S206 is executed, if not, executing step S207.
After the completion of compressing the short side of Target Photo, the long side resolution ratio of Target Photo and preset threshold are carried out pair
Than being compressed according to comparing result.
S206: by the long side resolution compression of Target Photo to default second threshold, targeted compression picture is obtained.
When the long side resolution ratio of Target Photo is not more than preset threshold, by the long side resolution compression of Target Photo to pre-
If threshold value, targeted compression picture is obtained.
S207: the long side resolution ratio of Target Photo is subjected to equal proportion compression according to short side compression ratio, obtains targeted compression
Picture.
Wherein, the short side compression ratio is the compression ratio that short side resolution compression is obtained to default third threshold value.
When the long side resolution ratio of Target Photo is greater than preset threshold, short side resolution compression is calculated in step S205 to pre-
If compression ratio when threshold value, according to the long side resolution ratio for the compression ratio compression goal picture being calculated, targeted compression figure is obtained
Piece.
As a result, in the case where the short side resolution ratio of electronic equipment screen is less than preset threshold, differentiated according to Target Photo
The resolution ratio of rate and electronic equipment, Target Photo is compressed, and reduces the occupancy of memory space.
Further, on the basis of embodiment shown in Fig. 2, it is more than or equal in the short side resolution ratio of electronic equipment screen
In the case where default third threshold value, as shown in figure 3, a kind of picture compression method provided by the invention, is applied to electronic equipment, also
May include:
S301: by the short side resolution ratio of the short side resolution compression of Target Photo to electronic equipment screen, judge target figure
Whether the long side resolution ratio of piece is less than default second threshold, if so, step S302 is executed, if not, executing step S303.
In the case where the short side resolution ratio of Target Photo is greater than the short side resolution ratio of electronic equipment screen, by Target Photo
Short side resolution compression to electronic equipment screen short side resolution ratio, Target Photo short side compression after the completion of, by target
Long side resolution ratio and the preset threshold of picture compare, and are compressed according to comparing result.
S302: by the long side resolution compression of Target Photo to default second threshold, targeted compression picture is obtained.
When the long side resolution ratio of Target Photo is less than preset threshold, by the long side resolution compression of Target Photo to default
Threshold value obtains targeted compression picture.
S303: the long side resolution ratio of Target Photo is subjected to equal proportion compression according to short side compression ratio, obtains targeted compression
Picture.
Wherein, the pressure that the short side compression ratio obtains for the short side resolution ratio of short side resolution compression to electronic equipment screen
Contracting ratio.
When the long side resolution ratio of Target Photo is no less than preset threshold, calculate step S302 in short side resolution compression extremely
Compression ratio when the short side resolution ratio of electronic equipment screen is differentiated according to the long side for the compression ratio compression goal picture being calculated
Rate obtains targeted compression picture.
As a result, on the basis of method shown in Fig. 2, further, it is greater than in the short side resolution ratio of electronic equipment screen pre-
If in the case where threshold value, according to the resolution ratio of Target Photo resolution ratio and electronic equipment, Target Photo being compressed, is reduced
The occupancy of memory space.
Below by a specific embodiment, method shown in Fig. 2 and Fig. 3 is described in detail.
Such as: electronic equipment is mobile phone, and the resolution ratio of picture 1 is 1000px × 1200px, and the resolution of picture 2 is
6000px × 4000px, the resolution ratio of picture 3 are 800px × 700px, and picture 4 is 2000px × 500px, in default second threshold
When value is 1024px and default third threshold value is 720px, since the short side resolution ratio 1200px of picture 1 is greater than default third threshold value
720px, so picture 1 needs to compress, the short side resolution ratio 4000px of picture 2 is greater than default third threshold value 720px, so picture
2 need to compress, and the short side resolution ratio 700px of picture 3 is less than default third threshold value 720px, so picture 3 does not need to compress, by
It is less than default third threshold value 720px in the short side resolution ratio 500px of picture 4, so picture 4 does not need to compress;
When the resolution ratio of mobile phone is 1920px × 1080px, the short side resolution ratio 1200px of picture 1 is greater than 1080px, and
The short side resolution ratio 1080px of mobile phone is greater than 720px, and the short side resolution ratio 1200px of picture 1 is compressed to 1080px, due to figure
The long side resolution ratio 1000px of piece 1 is less than 1024px and picture 1 is finally pressed to the long side resolution compression of picture 1 to 1024px
It is condensed to 1024px × 1080px;The short side resolution ratio 4000px of picture 2 is greater than the short side resolution ratio 1080px of mobile phone, and mobile phone
Short side resolution ratio 1080px is greater than 720px, and the short side resolution ratio 4000px of picture 2 is compressed to 1080px, compression ratio are as follows:
1080px/4000px=0.27, since the long side resolution ratio 6000px of picture 2 is greater than 1024px, by the long side resolution ratio of picture 2
6000px is according to 0.27 equal proportion boil down to 6000px × 0.27=1620px of compression ratio, finally by 2 boil down to 1620px of picture
×1080px;
When the resolution ratio of mobile phone is 1920px × 700px, the short side resolution ratio 1200px of picture 1 is greater than the short side of mobile phone
Resolution ratio 700px, and the short side resolution ratio 700px of mobile phone is less than 720px, and the short side resolution ratio 1200px of picture 1 is compressed to
720px, since the long side resolution ratio 1000px of picture 1 is less than 1024px, by the long side resolution compression of picture 1 to 1024px,
Finally by 1 boil down to 1024px × 720px of picture;The short side resolution ratio 4000px of picture 2 is greater than the short side resolution ratio of mobile phone
700px, and the short side resolution ratio 700px of mobile phone is less than 720px, and the short side resolution ratio 4000px of picture 2 is compressed to 720px,
Compression ratio are as follows: 720px/4000px=0.27, since the long side resolution ratio 6000px of picture 2 is greater than 1024px, by the length of picture 2
Side resolution ratio 6000px finally compresses picture 2 according to 0.18 equal proportion boil down to 6000px × 0.18=1080px of compression ratio
For 1080px × 720px.
Further, on the basis of embodiment shown in Fig. 1, as shown in figure 4, a kind of picture compression provided by the invention
Method, being applied to electronic equipment can also include: after obtaining targeted compression picture
S401: Target Photo is deleted.
After compressing Target Photo to obtain targeted compression picture, Target Photo can be deleted.
As a result, by deleting Target Photo, the occupancy of memory space is further reduced.
Further, on the basis of the embodiment shown in fig. 4, as shown in figure 5, a kind of picture compression provided by the invention
Method is applied to electronic equipment, can also include:
S501: being sent to server for the Target Photo, so that the server after receiving picture, is saved and received
The Target Photo arrived.
Wherein, the step S501 is executed before the step S401.
Before delete target picture, Target Photo can be sent to server to back up.
When user has use demand to Target Photo, Target Photo recovery request can be sent to server, so that clothes
Business device finds the Target Photo of itself storage, and Target Photo is sent to electronic equipment.
As a result, by the way that Target Photo is sent to server to realize the backup of Target Photo.
Relative to above method embodiment, the embodiment of the invention also provides a kind of picture compression devices, are applied to electronics
Equipment, as shown in fig. 6, the apparatus may include: obtain module 601, detection module 602 and the first compression module 603, wherein
The acquisition module 601, for obtaining Target Photo;
The detection module 602, for detecting whether the Target Photo needs to compress;
First compression module 603, for judging the feelings that the Target Photo needs to compress in the detection module 602
Under condition, according to the resolution ratio of the Target Photo and the resolution ratio of the electronic equipment, the Target Photo is compressed,
Obtain targeted compression picture.
It, can be according to the resolution ratio of picture and the resolution of electronic equipment using technical solution provided by the embodiment of the present invention
Relationship between rate, compresses picture, reduces the occupancy of memory space.
The detection module 602, can be specifically used for:
Judge whether the size of the Target Photo is greater than preset first threshold value;If so, determining that the Target Photo needs
It compresses.
The detection module 602, can be specifically used for:
Judge whether the short side resolution ratio of the Target Photo is greater than default third threshold value;If the Target Photo is short
Side resolution ratio is greater than default third threshold value, determines that the Target Photo needs to compress.
First compression module 603, can be specifically used for:
Judge whether the short side resolution ratio of the Target Photo is greater than the short side resolution ratio of the electronic equipment screen;
In the case where the short side resolution ratio of the Target Photo is greater than the short side resolution ratio of the electronic equipment screen, sentence
Whether the short side resolution ratio of the electronic equipment screen of breaking is less than the default third threshold value;
In the case where the short side resolution ratio of the electronic equipment screen is less than default third threshold value, by the Target Photo
Short side resolution compression to the default third threshold value, it is default to judge whether the long side resolution ratio of the Target Photo is not more than
Second threshold;
If so, the long side resolution compression of the Target Photo is obtained targeted compression to the default second threshold
Picture;
If not, the long side resolution ratio of the Target Photo is subjected to equal proportion compression according to short side compression ratio, it is described short
Side compression ratio is the compression ratio that the short side resolution compression is obtained to the default third threshold value, obtains targeted compression picture.
Further, on the basis of embodiment shown in Fig. 6, as shown in fig. 7, a kind of picture compression provided by the invention
Device is applied to electronic equipment, can also include:
Second compression module 701, for first compression module 603 the electronic equipment screen short side resolution ratio
In the case where more than or equal to default third threshold value, by the short side resolution compression of the Target Photo to the electronic equipment screen
Short side resolution ratio, judge whether the long side resolution ratio of the Target Photo is less than the default second threshold;
If so, the long side resolution compression of the Target Photo is obtained targeted compression to the default second threshold
Picture;
If not, the long side resolution ratio of the Target Photo is subjected to equal proportion compression according to short side compression ratio, it is described short
Side compression ratio is the compression ratio that the short side resolution ratio of the short side resolution compression to the electronic equipment screen obtains, and obtains mesh
Mark compressed picture.
As a result, in the case where the short side resolution ratio of electronic equipment screen is greater than preset threshold, differentiated according to Target Photo
The resolution ratio of rate and electronic equipment, Target Photo is compressed, and reduces the occupancy of memory space.
Further, on the basis of embodiment shown in Fig. 6, as shown in figure 8, a kind of picture compression provided by the invention
Device is applied to electronic equipment, can also include:
Removing module 801, for first compression module 603 after obtaining targeted compression picture, by the target
Picture is deleted.
As a result, by deleting Target Photo, reduce the occupancy of memory space.
Further, on the basis of embodiment shown in Fig. 8, as shown in figure 9, a kind of picture compression provided by the invention
Device is applied to electronic equipment, can also include:
Sending module 901, for the removing module 801 before deleting the Target Photo, by the target figure
Piece is sent to server, so that the server after receiving picture, saves the Target Photo received.
As a result, by the way that Target Photo is sent to server to realize the backup of Target Photo.
Correspondingly, as described in Figure 10, the embodiment of the present application also provides a kind of electronic equipment, the electronic equipment be can wrap
It includes:
Shell 1001, processor 1002, memory 1003, circuit board 1004 and power circuit 1005, wherein circuit board
1004 are placed in the space interior that shell surrounds, and processor 1002 and memory 1003 are arranged on circuit board 1004;Power supply electricity
Road 1005, for each circuit or the device power supply for electronic equipment;Memory 1003 is for storing executable program code;Place
Reason device 1002 is corresponding with executable program code to run by reading the executable program code stored in memory 1003
Program, for executing following steps:
Obtain Target Photo;
Detect whether the Target Photo needs to compress;
If so, according to the resolution ratio of the Target Photo and the resolution ratio of the electronic equipment, to the target figure
Piece is compressed, and targeted compression picture is obtained.
Correspondingly, the embodiment of the present application also provides a kind of storage mediums, wherein the storage medium applies journey for storing
Sequence, the application program for executing a kind of picture compression method method described herein at runtime.Wherein, the application institute
A kind of picture compression method stated, is applied to electronic equipment, and this method may include:
Obtain Target Photo;
Detect whether the Target Photo needs to compress;
If so, according to the resolution ratio of the Target Photo and the resolution ratio of the electronic equipment, to the target figure
Piece is compressed, and targeted compression picture is obtained.
Correspondingly, the embodiment of the present application also provides a kind of application programs, wherein the application program for holding at runtime
A kind of row picture compression method described herein.Wherein, a kind of picture compression method described herein, sets applied to electronics
Standby, this method may include:
Obtain Target Photo;
Detect whether the Target Photo needs to compress;
If so, according to the resolution ratio of the Target Photo and the resolution ratio of the electronic equipment, to the target figure
Piece is compressed, and targeted compression picture is obtained.
It should be noted that, in this document, relational terms such as first and second and the like are used merely to a reality
Body or operation are distinguished with another entity or operation, are deposited without necessarily requiring or implying between these entities or operation
In any actual relationship or order or sequence.Moreover, the terms "include", "comprise" or its any other variant are intended to
Non-exclusive inclusion, so that the process, method, article or equipment including a series of elements is not only wanted including those
Element, but also including other elements that are not explicitly listed, or further include for this process, method, article or equipment
Intrinsic element.In the absence of more restrictions, the element limited by sentence "including a ...", it is not excluded that
There is also other identical elements in process, method, article or equipment including the element.
Each embodiment in this specification is all made of relevant mode and describes, same and similar portion between each embodiment
Dividing may refer to each other, and each embodiment focuses on the differences from other embodiments.Especially for system reality
For applying example, since it is substantially similar to the method embodiment, so being described relatively simple, related place is referring to embodiment of the method
Part explanation.
The foregoing is merely illustrative of the preferred embodiments of the present invention, is not intended to limit the scope of the present invention.It is all
Any modification, equivalent replacement, improvement and so within the spirit and principles in the present invention, are all contained in protection scope of the present invention
It is interior.
Claims (13)
1. a kind of picture compression method, which is characterized in that be applied to electronic equipment, which comprises
Obtain Target Photo;
Detect whether the Target Photo needs to compress;
If so, according to the resolution ratio of the Target Photo and the resolution ratio of the electronic equipment, to the Target Photo into
Row compression, obtains targeted compression picture;
Wherein, described according to the resolution ratio of the Target Photo and the resolution ratio of the electronic equipment, to the Target Photo
It is compressed, comprising:
Judge whether the short side resolution ratio of the Target Photo is greater than the short side resolution ratio of the electronic equipment screen;
In the case where the short side resolution ratio of the Target Photo is greater than the short side resolution ratio of the electronic equipment screen, institute is judged
Whether the short side resolution ratio for stating electronic equipment screen is less than default third threshold value;
In the case where the short side resolution ratio of the electronic equipment screen is less than default third threshold value, by the short of the Target Photo
Side resolution compression judges whether the long side resolution ratio of the Target Photo is not more than default second to the default third threshold value
Threshold value;
If so, by the long side resolution compression of the Target Photo to the default second threshold;
If not, the long side resolution ratio of the Target Photo is carried out equal proportion compression, the short side pressure according to short side compression ratio
It contracts than the compression ratio obtained for the short side resolution compression to the default third threshold value.
2. being wrapped the method according to claim 1, wherein whether the detection Target Photo needs to compress
It includes:
Judge whether the size of the Target Photo is greater than preset first threshold value;If so, determining that the Target Photo needs to press
Contracting.
3. being wrapped the method according to claim 1, wherein whether the detection Target Photo needs to compress
It includes:
Judge whether the short side resolution ratio of the Target Photo is greater than default third threshold value;If the short side of the Target Photo point
Resolution is greater than default third threshold value, determines that the Target Photo needs to compress.
4. the method according to claim 1, wherein the electronic equipment screen short side resolution ratio be greater than etc.
In the case where default third threshold value, the method also includes:
By the short side resolution ratio of the short side resolution compression of the Target Photo to the electronic equipment screen, the target is judged
Whether the long side resolution ratio of picture is less than the default second threshold;
If so, by the long side resolution compression of the Target Photo to the default second threshold;
If not, the long side resolution ratio of the Target Photo is carried out equal proportion compression, the short side pressure according to short side compression ratio
It contracts than the compression ratio obtained for the short side resolution ratio of the short side resolution compression to the electronic equipment screen.
5. the method according to claim 1, wherein the method is also wrapped after obtaining targeted compression picture
It includes:
The Target Photo is deleted.
6. according to the method described in claim 5, it is characterized in that, the method is also before deleting the Target Photo
Include:
The Target Photo is sent to server so that the server after receiving picture, save receive it is described
Target Photo.
7. a kind of picture compression device, which is characterized in that be applied to electronic equipment, described device includes: to obtain module, detection mould
Block and the first compression module, wherein
The acquisition module, for obtaining Target Photo;
The detection module, for detecting whether the Target Photo needs to compress;
First compression module is used in the case where the detection module judges that the Target Photo needs to compress, according to
The resolution ratio of the resolution ratio of the Target Photo and the electronic equipment compresses the Target Photo, obtains target
Compressed picture;
Wherein, first compression module, is specifically used for:
Judge whether the short side resolution ratio of the Target Photo is greater than the short side resolution ratio of the electronic equipment screen;
In the case where the short side resolution ratio of the Target Photo is greater than the short side resolution ratio of the electronic equipment screen, institute is judged
Whether the short side resolution ratio for stating electronic equipment screen is less than default third threshold value;
In the case where the short side resolution ratio of the electronic equipment screen is less than default third threshold value, by the short of the Target Photo
Side resolution compression judges whether the long side resolution ratio of the Target Photo is not more than default second to the default third threshold value
Threshold value;
If so, the long side resolution compression of the Target Photo is obtained targeted compression picture to the default second threshold;
If not, the long side resolution ratio of the Target Photo is carried out equal proportion compression, the short side pressure according to short side compression ratio
It contracts than the compression ratio obtained for the short side resolution compression to the default third threshold value, obtains targeted compression picture.
8. device according to claim 7, which is characterized in that the detection module is specifically used for:
Judge whether the size of the Target Photo is greater than preset first threshold value;If so, determining that the Target Photo needs to press
Contracting.
9. device according to claim 7, which is characterized in that the detection module is specifically used for:
Judge whether the short side resolution ratio of the Target Photo is greater than default third threshold value;If the short side of the Target Photo point
Resolution is greater than default third threshold value, determines that the Target Photo needs to compress.
10. device according to claim 7, which is characterized in that described device further include:
Second compression module, the short side resolution ratio for first compression module in the electronic equipment screen are more than or equal in advance
If in the case where third threshold value, the short side of the short side resolution compression of the Target Photo to the electronic equipment screen is differentiated
Rate, judges whether the long side resolution ratio of the Target Photo is less than the default second threshold;
If so, the long side resolution compression of the Target Photo is obtained targeted compression picture to the default second threshold;
If not, the long side resolution ratio of the Target Photo is carried out equal proportion compression, the short side pressure according to short side compression ratio
It contracts than the compression ratio obtained for the short side resolution ratio of the short side resolution compression to the electronic equipment screen, obtains target pressure
Contract drawing piece.
11. device according to claim 7, which is characterized in that described device further include:
Removing module deletes the Target Photo for first compression module after obtaining targeted compression picture.
12. device according to claim 11, which is characterized in that described device further include:
The Target Photo is sent to clothes for the removing module before deleting the Target Photo by sending module
Business device, so that the server after receiving picture, saves the Target Photo received.
13. a kind of electronic equipment, which is characterized in that the electronic equipment includes:
Shell, processor, memory, circuit board and power circuit, wherein circuit board is placed in the space interior that shell surrounds,
Processor and memory setting are on circuit boards;Power circuit, for each circuit or the device power supply for electronic equipment;Storage
Device is for storing executable program code;Processor is run by reading the executable program code stored in memory and can
The corresponding program of program code is executed, for executing following steps:
Obtain Target Photo;
Detect whether the Target Photo needs to compress;
If so, according to the resolution ratio of the Target Photo and the resolution ratio of the electronic equipment, to the Target Photo into
Row compression, obtains targeted compression picture;
Wherein, described according to the resolution ratio of the Target Photo and the resolution ratio of the electronic equipment, to the Target Photo
It is compressed, comprising:
Judge whether the short side resolution ratio of the Target Photo is greater than the short side resolution ratio of the electronic equipment screen;
In the case where the short side resolution ratio of the Target Photo is greater than the short side resolution ratio of the electronic equipment screen, institute is judged
Whether the short side resolution ratio for stating electronic equipment screen is less than default third threshold value;
In the case where the short side resolution ratio of the electronic equipment screen is less than default third threshold value, by the short of the Target Photo
Side resolution compression judges whether the long side resolution ratio of the Target Photo is not more than default second to the default third threshold value
Threshold value;
If so, by the long side resolution compression of the Target Photo to the default second threshold;
If not, the long side resolution ratio of the Target Photo is carried out equal proportion compression, the short side pressure according to short side compression ratio
It contracts than the compression ratio obtained for the short side resolution compression to the default third threshold value.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610091441.6A CN105787868B (en) | 2016-02-18 | 2016-02-18 | Picture compression method and device and electronic equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610091441.6A CN105787868B (en) | 2016-02-18 | 2016-02-18 | Picture compression method and device and electronic equipment |
Publications (2)
Publication Number | Publication Date |
---|---|
CN105787868A CN105787868A (en) | 2016-07-20 |
CN105787868B true CN105787868B (en) | 2019-04-12 |
Family
ID=56402795
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201610091441.6A Expired - Fee Related CN105787868B (en) | 2016-02-18 | 2016-02-18 | Picture compression method and device and electronic equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN105787868B (en) |
Families Citing this family (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105872542B (en) | 2016-05-27 | 2019-02-15 | 北京金山安全软件有限公司 | Image compression method and device and electronic equipment |
CN109429067B (en) * | 2017-08-31 | 2022-10-25 | 腾讯科技(深圳)有限公司 | Dynamic picture compression method and device, computer equipment and storage medium |
CN109167919B (en) * | 2018-10-11 | 2020-05-15 | 北京文香信息技术有限公司 | Picture compression method and device |
CN109905466A (en) * | 2019-01-29 | 2019-06-18 | 广东淘家科技有限公司 | Picture upload, browsing method, device and storage medium |
CN109961438A (en) * | 2019-04-08 | 2019-07-02 | 武汉华工激光工程有限责任公司 | A kind of light spot image analysis method and device |
CN111354050A (en) * | 2020-02-25 | 2020-06-30 | 安徽以萨数据技术有限公司 | Android-based picture compression method and device and storage medium |
CN111708903A (en) * | 2020-06-17 | 2020-09-25 | 广东小天才科技有限公司 | Method and device for optimizing time consumption of picture searching, electronic equipment and storage medium |
CN112102320B (en) * | 2020-11-18 | 2021-02-05 | 粒子文化科技集团(杭州)股份有限公司 | Image compression method, image compression device, electronic device, and storage medium |
CN113038139B (en) * | 2021-03-25 | 2023-05-12 | 贵州电网有限责任公司 | Image compression method applied to machine inspection picture uploading |
Family Cites Families (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
EP2239703B1 (en) * | 2009-04-08 | 2014-10-29 | BlackBerry Limited | Method of sharing image based files between a group of communication devices |
CN102044058B (en) * | 2010-11-22 | 2012-11-21 | Tcl集团股份有限公司 | Method and system for processing pictures in electronic equipment, and electronic equipment |
CN103399802B (en) * | 2013-07-30 | 2018-02-16 | Tcl集团股份有限公司 | A kind of picture pre-add support method and device |
CN103647916A (en) * | 2013-12-06 | 2014-03-19 | 北京趣拿信息技术有限公司 | Picture storage method and apparatus thereof |
CN104572922A (en) * | 2014-12-27 | 2015-04-29 | 北京奇虎科技有限公司 | Image processing method and device based on mobile equipment |
CN105261050B (en) * | 2015-09-23 | 2018-09-14 | 北京金山安全软件有限公司 | Picture compression method and device and mobile terminal |
-
2016
- 2016-02-18 CN CN201610091441.6A patent/CN105787868B/en not_active Expired - Fee Related
Also Published As
Publication number | Publication date |
---|---|
CN105787868A (en) | 2016-07-20 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN105787868B (en) | Picture compression method and device and electronic equipment | |
CN104408428B (en) | Method and device for processing photos in same scene | |
US10834424B2 (en) | Method and device for compressing image, and electronic device | |
US20180239839A1 (en) | Method and Apparatus for Identifying To-Be-Cleaned Data, and Electronic Device | |
CN104104856A (en) | Image acquisition method and device and electronic device | |
CN104679459A (en) | Order printing system and order printing method | |
CN111149103A (en) | Electronic device | |
CN103647916A (en) | Picture storage method and apparatus thereof | |
CN111491097B (en) | Shooting method and mobile device | |
CN103020173A (en) | Video image information searching method and system for mobile terminal and mobile terminal | |
CN103677517A (en) | Method and device for searching pictures | |
EP2720181A2 (en) | Terminal and method for providing an electronic letter paper download service | |
CN105718142B (en) | A kind of status bar notification message display methods and mobile terminal | |
CN108228357B (en) | Memory cleaning method and mobile terminal | |
CN104144107A (en) | Method, device and system for achieving account noting | |
CN105549822B (en) | A kind of icon moving method and mobile terminal | |
US20140285421A1 (en) | Data communication method via touch surface | |
CN105007412A (en) | Photo storage method for mobile terminal | |
CN105740455B (en) | Picture deleting method and device and electronic equipment | |
CN111143293B (en) | Metadata acquisition method, device, equipment and computer readable storage medium | |
WO2014183711A1 (en) | Multi-media data backup method, user terminal and synchronizer | |
CN104580672A (en) | Information processing method and electronic equipment | |
CN103945120B (en) | Electronic equipment and information processing method | |
CN107656772B (en) | Face recognition method and related product | |
WO2020133434A1 (en) | Application control method and related device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant | ||
CF01 | Termination of patent right due to non-payment of annual fee | ||
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20190412 |