H5 picture automatic compression method and terminal
A compression method and image technology, applied in image data processing, graphic image conversion, instruments, etc., can solve the problem of image processing server occupying high resources, achieve the effect of reducing pressure and convenient processing
- Summary
- Abstract
- Description
- Claims
- Application Information
AI Technical Summary
Problems solved by technology
Method used
Image
Examples
Embodiment 1
[0075] Please refer to figure 1 , Embodiment 1 of the present invention is:
[0076] A method for automatically compressing H5 pictures, specifically comprising:
[0077] S1. Acquire the original picture and read the original picture information. The original picture information includes the original picture name (fileName), original picture size information, and original picture orientation information (orientation);
[0078] Original picture size information includes original picture space occupancy information (fileSize), original picture length information (length) and original picture width information (width);
[0079] In an optional implementation, the user selects a local picture as the original picture through the client;
[0080] S2. Create a canvas element (Canvas) of a first preset size, put the original picture into the canvas element, and adjust the original picture according to the original picture information and the first preset size;
[0081] Wherein, adju...
Embodiment 2
[0096] Please refer to image 3 , the second embodiment of the present invention is:
[0097] A kind of H5 picture automatic compression method, its difference with embodiment one is, S3 is specifically:
[0098] Read a plurality of preset target picture size information, and generate a compression ratio corresponding to each target picture size information according to a correspondence relationship between each target picture size information and the original picture size information;
[0099] Multiple target picture size information includes at least maximum picture space occupancy information and minimum picture size information;
[0100] The S4 is specifically:
[0101] Using multiple compression ratios as parameters respectively, execute the compression method toDataURL of the canvas element to obtain multiple compressed pictures corresponding to the target picture size information;
[0102] Determining corresponding quality grade labels for a plurality of compressed p...
Embodiment 3
[0116] Please refer to figure 2 , Embodiment three of the present invention is:
[0117] An H5 picture automatic compression terminal 1, comprising a processor 2, a memory 3 and a computer program stored on the memory 3 and operable on the processor 2, the processor 2 implements the embodiment when executing the computer program Each step in one or embodiment two;
[0118] In an optional implementation manner, an H5 image automatic compression terminal 1 is an H5 client.
[0119] To sum up, the present invention provides a method and terminal for automatically compressing H5 images, which compresses original images through local canvas elements, sets canvas elements of preset sizes, and completes preliminary unification of original images of different sizes. It is convenient to carry out subsequent processing on the original image, preset the size information of the target image, and generate the corresponding compression ratio according to the corresponding relationship be...
PUM
Abstract
Description
Claims
Application Information
- R&D Engineer
- R&D Manager
- IP Professional
- Industry Leading Data Capabilities
- Powerful AI technology
- Patent DNA Extraction
Browse by: Latest US Patents, China's latest patents, Technical Efficacy Thesaurus, Application Domain, Technology Topic, Popular Technical Reports.
© 2024 PatSnap. All rights reserved.Legal|Privacy policy|Modern Slavery Act Transparency Statement|Sitemap|About US| Contact US: help@patsnap.com