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

Pending Publication Date: 2022-02-22
福建天晴在线互动科技有限公司
View PDF0 Cites 0 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0004] The technical problem to be solved by the present invention is to provide a method for automatically compressing H5 pictures and the terminal to process pictures locally, and to solve the problem that the picture processing server occupies relatively high resources

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • H5 picture automatic compression method and terminal
  • H5 picture automatic compression method and terminal
  • H5 picture automatic compression method and terminal

Examples

Experimental program
Comparison scheme
Effect test

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...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

PUM

No PUM Login to view more

Abstract

The invention provides an H5 picture automatic compression method and a terminal, and the method comprises the steps of obtaining an original picture, and reading the information of the original picture, the information of the original picture comprising the size information of the original picture; creating a canvas element of a first preset size, putting the original picture into the canvas element, and adjusting the original picture according to the original picture information and the first preset size; reading preset target picture size information, and generating a corresponding compression ratio according to a corresponding relationship between the target picture size information and the original picture size information; according to the compression ratio, compressing the canvas element to obtain a compressed picture, and uploading the compressed picture to a server. According to the invention, the original picture is compressed and uploaded to the server side on the downstream terminal of the server side, the pressure of the picture processing server is shared, and the problem that the picture processing efficiency of the picture processing server is low in a large reading scene or a large writing scene is solved.

Description

technical field [0001] The present invention relates to the field of web page display, in particular to a method for automatically compressing H5 pictures and a terminal. Background technique [0002] For mass image storage and download display, it is necessary to store more image files on a storage with a certain capacity, and to achieve higher image quality when displayed to users, and to use images of a certain quality for different scenarios; usually adopt The way to compress the original picture is to be able to accommodate more pictures in a certain storage capacity, that is, the purpose of compressing the original picture is to reduce the size of the picture file. In the case of the same bandwidth, the smaller the picture file is on the client side The shorter the network download time when displayed. [0003] In the prior art, the uploaded pictures are usually compressed on a dedicated picture processing server, so as to generate pictures of different quality and si...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

Application Information

Patent Timeline
no application Login to view more
IPC IPC(8): G06T3/40
CPCG06T3/40
Inventor 刘德建林琛陈波伍张发
Owner 福建天晴在线互动科技有限公司
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Try Eureka
PatSnap group products