Picture compression method and device, equipment and storage medium
By responding to the user's request on the client display screen, the image to be compressed is obtained and scaled according to the preset size, displayed to the user for selection and compression, and an online link is generated, which solves the problem that the image compression method in the existing technology cannot meet the user's advanced processing needs. problem, improving the user's work efficiency and image processing efficiency.
Patent Information
- Application Number
- CN202410767977.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-14
- Publication Date
- 2024-10-15
AI Technical Summary
Existing image compression methods cannot meet users' advanced processing needs, cannot facilitate users to select and quickly open compressed images, and affect users' work efficiency.
By responding to user requests on the client display, the image to be compressed is obtained and scaled according to the preset size, displayed to the user for selection, and compressed after the user selects it, and an online link is generated to facilitate search and storage.
The image compression interface is clean and unified, making it convenient for users to search and operate, and improving user work efficiency and image processing efficiency.
Smart Images

Figure CN118780976A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of image compression, and in particular to an image compression method, apparatus, device and storage medium. Background Art
[0002] Nowadays, image processing technology is becoming more and more mature, and its application scenarios are becoming more and more extensive. Therefore, users' requirements for basic image processing capabilities in the early stage are gradually increasing in order to ensure the efficiency of image processing in the later stage.
[0003] Existing image compression methods usually only meet the basic requirements of users and cannot provide users with more functions. For example, it is not convenient for users to select the pictures they want to compress, and it is not possible for users to quickly open the compressed pictures, which affects the work efficiency of users. Summary of the invention
[0004] In view of this, the present application provides a picture compression method, apparatus, device and storage medium, which are used to address the problem that existing image compression methods usually only meet the basic requirements of users, cannot provide users with more functions, and affect users' work efficiency.
[0005] To achieve the above objectives, the proposed solution is as follows:
[0006] In a first aspect, a method for compressing an image includes:
[0007] In response to a request instruction for image compression initiated by a user on a display screen of a client, one or more images to be compressed are obtained;
[0008] Scaling each of the to-be-compressed pictures according to a preset size to obtain first pictures corresponding to each of the to-be-compressed pictures;
[0009] Displaying each of the first pictures on a display screen of the client so that the user can select each of the first pictures, and using the pictures selected by the user from each of the first pictures as each of the second pictures;
[0010] Compressing each of the second pictures respectively, and aggregating the compressed second pictures into a compressed package;
[0011] An online link corresponding to the compressed package is generated, and the online link is displayed on a display screen of the client.
[0012] Preferably, scaling each of the to-be-compressed pictures according to a preset size to obtain each first picture corresponding to each of the to-be-compressed pictures includes:
[0013] Obtaining the size of each of the to-be-compressed pictures, and determining whether the size of each of the to-be-compressed pictures is greater than the preset size;
[0014] If yes, the image with the smallest size is used as the minimum image, and the size of the minimum image is used as the target size;
[0015] Except for the smallest picture, the remaining pictures to be compressed are reduced according to the target size, and the reduced pictures to be compressed and the smallest picture are used as the first picture.
[0016] Preferably, it also includes:
[0017] If there are pictures to be compressed whose size is not greater than the preset size, then calculating the average value of the sizes of all pictures to be compressed;
[0018] Each of the to-be-compressed pictures is scaled according to the average value to obtain first pictures.
[0019] Preferably, displaying each of the first pictures on a display screen of the client includes:
[0020] Determining content information of each of the first pictures;
[0021] Randomly select a first picture as a target picture, and match content information of other first pictures with content information of the target picture to determine similarity;
[0022] Using the same label to mark the target image and each first image whose similarity to the target image is greater than a preset similarity threshold;
[0023] Taking each unmarked first picture as each new first picture, and returning to execute the step of arbitrarily selecting a first picture as the target picture until all the first pictures are marked;
[0024] The first pictures are displayed sequentially on the display screen of the client according to the marked order.
[0025] Preferably, the compressing each of the second images separately and aggregating the compressed second images into a compressed package includes:
[0026] Sending each of the second pictures to a backend server connected to the client, so that the backend server converts each of the second pictures into a corresponding byte stream, and calls a target interface to compress the byte stream corresponding to each of the second pictures, respectively, to obtain each compressed second picture, and sends the compressed second picture;
[0027] The compressed second pictures sent by the back-end server are aggregated into a compressed package.
[0028] Preferably, generating an online link corresponding to the compressed package includes:
[0029] Using the picture contained in the compressed package as the third picture;
[0030] Determine the number of the third pictures and the naming information of each of the third pictures;
[0031] Convert the number of the third picture into a first barcode;
[0032] Determine the second barcode according to the naming information of each of the third pictures;
[0033] Concatenate the first barcode and the second barcode to obtain a third barcode;
[0034] An online link corresponding to the compressed package is generated based on the third barcode.
[0035] Preferably, the content information includes picture type, picture name and picture color.
[0036] In a second aspect, a picture compression device includes:
[0037] The module for acquiring images to be compressed is used to obtain one or more images to be compressed in response to a request instruction for image compression initiated by a user on a display screen of a client;
[0038] A modification module, used for scaling each of the to-be-compressed pictures according to a preset size to obtain each first picture corresponding to each of the to-be-compressed pictures;
[0039] A selection module, configured to display each of the first pictures on a display screen of the client so that the user can select each of the first pictures, and use the pictures selected by the user from each of the first pictures as each of the second pictures;
[0040] A compression module, used to compress each of the second pictures respectively, and aggregate the compressed second pictures into a compressed package;
[0041] The link generation module is used to generate an online link corresponding to the compressed package and display the online link on the display screen of the client.
[0042] In a third aspect, a picture compression device includes a memory and a processor;
[0043] The memory is used to store programs;
[0044] The processor is used to execute the program to implement the various steps of the image compression method as described in the first aspect.
[0045] In a fourth aspect, a storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the image compression method described in the first aspect are implemented.
[0046] It can be seen from the above technical scheme that the present application obtains one or more images to be compressed by responding to the request instruction for image compression initiated by the user on the display screen of the client; scales each of the images to be compressed according to the preset size to obtain each first image corresponding to each of the images to be compressed; displays each of the first images on the display screen of the client for the user to select each of the first images, and uses the images selected by the user from each of the first images as each of the second images; compresses each of the second images respectively, and summarizes the compressed second images into a compressed package; generates an online link corresponding to the compressed package, and displays the online link on the display screen of the client. This scheme modifies each of the images to be compressed according to the preset size, such as by scaling or reducing, etc., so that when there are a large number of images to be compressed, they can be made of a uniform size and displayed on the display screen, so that the image compression interface can be neat and uniform, which is convenient for users to find the images they want to compress. In addition, after compression, an online link corresponding to the compressed package is generated, which is convenient for users to search for images. This scheme provides users with a convenient and multifunctional image compression method, which greatly improves the user's work efficiency and image processing efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0048] Figure 1 An optional flow chart of a picture compression method provided in an embodiment of the present application;
[0049] Figure 2 A schematic diagram of a picture compression scenario provided in an embodiment of the present application;
[0050] Figure 3 A schematic diagram of the structure of a picture compression device provided in an embodiment of the present application;
[0051] Figure 4 A schematic diagram of the structure of an image compression device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0052] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0053] Nowadays, image processing technology is becoming more and more mature, and its application scenarios are becoming more and more extensive. Therefore, users' requirements for basic image processing capabilities in the early stage are gradually increasing in order to ensure the efficiency of image processing in the later stage.
[0054] Existing image compression methods usually only meet the basic requirements of users and cannot provide users with more functions. For example, it is not convenient for users to select the pictures they want to compress, and it is not possible for users to quickly open the compressed pictures, which affects the work efficiency of users.
[0055] In order to solve the above defects, an embodiment of the present invention provides an image compression method, which can be applied to various computer terminals or smart terminals, and its execution subject can be a processor or server of the computer terminal or smart terminal. The method flow chart of the method is as follows Figure 1 As shown, specifically including:
[0056] S1: In response to a request instruction for image compression initiated by a user on a display screen of a client, one or more images to be compressed are obtained.
[0057] This solution can be applied to any image compression software. When the user opens the image compression software on the client, a request instruction for image compression can be initiated on the display screen, such as clicking an image compression button. At this time, the client will obtain each image to be compressed.
[0058] The one or more images to be compressed are uploaded to the client by the user in advance. For example, the user wants to compress these images, and the user's compression requirements are not single, such as compressing only one of the photos, or compressing several photos together, and compressing several other photos together, etc. Therefore, a multi-functional compression method is needed to meet the user's needs. Therefore, after obtaining each image to be compressed, it is not directly compressed.
[0059] S2: scaling each of the to-be-compressed pictures according to a preset size to obtain first pictures corresponding to each of the to-be-compressed pictures.
[0060] If there are a large number of pictures to be compressed, they may be of different sizes, which makes it inconvenient for users to filter the pictures to be compressed on the display screen, nor is it convenient for users to compare the pictures to be compressed. Therefore, this application pre-sets a size and modifies each picture to be compressed according to this size.
[0061] The modification method can be to modify the size of each image to be compressed to the preset size, or to reduce the size of a larger image based on the preset size but not modify it to the preset size, or to enlarge a smaller image based on the preset size, etc. This embodiment does not impose any restrictions on this.
[0062] S3: Displaying each of the first pictures on the display screen of the client so that the user can select each of the first pictures, and using the pictures selected by the user from each of the first pictures as each of the second pictures.
[0063] The purpose of displaying each first picture on the client's display screen is to provide users with a second chance to choose. First, the user selects some pictures as pictures to be compressed. Then, before entering the compression process, the user can also perform a second screening, that is, display each picture to be compressed on the client's display screen. The user can choose the pictures that really need to be compressed, or choose which pictures to compress together, etc. The user can also be provided with an opportunity to edit the pictures, for example, before compression, edit each / several pictures, including color adjustment, rendering, etc., to achieve multi-functions and give users more choices.
[0064] Therefore, each picture selected by the user is used as each picture.
[0065] S4: compress each of the second pictures respectively, and aggregate the compressed second pictures into a compressed package.
[0066] After the user selects the second picture, the compression operation can be performed, and the compressed second pictures can be aggregated into a compressed package to facilitate storage, sending, etc. by the user.
[0067] S5: Generate an online link corresponding to the compressed package, and display the online link on the display screen of the client.
[0068] In order to enable users to quickly apply the compressed second image, for example, the user who initiates the image compression can send the compressed package to other users after obtaining the compressed package, or the user can save the compressed package more conveniently and quickly for subsequent retrieval and use, this solution can generate an online link corresponding to the compressed package, and the user can directly click on the online link to enter the compressed package and obtain the image.
[0069] It can be seen from the above technical scheme that the present application obtains one or more images to be compressed by responding to the request instruction for image compression initiated by the user on the display screen of the client; scales each of the images to be compressed according to the preset size to obtain each first image corresponding to each of the images to be compressed; displays each of the first images on the display screen of the client for the user to select each of the first images, and uses the images selected by the user from each of the first images as each of the second images; compresses each of the second images respectively, and summarizes the compressed second images into a compressed package; generates an online link corresponding to the compressed package, and displays the online link on the display screen of the client. This scheme modifies each of the images to be compressed according to the preset size, such as by scaling or reducing, etc., so that when there are a large number of images to be compressed, they can be made of a uniform size and displayed on the display screen, so that the image compression interface can be neat and uniform, which is convenient for users to find the images they want to compress. In addition, after compression, an online link corresponding to the compressed package is generated, which is convenient for users to search for images. This scheme provides users with a convenient and multifunctional image compression method, which greatly improves the user's work efficiency and image processing efficiency.
[0070] In the method provided in the embodiment of the present invention, the process of scaling each of the to-be-compressed pictures according to a preset size to obtain each of the first pictures corresponding to each of the to-be-compressed pictures is specifically described as follows:
[0071] Obtaining the size of each of the to-be-compressed pictures, and determining whether the size of each of the to-be-compressed pictures is greater than the preset size;
[0072] If the size of each image to be compressed is larger than the preset size, the image with the smallest size is used as the smallest image, and the size of the smallest image is used as the target size;
[0073] Except for the smallest picture, the remaining pictures to be compressed are reduced according to the target size, and the reduced pictures to be compressed and the smallest picture are used as the first picture;
[0074] If there are pictures to be compressed whose size is not greater than the preset size, then calculating the average value of the sizes of all pictures to be compressed;
[0075] Each of the to-be-compressed pictures is scaled according to the average value to obtain first pictures.
[0076] Specifically, the above process illustrates a modification operation process for each picture to be compressed, which can facilitate the user to select each picture to be compressed, which may include modification of the picture size, editing of the specific content of the picture, etc.
[0077] Optionally, in order to make the selection more intuitive for the user, the size of each image to be compressed can be modified to the same size, so first you need to get the size of each image to be compressed. It should be noted that some images to be compressed may be too large or too small compared to other images to be compressed, so in order to ensure that the image is not distorted, you need to set a preset size, which is the lower limit of the size of the image to be compressed. If the size of each image to be compressed is larger than this preset size, then determine the image to be compressed with the smallest size as the smallest image, and use the size of the smallest image as the target size. Except for the smallest image, reduce the size of all other images to be compressed to this target size.
[0078] If the size of one or more images to be compressed is smaller than the preset size, it means that the sizes of these images are too small. If the other images to be compressed are still reduced according to the minimum size, it may cause distortion to other images to be compressed, and even make it inconvenient for users to view and select images. Therefore, the average value of the size can be calculated and the sizes of all images to be compressed can be modified to this average value.
[0079] After obtaining each first picture, it is necessary to display each first picture on the client's display screen for user selection. In order to enable users to clearly select pictures, the naming information of each first picture can be obtained, and then the naming information is also displayed on the display screen, specifically on the upper side of each corresponding first picture.
[0080] The above scheme describes the process of scaling each of the images to be compressed according to a preset size in this application to obtain each first image corresponding to each of the images to be compressed. The following describes in detail the steps of displaying each of the first images on the display screen of the client in this application.
[0081] Determining content information of each of the first pictures;
[0082] Randomly select a first picture as a target picture, and match content information of other first pictures with content information of the target picture to determine similarity;
[0083] Using the same label to mark the target image and each first image whose similarity to the target image is greater than a preset similarity threshold;
[0084] Taking each unmarked first picture as each new first picture, and returning to execute the step of arbitrarily selecting a first picture as the target picture until all the first pictures are marked;
[0085] The first pictures are displayed sequentially on the display screen of the client according to the marked order.
[0086] Content information includes picture type, picture name, picture color, etc. Specifically, when displaying each first picture, each first picture can be classified, such as by specific content of the picture, or by picture name, and pictures belonging to the same category can be displayed in a close position, which can facilitate user selection and save time. The content information of the first picture can be matched to determine the similarity. It is believed that the first pictures with high similarity are pictures of the same category, and the user has a high probability of compressing these first pictures together. In an example, there are 5 first pictures, namely Picture 1, Picture 2, ..., Picture 5, and the similarity threshold is 0.8. Any picture, such as Picture 2, is selected as the target picture, and the content information of the target picture is matched with the content information of Picture 1, Picture 3 to Picture 5 respectively to determine the similarity between the target picture and each of the remaining first pictures, wherein the similarity between Picture 2 and each of the remaining first pictures is shown in Table 1 below:
[0087] Table 1
[0088] Similarity with the target image (Image 2) Picture 1 0.85 Picture 3 0.67 Picture 4 0.52 Picture 5 0.96
[0089] As shown in Table 1 above, the similarity between Picture 1 and Picture 5 and Picture 2 is greater than the similarity threshold of 0.8. Therefore, using the same label, such as the letter a, to mark Picture 2, Picture 1 and Picture 5 in turn, it can be considered that Picture 2, Picture 1 and Picture 5 are of the same type.
[0090] Then, the remaining pictures 3 and 4 are used as the new first pictures, and the similarity between them is re-determined. However, the similarity between pictures 3 and 4 is only 0.32, so pictures 3 and 4 are marked with different tags, such as using the letter b to mark picture 3 and the letter c to mark picture 4. Finally, three categories of pictures are obtained. The first category includes: pictures 2, 1 and 5, the second category includes picture 3, and the third category includes picture 4. The marking order is: picture 2, picture 1, picture 5, picture 3, and picture 4. Then, the first pictures are displayed on the display screen of the client in sequence according to the marking order, such as Figure 2 As shown. Figure 2 In the display, the five first pictures are displayed on the left side of the display screen in the marked order, and the user can easily select each first picture, and after selection, drag and move the selected picture to the compression area on the right for compression.
[0091] The following embodiment describes in detail the process of compressing each of the second images in the present application and aggregating the compressed second images into a compressed package.
[0092] Sending each of the second pictures to a backend server connected to the client, so that the backend server converts each of the second pictures into a corresponding byte stream, and calls a target interface to compress the byte stream corresponding to each of the second pictures, respectively, to obtain each compressed second picture, and sends the compressed second picture;
[0093] The compressed second pictures sent by the back-end server are aggregated into a compressed package.
[0094] It is understandable that after the second image is sent to the backend server connected to the client, the image exists in the form of an image file, so the backend server can convert it into a byte stream format (buffer format), and then call the target interface to compress the byte stream of each second image pair to obtain each compressed second image, and then send it. The target interface refers to the tinify.fromBuffer interface.
[0095] Furthermore, the step of generating an online link corresponding to the compressed package specifically includes:
[0096] Using the picture contained in the compressed package as the third picture;
[0097] Determine the number of the third pictures and the naming information of each of the third pictures;
[0098] Convert the number of the third picture into a first barcode;
[0099] Determine the second barcode according to the naming information of each of the third pictures;
[0100] Concatenate the first barcode and the second barcode to obtain a third barcode;
[0101] An online link corresponding to the compressed package is generated based on the third barcode.
[0102] Specifically, the second barcode can be spliced after the first barcode, calling the preset putACL method, modifying the access rights, and converting the third barcode into an online link, so that it can be directly accessed.
[0103] and Figure 1 Corresponding to the method described above, the embodiment of the present invention also provides a picture compression device for compressing Figure 1 In the specific implementation of the method, the image compression device provided by the embodiment of the present invention can be used in a computer terminal or various mobile devices, combined with Figure 3 , introduce the image compression device, such as Figure 3 As shown, the device may include:
[0104] The to-be-compressed picture acquisition module 10 is used to acquire one or more to-be-compressed pictures in response to a request instruction for picture compression initiated by a user on a display screen of a client;
[0105] A scaling module 20, configured to scale each of the to-be-compressed pictures according to a preset size to obtain first pictures corresponding to each of the to-be-compressed pictures;
[0106] A selection module 30, configured to display each of the first pictures on a display screen of the client so that the user can select each of the first pictures, and use the pictures selected by the user from each of the first pictures as each of the second pictures;
[0107] A compression module 40, configured to compress each of the second pictures respectively, and aggregate the compressed second pictures into a compressed package;
[0108] The link generation module 50 is used to generate an online link corresponding to the compressed package and display the online link on the display screen of the client.
[0109] It can be seen from the above technical scheme that the present application obtains one or more images to be compressed by responding to a request instruction for image compression initiated by a user on the display screen of a client; scales each of the images to be compressed according to a preset size to obtain each first image corresponding to each of the images to be compressed; displays each of the first images on the display screen of the client for the user to select each of the first images, and uses the images selected by the user from each of the first images as each of the second images; compresses each of the second images respectively, and summarizes the compressed second images into a compressed package; generates an online link corresponding to the compressed package, and displays the online link on the display screen of the client. This scheme modifies each of the images to be compressed according to a preset size, such as by scaling or reducing, etc. When there are a large number of images to be compressed, they can be made of a uniform size and displayed on the display screen, which can make the image compression interface neat and uniform, and facilitate users to search for images. This scheme provides users with a convenient and multifunctional image compression method, which greatly improves the user's work efficiency and image processing efficiency.
[0110] Furthermore, the embodiment of the present application provides a picture compression device. Optionally, Figure 4 The hardware structure diagram of the image compression device is shown in FIG. Figure 4 The hardware structure of the image compression device may include: at least one processor 01, at least one communication interface 02, at least one memory 03 and at least one communication bus 04.
[0111] In the embodiment of the present application, the number of the processor 01 , the communication interface 02 , the memory 03 , and the communication bus 04 is at least one, and the processor 01 , the communication interface 02 , and the memory 03 communicate with each other through the communication bus 04 .
[0112] The processor 01 may be a central processing unit (CPU), or an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present invention.
[0113] The memory 03 may include a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), etc., such as at least one disk memory.
[0114] The memory stores a program, and the processor can call the program stored in the memory, and the program is used to execute the following image compression method, including:
[0115] In response to a request instruction for image compression initiated by a user on a display screen of a client, one or more images to be compressed are obtained;
[0116] Scaling each of the to-be-compressed pictures according to a preset size to obtain first pictures corresponding to each of the to-be-compressed pictures;
[0117] Displaying each of the first pictures on a display screen of the client so that the user can select each of the first pictures, and using the pictures selected by the user from each of the first pictures as each of the second pictures;
[0118] Compressing each of the second pictures respectively, and aggregating the compressed second pictures into a compressed package;
[0119] An online link corresponding to the compressed package is generated, and the online link is displayed on a display screen of the client.
[0120] Optionally, the detailed functions and extended functions of the program may refer to the description of the image compression method in the method embodiment.
[0121] The embodiment of the present application further provides a storage medium, which may store a program suitable for execution by a processor, and when the program is executed, controls the device where the storage medium is located to execute the following image compression method, including:
[0122] In response to a request instruction for image compression initiated by a user on a display screen of a client, one or more images to be compressed are obtained;
[0123] Scaling each of the to-be-compressed pictures according to a preset size to obtain first pictures corresponding to each of the to-be-compressed pictures;
[0124] Displaying each of the first pictures on a display screen of the client so that the user can select each of the first pictures, and using the pictures selected by the user from each of the first pictures as each of the second pictures;
[0125] Compressing each of the second pictures respectively, and aggregating the compressed second pictures into a compressed package;
[0126] An online link corresponding to the compressed package is generated, and the online link is displayed on a display screen of the client.
[0127] Specifically, the storage medium may be a computer-readable storage medium, and the computer-readable storage medium may be an electronic memory such as a flash memory, an EEPROM (Electrically Erasable Programmable Read-Only Memory), an EPROM, a hard disk or a ROM.
[0128] Optionally, the detailed functions and extended functions of the program may refer to the description of the image compression method in the method embodiment.
[0129] In addition, the functional modules in the various embodiments of the present disclosure can be integrated together to form an independent part, or each module can exist separately, or two or more modules can be integrated to form an independent part. If the function is implemented in the form of a software functional module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present disclosure is essentially or the part that contributes to the prior art or the part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes a number of instructions for a computer device (which can be a personal computer, a live broadcast device, or a network device, etc.) to perform all or part of the steps of the methods of the various embodiments of the present disclosure.
[0130] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0131] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0132] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for compressing an image, characterized in that: include: In response to a request instruction for image compression initiated by a user on a display screen of a client, one or more images to be compressed are obtained; Scaling each of the to-be-compressed pictures according to a preset size to obtain first pictures corresponding to each of the to-be-compressed pictures; Displaying each of the first pictures on a display screen of the client so that the user can select each of the first pictures, and using the pictures selected by the user from each of the first pictures as each of the second pictures; Compressing each of the second pictures respectively, and aggregating the compressed second pictures into a compressed package; An online link corresponding to the compressed package is generated, and the online link is displayed on a display screen of the client.
2. The method according to claim 1, characterized in that: The step of scaling each of the to-be-compressed pictures according to a preset size to obtain each of the first pictures corresponding to each of the to-be-compressed pictures includes: Obtaining the size of each of the to-be-compressed pictures, and determining whether the size of each of the to-be-compressed pictures is greater than the preset size; If yes, the image with the smallest size is used as the minimum image, and the size of the minimum image is used as the target size; Except for the smallest picture, the remaining pictures to be compressed are reduced according to the target size, and the reduced pictures to be compressed and the smallest picture are used as the first picture.
3. The method according to claim 2, characterized in that Also includes: If there are pictures to be compressed whose size is not greater than the preset size, then calculating the average value of the sizes of all pictures to be compressed; Each of the to-be-compressed pictures is scaled according to the average value to obtain first pictures.
4. The method according to claim 1, characterized in that: The step of displaying each of the first pictures on a display screen of the client includes: Determining content information of each of the first pictures; Randomly select a first picture as a target picture, and match content information of other first pictures with content information of the target picture to determine similarity; Using the same label to mark the target image and each first image whose similarity to the target image is greater than a preset similarity threshold; Taking each unmarked first picture as each new first picture, and returning to execute the step of arbitrarily selecting a first picture as the target picture until all the first pictures are marked; The first pictures are displayed sequentially on the display screen of the client according to the marked order.
5. The method according to claim 1, characterized in that The step of compressing each of the second images respectively and aggregating the compressed second images into a compressed package includes: Sending each of the second pictures to a backend server connected to the client, so that the backend server converts each of the second pictures into a corresponding byte stream, and calls a target interface to compress the byte stream corresponding to each of the second pictures, respectively, to obtain each compressed second picture, and sends the compressed second picture; The compressed second pictures sent by the back-end server are aggregated into a compressed package.
6. The method according to claim 1, characterized in that The generating an online link corresponding to the compressed package includes: Using the picture contained in the compressed package as the third picture; Determine the number of the third pictures and the naming information of each of the third pictures; Convert the number of the third picture into a first barcode; Determine the second barcode according to the naming information of each of the third pictures; Concatenate the first barcode and the second barcode to obtain a third barcode; An online link corresponding to the compressed package is generated based on the third barcode.
7. The method according to claim 4, characterized in that The content information includes picture type, picture name and picture color.
8. A picture compression device, characterized in that: include: The module for acquiring images to be compressed is used to obtain one or more images to be compressed in response to a request instruction for image compression initiated by a user on a display screen of a client; A scaling module, used for scaling each of the to-be-compressed pictures according to a preset size to obtain each first picture corresponding to each of the to-be-compressed pictures; A selection module, configured to display each of the first pictures on a display screen of the client so that the user can select each of the first pictures, and use the pictures selected by the user from each of the first pictures as each of the second pictures; A compression module, used to compress each of the second pictures respectively, and aggregate the compressed second pictures into a compressed package; The link generation module is used to generate an online link corresponding to the compressed package and display the online link on the display screen of the client.
9. A picture compression device, characterized in that: including memory and processor; The memory is used to store programs; The processor is used to execute the program to implement the various steps of the image compression method as described in any one of claims 1-7.
10. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, each step of the image compression method according to any one of claims 1 to 7 is implemented.
