摘要 |
A method and an electronic device for adjusting a compression ratio of a JPEG image are used to adjust a size of a JPEG image file. The method includes the following steps. a raw image, a first compression parameter (SF1) and a second compression parameter (SF2) are obtained. Then, the first compression parameter and the second compression parameter is used to compress the raw image respectively to obtain a first file and a second file of the compressed raw image A target file size (Target) is set. The target file size, the size of the first file (FileSize1), and the size of the second file (FileSize2) are used to calculate a target compression parameter (NSF) that is generated according to the equation, log ( NSF ) = log ( SF 1 SF 2 ) log ( FileSize 1 FileSize 2 ) × log ( Target FileSize 1 ) + log ( SF 1 ) . Then, the target compression parameter is loaded to compress the raw image, so as to output a target image.
|