Format conversion method and device for batch pictures, equipment and medium
By using the combination module of the executor and the main server in the insurance claims system, the format conversion of batch images is realized, which solves the problem of high complexity when converting batch images to WebP format, and reduces management and communication costs.
Patent Information
- Application Number
- CN202411767626.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-02
- Publication Date
- 2025-03-14
AI Technical Summary
In the insurance claims system, the complexity of converting batch images into WebP format is high, increasing management costs and communication costs.
By establishing a communication connection between the executor and the main server, the format conversion of batch pictures is realized by using the combination of scanning, segmentation and splicing modules. The specific steps include scanning the path to convert the picture, dividing the path to the path, file name and source image format except the file, replacing the source image format as the target format, and splicing the path, file name and target format other than the file, and generating the converted picture path.
It reduces the complexity of image conversion and reduces the management and communication costs of WebP conversion checking for each project.
Smart Images

Figure CN119629417A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image format conversion, and in particular to a method, device, equipment and medium for format conversion of batch images. Background Art
[0002] At present, many case information in the existing insurance claims system, such as claim processing reports and compensation calculations, are generally scanned and saved first, and then transmitted to the corresponding end for processing. The scanned and saved images are generally in jpg or png format. Images are usually one of the most space-consuming resources on a web page. The size of the image resource directly affects the web page loading time. Large images take more time to download, which may cause the web page to load slowly, especially under slow network connections. WebP usually has a higher compression rate than jpg or png format images, which means that the size of the WebP file is smaller at the same image quality. This is crucial for transmitting images on the network and improving page loading speed. However, not all mobile devices support webp format images, and the client software corresponding to each tool needs to be downloaded separately, which increases the complexity of image format conversion. Therefore, in the process of converting batch images to WebP format, how to reduce the conversion complexity has become an urgent problem to be solved. Summary of the invention
[0003] In view of this, embodiments of the present invention provide a method, apparatus, device and medium for converting the format of batch images to solve the more complicated problems in the process of converting batch images into the WebP format.
[0004] In a first aspect, an embodiment of the present invention provides a method for format conversion of batch images, the method for format conversion is applied to at least one execution machine, each execution machine is communicatively connected to a main server, and the method for format conversion includes: The execution machine scans the to-be-converted images in the product folder constructed by the main server according to the received tasks to be executed assigned by the main server, determines the path of the to-be-converted images, and writes the path of the to-be-converted images into the first array; Split the path of the picture to be converted in the first array into the path excluding the file, the file name and the source picture format; The source image format is replaced with the target image format, the path other than the file, the file name and the target image format are concatenated to obtain the converted image under the corresponding path, and the converted image and the corresponding path are written into the second array under the product file.
[0005] In a second aspect, an embodiment of the present invention provides a method for format conversion of batch images, the method for format conversion is applied to a main server, the main server is communicatively connected to at least one execution machine, and the method for format conversion includes: The main server generates a task to be executed and a product folder according to the received request to be converted, wherein the product folder includes the picture to be converted; The execution status of each execution machine is obtained, the to-be-executed task is assigned to an execution machine whose execution status is idle, and an execution callback sent by the corresponding execution machine is received.
[0006] In a third aspect, an embodiment of the present invention provides a format conversion device for batch images, wherein the format conversion device is applied to at least one execution machine, each execution machine is communicatively connected to a main server, and the format conversion device includes: A scanning module, used for the execution machine to scan the to-be-converted images in the product folder constructed by the main server according to the to-be-converted tasks assigned by the main server, determine the path of the to-be-converted images, and write the path of the to-be-converted images into the first array; A segmentation module, used for segmenting the path of the picture to be converted in the first array into the path other than the file, the file name and the source picture format; A splicing module is used to replace the source image format with the target image format, splice the path other than the file, the file name and the target image format to obtain the converted image under the corresponding path, and write the converted image and the corresponding path into the second array under the product file.
[0007] In a fourth aspect, an embodiment of the present invention provides a format conversion device for batch images, the format conversion device comprising: A generation module, used for the main server to generate a task to be executed and a product folder according to the received request to be converted, wherein the product folder includes the picture to be converted; The allocation module is used to obtain the execution status of each execution machine, allocate the to-be-executed task to the execution machine whose execution status is idle, and receive the execution callback sent by the corresponding execution machine.
[0008] In a fifth aspect, an embodiment of the present invention provides a computer device, comprising a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the computer device is used to execute the format conversion method described in the first aspect and the second aspect.
[0009] In a sixth aspect, an embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and the computer program is executed by a processor to execute the format conversion method described in the first aspect and the second aspect.
[0010] Compared with the prior art, the present invention has the following beneficial effects: The present application provides a method for format conversion of batch images, the format conversion method is applied to at least one execution machine, each execution machine is communicatively connected with the main server, and the format conversion method includes: the execution machine scans the images to be converted in the product folder constructed by the main server according to the received tasks to be executed assigned by the main server, determines the path of the images to be converted, writes the path of the images to be converted into a first array, divides the path of the images to be converted in the first array into paths other than files, file names and source image formats, replaces the source image formats with target image formats, splices the paths other than files, file names and target image formats, obtains the converted images under the corresponding paths, and writes the converted images and the corresponding paths into the second array under the product files. In the present application, the problem of failure of installing the image conversion plug-in sharp on the intranet is bypassed, and the complexity of image conversion is reduced by directly converting the batch images into the target format, thereby reducing the management cost and communication cost of each project accessing the webp conversion inspection. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative labor.
[0012] Figure 1 This is an application environment of a batch image format conversion method provided by the first embodiment of the present invention; Figure 2 It is a flowchart of a method for format conversion of batch images provided in the second embodiment of the present invention; Figure 3 1 is a flow chart of a method for converting the format of batch images provided in Embodiment 3 of the present invention; Figure 4 It is a structural block diagram of a device for converting the format of batch images provided by a fourth embodiment of the present invention; Figure 5 This is a structural block diagram of a device for converting the format of batch images provided in Embodiment 5 of the present invention; Figure 6 It is a structural diagram of a computer device provided in Embodiment 6 of the present invention. DETAILED DESCRIPTION
[0013] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0014] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present invention. However, it should be clear to those skilled in the art that the present invention may be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present invention.
[0015] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or combinations thereof.
[0016] It should also be understood that the term "and / or" used in the present description and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
[0017] As used in the present specification and the appended claims, the term "if" may be interpreted as "when" or "upon" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" may be interpreted as meaning "upon determination" or "in response to determining" or "upon detection of [described condition or event]" or "in response to detecting [described condition or event]", depending on the context.
[0018] In addition, in the description of the present specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.
[0019] References to "one embodiment" or "some embodiments" etc. described in the present specification mean that one or more embodiments of the present invention include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.
[0020] It should be understood that the order of execution of the steps in the following embodiments does not imply a precedence of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
[0021] In order to illustrate the technical solution of the present invention, specific embodiments are provided below for illustration.
[0022] A batch image format conversion method provided by the first embodiment of the present invention can be applied to Figure 1 In an application environment, each execution machine is communicated with the main server, wherein the execution machine and the main server can be independent servers or cloud servers that provide basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms.
[0023] See also Figure 2 , is a flow chart of a method for converting the format of a batch of images provided in the second embodiment of the present invention. The method for converting the format of a batch of images can be applied to Figure 1 The execution machine in Figure 2 As shown, the method for converting the format of batch pictures may include the following steps.
[0024] S201: The execution machine scans the to-be-converted images in the product folder constructed by the main server according to the to-be-converted tasks assigned by the main server, determines the paths of the to-be-converted images, and writes the paths of the to-be-converted images into the first array.
[0025] In step S201, the format conversion method is applied to at least one execution machine, each execution machine is connected to the main server for communication, the execution machine is used to execute the task assigned by the main server, the product folder constructed by the main server is a folder for storing the pictures to be converted, the pictures to be converted refer to the pictures that need to be converted, the picture format refers to the format of the computer storing the pictures, and the picture format may include the standard image file format (BMP, Bitmap), the image format formulated by the Joint Photographic Experts Group (JPEG, Joint Photographic Experts Group), the image file storage format (PNG, Portable Network Graphic Format), the image interchange format (GIF, Graphics Interchange Format), JP2 (a format of the JPEG 2000 standard), the portable document format (PDF, Portable Document Format), etc. The execution machine scans the pictures to be converted in the product folder constructed by the main server according to the received tasks to be executed assigned by the main server, determines the path of the pictures to be converted, and writes the path of the pictures to be converted into the first array.
[0026] In this embodiment, the main service is connected to at least one execution machine in communication. When the user triggers the construction operation, the front end notifies the main service end by initiating an ajax request. After receiving the corresponding request, the main service end assigns the corresponding task to the corresponding execution machine. The execution machine scans the to-be-converted images in the product folder constructed by the main service end according to the to-be-converted tasks assigned by the main service end, determines the path of the to-be-converted images, and writes the path of the to-be-converted images into the first array. The first array is used to save the path of the to-be-converted images in the front end, that is, all the to-be-converted images are written into the corresponding array.
[0027] It should be noted that the execution machine scans the images to be converted in the product folder constructed by the main server according to the tasks to be executed assigned by the main server. The product folder is the dist folder constructed in the root directory of the front-end project. The images to be converted in the front-end project are saved in the first array of the corresponding product folder.
[0028] It should be noted that the first array of the product folder may include multiple pictures to be converted, that is, batches of pictures to be converted are converted simultaneously.
[0029] It should be noted that when scanning the images to be converted in the product folder built by the main server to determine the path of the images to be converted, the npm package glob can be used to scan the product folder to obtain the paths of all images to be converted.
[0030] Optionally, after receiving the to-be-executed tasks assigned by the main server, the execution machine further includes: The execution machine creates a child process and writes the task to be executed into the child process.
[0031] In this embodiment, the front end notifies the main server by initiating an ajax request. When the main server receives the request to be converted, the task is pushed into the global variable global.buildLine, and the execution machine is assigned the task to be executed. After receiving the task to be executed assigned by the main server, the execution machine sends the task to be executed to the first idle thread of the current global.ciLine in the execution machine queue to execute the first task of global.buildLine. When the execution machine receives the corresponding task to be executed, it calls back to the main server so that the main server can update the current global.ciLine, global.buildLine, and global.uidLine.
[0032] The execution machine creates a child process according to the tasks to be executed assigned by the main server, writes the assigned tasks to the corresponding child process, executes build-start.js, and performs the whole process of packaging and building. The packaging code can refer to the build-project.js file, starting from the initGit() method, the process is git get code initGit()-》get node_modules package handleNodeModule()-》process packaging handleBuild()-》upload to the test environment uploadPadis() after successful packaging.
[0033] S202: Segment the path of the picture to be converted in the first array into the path excluding the file, the file name and the source picture format.
[0034] In step S202, the path of the image to be converted is segmented, and the character string of the corresponding path is segmented into three parts, one part is the path character string excluding the file, one part is the file name character string, and one part is the image format character string, that is, the path excluding the file, the file name and the source image format.
[0035] In this embodiment, the character string corresponding to the path of the image to be converted is segmented into the path other than the file, the file name and the source image format, wherein the path other than the file is the path of the image to be converted at the front end, for example, the path of the image to be converted is C:\Users\HP\Pictures\to\tupain.png, when the path is segmented, the path is separated into C:\Users\HP\Pictures\to, tupain., png. Among them, C:\Users\HP\Pictures\to is the path other than the file, tupain. is the file name, and png is the source image format.
[0036] It should be noted that when there are multiple images to be converted, the source image formats of all the images to be converted are segmented. After segmentation, each part of the string can be saved separately in the form of an array. For example, the strings corresponding to the paths other than the files are saved in an array in a corresponding order, the file names are saved in an array in a corresponding order, and the source image formats are saved in an array in a corresponding order. Among them, the paths other than the files, the file names and the source image formats of the same image to be converted correspond to each other in the order in the array, so as to facilitate subsequent splicing. For example, the paths of the pictures to be converted are C:\Users\HP\Pictures\to\tupain1.png, C:\Users\HP\Pictures\to\tupain2.png, and C:\Users\HP\Pictures\to\tupain3.png. When the paths of the pictures to be converted are segmented, the first part is [C:\Users\HP\Pictures\to\, C:\Users\HP\Pictures\to\, C:\Users\HP\Pictures\to\], the second part is [tupain1., tupain2., tupain3.], and the third part is [png, png, png].
[0037] It should be noted that, since the sources of the images to be converted are different, the corresponding image formats may also be different, and the format of the images to be converted can be any format.
[0038] S203: Replace the source image format with the target image format, concatenate the path and file name other than the file with the target image format to obtain the converted image under the corresponding path, and write the converted image and the corresponding path into the second array under the product file.
[0039] In step S203, the target image format is the format to be converted to, the path and file name other than the file are concatenated with the target image format to form a new path, and the converted image under the corresponding path is obtained, and the converted image and the corresponding path are written into the second array under the product file, wherein the format of the image to be converted is converted without changing the path, and after the conversion, it is saved in the form of an array.
[0040] In this embodiment, the source image format is replaced with the target image format, that is, the string corresponding to the source image format in all the images to be converted is replaced with the string corresponding to the target image format. After the source image format is replaced with the target image format, the path and file name other than the file are concatenated with the target image format to obtain the converted image under the corresponding path, and the converted image and the corresponding path are written into the second array under the product file.
[0041] It should be noted that the character strings corresponding to the source image formats in all images to be converted are replaced with the character strings corresponding to the target image formats, and the order of the source image formats is not changed. When the paths and file names other than the files are concatenated with the target image formats, they are concatenated in sequence after the file names according to the corresponding order to obtain images in the target image format.
[0042] For example, the path of the image to be converted is C:\Users\HP\Pictures\to\tupain.png. When the path is segmented, the path is separated into C:\Users\HP\Pictures\to, tupain, png. Among them, C:\Users\HP\Pictures\to is the path excluding the file, tupain is the file name, and png is the source image format. If the target image format is webp format, the source image format is replaced with the target image format, that is, png is replaced with webp, and the path and file name excluding the file are spliced with the target image format to obtain the converted image under the corresponding path, that is, C:\Users\HP\Pictures\to\tupain.webp, and the converted image format is webp format. Splice webp as a suffix to the corresponding file name to obtain the converted image under the corresponding path, and write the converted image and the corresponding path into the second array under the product file.
[0043] In this embodiment, the path of the image to be converted is segmented, and only the source image format after the segmentation is replaced, that is, the image to be converted is directly converted based on the source path, which greatly reduces the cost of converting to the target image format.
[0044] Optionally, after writing the converted image and the corresponding path into the second array under the product file, the method further includes: At preset time intervals, the execution callback is sent to the main server.
[0045] In this embodiment, when each execution machine executes the corresponding task, it periodically sends an execution callback to the main server according to a preset time interval, so that the main server can determine the online status of the execution based on whether the execution callback is received. If the main server receives the execution callback sent by the execution within the preset time interval, it is determined that the corresponding execution machine is online. If the execution callback sent by the execution machine is not received within the preset time interval, it is considered that the corresponding execution machine is offline, so that the execution status of the corresponding execution machine can be determined according to the execution callback, so that the main server can accurately assign corresponding tasks to the execution machines.
[0046] See also Figure 3 , is a flow chart of a method for converting the format of a batch of images provided in Embodiment 3 of the present invention. The method for converting the format of a batch of images can be applied to Figure 1 The main server in Figure 3 As shown, the method for converting the format of batch pictures may include the following steps.
[0047] S301: The main server generates a task to be executed and a product folder according to the received request to be converted, and the product folder includes the image to be converted.
[0048] In step S301, the format conversion method is applied to the main server, which is connected to at least one execution machine. The main server is used to send tasks to be executed to the execution machine. The main server generates tasks to be executed and product folders according to the received request to be converted, wherein the request to be converted includes the front-end project git address, code library personal token, and git branch name provided by the user. The task to be executed is generated according to the request to be converted. The main server initializes the code, switches to the specified branch, pulls the code, executes the build command, and obtains the build product according to the received request to be converted. The build product is a folder named dist in the root directory of the project, i.e., the product folder.
[0049] In this embodiment, the user submits a request to be converted on the front end. The request to be converted includes the git address of the front-end project, the personal token of the code library, and the git branch name. The main server initializes the code, switches to the specified branch, pulls the code, and executes the build command based on the received request to be converted, that is, builds a product folder. When building the product folder, the path of the image to be converted in the front-end project on the front end is written into the first array of the product folder.
[0050] It should be noted that the front end notifies the main server by initiating an ajax request. When the main server receives the request to be converted, the task is pushed to the global variable global.buildLine and the task to be executed is assigned to the executor.
[0051] In this embodiment, by constructing a corresponding platform, the path of the image to be converted on the front end is written into the first array of the product folder, and all front-end projects connected to the construction platform can be converted into images of the target format, making it seamless to use.
[0052] S302: Obtain the execution status of each execution machine, assign the task to be executed to the execution machine whose execution status is idle, and receive the execution callback sent by the corresponding execution machine.
[0053] In step S302, the execution status of each execution machine is obtained to determine whether the execution machine has other execution tasks. When the execution machine has no other execution tasks, that is, when the execution status of the execution machine is idle, the task to be executed is assigned to the execution machine with an idle execution status, and the execution callback sent by the corresponding execution machine is received, where the execution callback may include execution machine information, the task being executed and the online status, etc.
[0054] In this embodiment, the execution status of each execution machine is obtained. After the main server generates the corresponding task to be executed, it is determined whether the task to be executed is being executed. If it is not being executed and there is an idle execution machine among the execution machines, the task to be executed is assigned to the execution machine with an idle execution status. After the corresponding execution machine receives the corresponding task to be executed, it executes it and sends the execution callback to the main server.
[0055] It should be noted that when there is no idle executor among the multiple executors, the main server executes buildStart() and continues the loop. When there is an idle executor, the corresponding tasks to be executed are assigned to the corresponding executor.
[0056] It should be noted that after the main server receives the execution callback sent by the execution machine, it writes it into the global variable global.allCi.
[0057] Optionally, after receiving the execution callback sent by the corresponding execution machine, it also includes: According to the received execution callback, update the execution status of the corresponding execution machine.
[0058] In this embodiment, after receiving the corresponding execution callback, the main server updates the execution status of the corresponding execution machine, which may include the execution machine information, the task being executed and the online status, etc. In this way, the main server updates the execution status of the execution machine in real time according to the execution callback executed, ensuring that the execution machine is reasonably allocated the tasks to be executed.
[0059] Optionally, after updating the execution status of the corresponding execution machine, the following steps are further included: Generate real-time logs based on the received execution callbacks and send them to the front end.
[0060] In this embodiment, after the main server receives the execution callback of the corresponding execution machine, it generates a real-time log and sends it to the front end, where the real-time log includes the identifier of the task to be executed and the identifier of the corresponding execution machine, as well as the execution information of the execution machine.
[0061] It should be noted that the real-time log can be updated in real time, such as once every 2 seconds, so as to facilitate observation of the execution status of the execution machine on the task to be executed.
[0062] See also Figure 4 , Figure 4 1 is a structural block diagram of a batch image format conversion device provided by the fourth embodiment of the present invention. The batch image format conversion device is applied to the execution machine. For the convenience of explanation, only the part related to the embodiment of the present application is shown. Figure 4 The format conversion device 40 includes a scanning module 41, a segmentation module 42, and a splicing module 43.
[0063] The scanning module 41 is used for the execution machine to scan the to-be-converted images in the product folder constructed by the main server according to the to-be-converted tasks assigned by the main server, determine the path of the to-be-converted images, and write the path of the to-be-converted images into the first array.
[0064] The segmentation module 42 is used to segment the path of the picture to be converted in the first array into the path excluding the file, the file name and the source picture format.
[0065] The splicing module 43 is used to replace the source image format with the target image format, splice the path and file name other than the file with the target image format, obtain the converted image under the corresponding path, and write the converted image and the corresponding path into the second array under the product file.
[0066] Optionally, the format conversion device 40 further includes: The writing module is used for the execution machine to create a subprocess and write the task to be executed into the subprocess.
[0067] Optionally, the format conversion device 40 further includes: The sending module is used to send the execution callback to the main server at a preset time interval.
[0068] See also Figure 5 , Figure 51 is a structural block diagram of a batch image format conversion device provided in Embodiment 5 of the present invention. The batch image format conversion device is applied to the main server. For ease of description, only the part related to the embodiment of the present application is shown. Figure 5 The batch image format conversion device 50 includes a generation module 51 and an allocation module 52.
[0069] The generating module 51 is used for the main server to generate tasks to be executed and product folders according to the received request to be converted, and the product folders include the pictures to be converted.
[0070] The allocation module 52 is used to obtain the execution status of each execution machine, allocate the task to be executed to the execution machine whose execution status is idle, and receive the execution callback sent by the corresponding execution machine.
[0071] Optionally, the format conversion device 50 further includes: The update module is used to update the execution status of the corresponding execution machine according to the received execution callback.
[0072] Optionally, the format conversion device 50 further includes: The second sending module is used to generate a real-time log according to the received execution callback and send it to the front end.
[0073] It should be noted that the information interaction, execution process and other contents between the above-mentioned modules are based on the same concept as the method embodiment of the present application. Their specific functions and technical effects can be found in the method embodiment part and will not be repeated here.
[0074] Figure 6 Schematic diagram of the structure of a computer device provided by Embodiment 6 of the present invention. Figure 6 As shown, the computer device of this embodiment includes: at least one processor ( Figure 6 Only one is shown), a memory, and a computer program stored in the memory and executable on at least one processor, wherein when the processor executes the computer program, the steps in any of the above-mentioned batch image format conversion method embodiments are implemented.
[0075] The computer device may include, but is not limited to, a processor and a memory. Those skilled in the art will appreciate that Figure 6 This is merely an example of a computer device and does not constitute a limitation on the computer device. The computer device may include more or fewer components than those shown in the figure, or a combination of certain components, or different components. For example, it may also include a network interface, a display screen, and an input device.
[0076] The processor may be a CPU, or other general-purpose processors, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.
[0077] The memory includes a readable storage medium, an internal memory, etc., wherein the internal memory may be the memory of a computer device, and the internal memory provides an environment for the operation of the operating system and computer-readable instructions in the readable storage medium. The readable storage medium may be a hard disk of a computer device, and in other embodiments, it may also be an external storage device of the computer device, for example, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the computer device. Further, the memory may also include both an internal storage unit of the computer device and an external storage device. The memory is used to store an operating system, an application program, a boot loader (BootLoader), data, and other programs, such as the program code of a computer program, etc. The memory may also be used to temporarily store data that has been output or is to be output.
[0078] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device is divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated into a processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned device can refer to the corresponding process in the above-mentioned method embodiment, which will not be repeated here. If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, which can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium. When the computer program is executed by the processor, the steps of the above-mentioned method embodiment can be implemented. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may at least include: any entity or device capable of carrying computer program code, recording medium, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium. For example, a USB flash drive, a mobile hard disk, a magnetic disk or an optical disk. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electric carrier signals and telecommunication signals.
[0079] The present application implements all or part of the processes in the above-mentioned embodiment method, and may also be completed through a computer program product. When the computer program product runs on a computer device, the computer device can implement the steps in the above-mentioned method embodiment when executing the computer program product.
[0080] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0081] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0082] In the embodiments provided in the present application, it should be understood that the disclosed devices / computer equipment and methods can be implemented in other ways. For example, the device / computer equipment embodiments described above are only schematic, for example, the division of modules or units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0083] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0084] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.
Claims
1. A method for converting the format of batch images, characterized in that: The format conversion method is applied to at least one execution machine, each execution machine is connected to the main server for communication, and the format conversion method includes: The execution machine scans the to-be-converted images in the product folder constructed by the main server according to the received tasks to be executed assigned by the main server, determines the path of the to-be-converted images, and writes the path of the to-be-converted images into the first array; Split the path of the picture to be converted in the first array into the path excluding the file, the file name and the source picture format; The source image format is replaced with the target image format, the path other than the file, the file name and the target image format are concatenated to obtain the converted image under the corresponding path, and the converted image and the corresponding path are written into the second array under the product file.
2. The format conversion method according to claim 1, characterized in that: After the execution machine receives the task to be executed assigned by the main server, it also includes: The execution machine creates a subprocess and writes the task to be executed into the subprocess.
3. The format conversion method according to claim 1, characterized in that: After writing the converted image and the corresponding path into the second array under the product file, the method further includes: At preset time intervals, the execution callback is sent to the main server.
4. A method for converting the format of batch images, characterized in that: The format conversion method is applied to a main server, the main server is communicatively connected to at least one execution machine, and the format conversion method includes: The main server generates a task to be executed and a product folder according to the received request to be converted, wherein the product folder includes the picture to be converted; The execution status of each execution machine is obtained, the to-be-executed task is assigned to an execution machine whose execution status is idle, and an execution callback sent by the corresponding execution machine is received.
5. The format conversion method according to claim 4, characterized in that: After receiving the execution callback sent by the corresponding execution machine, the method further includes: According to the received execution callback, update the execution status of the corresponding execution machine.
6. The format conversion method according to claim 5, characterized in that: After the execution state of the corresponding execution machine is updated, the method further includes: Generate real-time logs based on the received execution callbacks and send them to the front end.
7. A device for converting the format of batch images, characterized in that: The format conversion device is applied to at least one execution machine, each execution machine is connected to the main server for communication, and the format conversion device includes: A scanning module, used for the execution machine to scan the to-be-converted images in the product folder constructed by the main server according to the to-be-converted tasks assigned by the main server, determine the path of the to-be-converted images, and write the path of the to-be-converted images into the first array; A segmentation module, used for segmenting the path of the picture to be converted in the first array into the path other than the file, the file name and the source picture format; A splicing module is used to replace the source image format with the target image format, splice the path other than the file, the file name and the target image format to obtain the converted image under the corresponding path, and write the converted image and the corresponding path into the second array under the product file.
8. A device for converting the format of batch images, characterized in that: The format conversion device is applied to a main server, the main server is communicatively connected to at least one execution machine, and the format conversion device includes: A generation module, used for the main server to generate a task to be executed and a product folder according to the received request to be converted, wherein the product folder includes the picture to be converted; The allocation module is used to obtain the execution status of each execution machine, allocate the to-be-executed task to the execution machine whose execution status is idle, and receive the execution callback sent by the corresponding execution machine.
9. A computer device, characterized in that: The computer device includes a processor, a memory, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the format conversion method according to any one of claims 1 to 6 is implemented.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the format conversion method according to any one of claims 1 to 6 is implemented.