CN108650435A - A kind of picture multistage limiting file size threshold values in browser end is guaranteed the quality compression method - Google Patents
A kind of picture multistage limiting file size threshold values in browser end is guaranteed the quality compression method Download PDFInfo
- Publication number
- CN108650435A CN108650435A CN201810531152.2A CN201810531152A CN108650435A CN 108650435 A CN108650435 A CN 108650435A CN 201810531152 A CN201810531152 A CN 201810531152A CN 108650435 A CN108650435 A CN 108650435A
- Authority
- CN
- China
- Prior art keywords
- original image
- image file
- pixel
- size
- file
- 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
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N1/00—Scanning, transmission or reproduction of documents or the like, e.g. facsimile transmission; Details thereof
- H04N1/32—Circuits or arrangements for control or supervision between transmitter and receiver or between image input and image output device, e.g. between a still-image camera and its memory or between a still-image camera and a printer device
- H04N1/32101—Display, printing, storage or transmission of additional information, e.g. ID code, date and time or title
- H04N1/32144—Display, printing, storage or transmission of additional information, e.g. ID code, date and time or title embedded in the image data, i.e. enclosed or integrated in the image, e.g. watermark, super-imposed logo or stamp
- H04N1/32149—Methods relating to embedding, encoding, decoding, detection or retrieval operations
- H04N1/32267—Methods relating to embedding, encoding, decoding, detection or retrieval operations combined with processing of the image
- H04N1/32277—Compression
Abstract
The invention discloses a kind of picture multistages limiting file size threshold values in browser end to guarantee the quality compression method, it is included in browser client selection original image file, judge whether the pixel size of original image file is more than the pixel value of default, if so, the pixel to original image file carries out multi-stage compression processing;Pixel multi-stage compression will be passed through, and treated that original image file is converted into binary data, judge whether the size of the binary data is more than the data value of default, if so, generating implements spatial scalable compression rate according to the data value of the aberration of the original image file and default and carrying out multi-stage compression processing to the size of the binary data according to implements spatial scalable compression rate;It will treated that binary data coding forms new Target Photo file by size multi-stage compression, and the Target Photo file is uploaded to server, the present invention pre-processes picture before the upload of browser client picture, effectively reduces server-side processing pressure.
Description
Technical field
The present invention relates to computer realm, especially a kind of picture multistage limiting file size threshold values in browser end is protected
Matter compression method.
Background technology
Picture upload is a basic function being widely applied to of modern web exploitations.With the raising of camera pixel,
Picture file volume is bigger than normal, and different business scenarios is widely different to the requirement of picture file size dimension, for different business field
The picture file that scape uploads different volumes size is strong demand, and current existing most of picture file compression schemes are all that will use
Family original image is uploaded directly into after-treatment after server, the disadvantage is that original image file is larger, general general network uplink
Speed is all slow, therefore partially slow to the picture file upload procedure of large volume, also consumes more bandwidth traffics, is serviced
The after-treatment transcoding compression at end then occupies server resource, when high concurrent accesses particularly to server resource consumption
Obviously, on the other hand, market small part is all based on common mass percent pattern in the picture preprocess method of browser end
Picture is compressed, directly effectively picture file volume size can not be limited in effective threshold value.
Invention content
In order to solve the above technical problems, limiting file size threshold values in browser end the object of the present invention is to provide a kind of
Picture multistage is guaranteed the quality compression method.
The technical solution adopted by the present invention is:
A kind of picture multistage limiting file size threshold values in browser end is guaranteed the quality compression method, including:In browser visitor
Family end selects original image file, judges whether the pixel size of original image file is more than the pixel value of default, if former
The pixel size of beginning picture file is more than the pixel value of default, then is carried out at multi-stage compression to the pixel of original image file
Reason;Pixel multi-stage compression will be passed through, and treated that original image file is converted into binary data, judges the binary data
Whether size is more than the data value of default, if the size of binary data is more than the data value of default, basis should
The data value of the aberration of original image file and default generate implements spatial scalable compression rate and according to implements spatial scalable compression rate to this two into
The size of data processed carries out multi-stage compression processing;It will treated that binary data coding formed is new by size multi-stage compression
Target Photo file, and the Target Photo file is uploaded to server.
Carrying out multi-stage compression processing to the pixel of original image file includes:Total scaling ratio is generated, original image is chosen
Arbitrary one side of file, according in any one edge lengths of original image file pixel value and system in set in the edge lengths
Pixel value be compared, obtain total scaling ratio;Classification scaling ratio is generated, is generated according to total scaling ratio and scaling number
Classification scaling ratio;Multi-stage compression is handled, according to scaling number and classification scaling ratio to the pixel of original image file into
Row multi-stage compression is handled.
Beneficial effects of the present invention:
The present invention pre-processes picture before the upload of browser client picture, effectively reduces server-side processing pressure
Power;Setting value is flexibly first arranged according to practical application request system before compression and carries out the plan of multi-stage compression according to these setting values
Slightly, it is ensured that in the case of the picture quality for reaching requirement, significantly compressed picture size, then by compressed picture, then on
Server is passed, opposite artwork volume smaller, uploading speed is faster.
Description of the drawings
The specific implementation mode of the present invention is described further below in conjunction with the accompanying drawings.
Fig. 1 is the logic diagram of the present invention.
Specific implementation mode
The compression method as shown in Figure 1, a kind of picture multistage limiting file size threshold values in browser end is guaranteed the quality, including:
Original image file is selected in browser client, judges whether the pixel size of original image file is more than the picture of default
Element value carries out the pixel of original image file if the pixel size of original image file is more than the pixel value of default
Multi-stage compression is handled;Pixel multi-stage compression will be passed through, and treated that original image file is converted into binary data, judge this two
Whether the size of binary data is more than the data value of default, if the size of binary data is more than the data of default
Value, then according to the data value of the aberration of the original image file and default generation implements spatial scalable compression rate and according to implements spatial scalable compression
Rate carries out multi-stage compression processing to the size of the binary data;Size multi-stage compression treated binary data will be passed through to compile
Code forms new Target Photo file, and the Target Photo file is uploaded to server.In the present embodiment, original image text
For the aberration value of part between 0-1, which determines the image quality quality of picture by controlling the dynamics of aberration, is worth smaller dynamics
It is bigger.
Carrying out multi-stage compression processing to the pixel of original image file includes:Total scaling ratio is generated, original image is chosen
Arbitrary one side of file, according in any one edge lengths of original image file pixel value and system in set in the edge lengths
Pixel value be compared, obtain total scaling ratio, such as original image file is 500*400,250*100 picture of boil down to
Element can zoom in and out when zooming in and out according to this edge that numerical value is 500, and total ratio that scales is:250/500=50%;It generates
Classification scaling ratio, generate classification scaling ratio according to total scaling ratio and scaling number is if always scaling ratio is 50%
The scaling number of system setting is 5 times, then it is 10% to be classified scaling ratio;Multi-stage compression is handled, according to scaling number and classification
It scales ratio and multi-stage compression processing is carried out to the pixel of original image file, above-mentioned example is to carry out 5 wheel compressions, per second compression
10%.It is that system is calculated according to original image file that number is scaled in this implementation, because picture has wide high two sides, noise
With each compression ratio at n2Relationship, scale that time numerical value is smaller, and single compression ratio is bigger, and picture noise value is higher;Scale number
Value is bigger, and single compression ratio is smaller, and picture noise value is smaller, but because the number zoomed in and out is more, more time-consuming, processing effect
Rate is lower.So scaling time numerical value is nor be the bigger the better.Such as:Original image file size is 500px, Target Photo file
Size is 250px, if only carrying out 1 scaling 50%, 500px is just compressed to 250px, then noise value is (0.5)2=0.25
Noise value;If carrying out 2 scalings, 25% is scaled every time, the calculation of noise value is:1st scaling 0.25*0.25=
0.0625 noise value, the 2nd scaling (0.25/ (1-0.25))2=0.11 noise value, 2 times total noise value is:0.0625
The noise value of+0.11=0.1625,0.1625 is less than 0.25, carries out the noise value after 2 scalings and is less than 1 scaling of only progress
Noise value.
The foregoing is merely the preferred embodiments of the present invention, and the present invention is not limited to the above embodiments, as long as with
Essentially identical means realize that the technical solution of the object of the invention belongs within protection scope of the present invention.
Claims (2)
- The compression method 1. a kind of picture multistage limiting file size threshold values in browser end is guaranteed the quality, which is characterized in that including:Original image file is selected in browser client, judges whether the pixel size of original image file is more than default Pixel value, if the pixel size of original image file be more than default pixel value, to the pixel of original image file Carry out multi-stage compression processing;Pixel multi-stage compression will be passed through, and treated that original image file is converted into binary data, judges the binary data Whether size is more than the data value of default, if the size of binary data is more than the data value of default, basis should The data value of the aberration of original image file and default generate implements spatial scalable compression rate and according to implements spatial scalable compression rate to this two into The size of data processed carries out multi-stage compression processing;It will be by size multi-stage compression treated binary data coding formed new Target Photo file, and by the target figure Piece file is uploaded to server.
- The compression side 2. a kind of picture multistage limiting file size threshold values in browser end according to claim 1 is guaranteed the quality Method, it is characterised in that:Carrying out multi-stage compression processing to the pixel of original image file includes:Total scaling ratio is generated, arbitrary one side of original image file is chosen, according to any one edge lengths of original image file On pixel value be compared with the pixel value set in the edge lengths in system, obtain total scaling ratio;Classification scaling ratio is generated, classification scaling ratio is generated according to total scaling ratio and scaling number;Multi-stage compression is handled, root Multi-stage compression processing is carried out to the pixel of original image file according to scaling number and classification scaling ratio.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810531152.2A CN108650435A (en) | 2018-05-29 | 2018-05-29 | A kind of picture multistage limiting file size threshold values in browser end is guaranteed the quality compression method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810531152.2A CN108650435A (en) | 2018-05-29 | 2018-05-29 | A kind of picture multistage limiting file size threshold values in browser end is guaranteed the quality compression method |
Publications (1)
Publication Number | Publication Date |
---|---|
CN108650435A true CN108650435A (en) | 2018-10-12 |
Family
ID=63758599
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201810531152.2A Pending CN108650435A (en) | 2018-05-29 | 2018-05-29 | A kind of picture multistage limiting file size threshold values in browser end is guaranteed the quality compression method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN108650435A (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109769121A (en) * | 2018-12-12 | 2019-05-17 | 四川商通实业有限公司 | A kind of iOS low distortion network picture compression method and system |
CN110838151A (en) * | 2019-11-12 | 2020-02-25 | 南京甄视智能科技有限公司 | Image compression processing method and device based on polynomial fitting, computer system, server and readable storage medium |
CN111414214A (en) * | 2019-01-07 | 2020-07-14 | 珠海金山办公软件有限公司 | Document compression method and device, electronic equipment and computer storage medium |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20100119156A1 (en) * | 2007-07-20 | 2010-05-13 | Fujifilm Corporation | Image processing apparatus, image processing method, image processing system and computer readable medium |
CN102508851A (en) * | 2011-09-27 | 2012-06-20 | 深圳市五巨科技有限公司 | Image upload processing method and image upload processing system |
CN105243638A (en) * | 2015-09-25 | 2016-01-13 | 腾讯科技(深圳)有限公司 | Image uploading method and apparatus |
CN105844588A (en) * | 2016-03-17 | 2016-08-10 | 广州筷子信息科技有限公司 | Method and system for intelligent scalable compression of creative images |
CN107395716A (en) * | 2017-07-19 | 2017-11-24 | 河南神州数码索贝科技有限公司 | A kind of mobile terminal picture compression method for uploading and device |
-
2018
- 2018-05-29 CN CN201810531152.2A patent/CN108650435A/en active Pending
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20100119156A1 (en) * | 2007-07-20 | 2010-05-13 | Fujifilm Corporation | Image processing apparatus, image processing method, image processing system and computer readable medium |
CN102508851A (en) * | 2011-09-27 | 2012-06-20 | 深圳市五巨科技有限公司 | Image upload processing method and image upload processing system |
CN105243638A (en) * | 2015-09-25 | 2016-01-13 | 腾讯科技(深圳)有限公司 | Image uploading method and apparatus |
CN105844588A (en) * | 2016-03-17 | 2016-08-10 | 广州筷子信息科技有限公司 | Method and system for intelligent scalable compression of creative images |
CN107395716A (en) * | 2017-07-19 | 2017-11-24 | 河南神州数码索贝科技有限公司 | A kind of mobile terminal picture compression method for uploading and device |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109769121A (en) * | 2018-12-12 | 2019-05-17 | 四川商通实业有限公司 | A kind of iOS low distortion network picture compression method and system |
CN111414214A (en) * | 2019-01-07 | 2020-07-14 | 珠海金山办公软件有限公司 | Document compression method and device, electronic equipment and computer storage medium |
CN110838151A (en) * | 2019-11-12 | 2020-02-25 | 南京甄视智能科技有限公司 | Image compression processing method and device based on polynomial fitting, computer system, server and readable storage medium |
CN110838151B (en) * | 2019-11-12 | 2020-07-03 | 南京甄视智能科技有限公司 | Picture compression processing method, computer system and readable storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10834415B2 (en) | Devices for compression/decompression, system, chip, and electronic device | |
CN108650435A (en) | A kind of picture multistage limiting file size threshold values in browser end is guaranteed the quality compression method | |
CN110267037B (en) | Video encoding method, video encoding device, electronic equipment and computer-readable storage medium | |
CN107016437B (en) | Method and system for random spike pattern generation | |
CN105553937B (en) | The system and method for data compression | |
CN109952708A (en) | Lossless data compression | |
CN111182303A (en) | Encoding method and device for shared screen, computer readable medium and electronic equipment | |
US20230386002A1 (en) | Shadow elimination method and apparatus for text image, and electronic device | |
WO2020238439A1 (en) | Video quality-of-service enhancement method under restricted bandwidth of wireless ad hoc network | |
WO2021031877A1 (en) | Methods and apparatus for image coding and decoding, and chip | |
CN106993190B (en) | Software-hardware synergism coding method and system | |
JP2798172B2 (en) | Image encoding / decoding device | |
CN103546161A (en) | Lossless compression method based on binary processing | |
CN112449009A (en) | SVD-based federated learning recommendation system communication compression method and device | |
WO2022000298A1 (en) | Reinforcement learning based rate control | |
Hu et al. | Fvc: An end-to-end framework towards deep video compression in feature space | |
CN112308096A (en) | Image recognition method and device, computer equipment and storage medium | |
US20190279330A1 (en) | Watermark embedding method and apparatus | |
Zhu et al. | A semantic-aware transmission with adaptive control scheme for volumetric video service | |
CN103793873A (en) | Obtaining method and device for image pixel mid value | |
CN112350998B (en) | Video streaming transmission method based on edge calculation | |
CN115866253B (en) | Inter-channel conversion method, device, terminal and medium based on self-modulation | |
CN104182928A (en) | Quick polygon fill method of vectorgraph | |
CN110647396A (en) | Method for realizing intelligent application of end cloud cooperative low-power consumption and limited bandwidth | |
CN110674796B (en) | Texture brick decompression 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: 20181012 |