Vehicle-mounted application picture resource type conversion method, vehicle machine and electronic equipment
Through the Gradle construction tool and the gradlePlugin library, automatic WebP conversion of image resources in car-machine applications is realized, which solves the problems of high time cost, complexity and labor consumption in the image resource conversion process in the existing technology, and improves development efficiency and iteration efficiency.
Patent Information
- Application Number
- CN202410749581.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-12
- Publication Date
- 2024-10-08
AI Technical Summary
The existing technology has problems such as high time cost in the process of converting image resources in vehicle and machine applications, the images in the third-party AAR library cannot be manually converted, additional conversion steps are required when developing new requirements, and the conversion process is complex and labor-intensive.
Use the Gradle build tool to establish software environment resources, configure the WebP conversion tool, initialize and create WebP format conversion tasks through the gradlePlugin library, automate image conversion, merge and generate resource collections, retain or delete the converted images according to business logic, and finally package them into APKs.
It realizes the automatic conversion of image resource types, reduces the consumption of human resources, solves the problem of image conversion in the third-party AAR library, and improves development efficiency and iteration efficiency.
Smart Images

Figure CN118747707A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a method for converting the type of picture resources, a vehicle computer, and an electronic device, and in particular to a method for converting the type of picture resources for vehicle-mounted applications, a vehicle computer, and an electronic device. Background Art
[0002] The size of the vehicle application package needs to be controlled and kept as small as possible to save vehicle resources. Converting image resources to webp format can effectively reduce the size of the package occupied by image resources. The existing technology has the following problems:
[0003] There are too many pictures from old projects, and manual conversion is more time-consuming and costly.
[0004] Image resources inside third-party aar library files cannot be transferred manually.
[0005] When developing new requirements, it is necessary to convert png to webp, which is sometimes easy to forget.
[0006] The process of converting to webp requires control of parameters and degradation judgment, which is more complex than automation and has a higher manual success rate.
[0007] When there are too many engineering projects, each project has to be transferred manually, which consumes too much manpower.
[0008] In summary, the existing technology can no longer meet people's requirements and needs to be improved urgently. Summary of the invention
[0009] The purpose of the present invention is to provide a method for converting the type of vehicle-mounted application image resources, a vehicle computer, and an electronic device. The first technical problem to be solved is to effectively maintain the occupation of the installation package volume by image resources. The second technical problem to be solved is the need for additional image type conversion when encountering new development needs. The last technical problem to be solved is to automatically judge the quality of images during the process of converting image types to solve the shortcomings of the existing technology.
[0010] The present invention provides the following scheme:
[0011] A method for converting image resource types during the compilation phase of an in-vehicle application, comprising:
[0012] Based on the Gradle build tool, establish the software environment resources for image format conversion, configure the corresponding dependencies and WebP conversion tools;
[0013] Execute the initialization logic of the gradlePlugin library, create a WebP format conversion task, merge the images to be converted to generate a resource set, and obtain the image set that needs to be converted to WebP;
[0014] The conversion command is executed on the picture set, and the converted output pictures are retained or deleted according to different business logics, and finally packaged into an APK.
[0015] Furthermore, the software environment resources for image format conversion are established based on the Gradle build tool, and the corresponding dependencies and WebP conversion tools are configured, further including:
[0016] In the root directory of the project file, configure the path for finding and loading dependencies based on the Gradle build tool and integrate the gradlePlugin library.
[0017] Furthermore, the Gradle build tool is specifically a build.gradle file, and the configuration is used to find and load the path of the dependencies, specifically: find and load the path of the dependencies through the classpath path configuration in the build.gradle file.
[0018] Furthermore, the gradlePlugin library is a custom library, and the build.gradle file references the gradlePlugin library through the apply keyword.
[0019] Furthermore, the execution of the initialization logic of the gradlePlugin library, the creation of a WebP format conversion task, the merging of the to-be-converted images to generate a resource set, and the acquisition of the image set that needs to be converted to WebP further includes:
[0020] Place the WebP conversion tool in a specific folder under the project root directory;
[0021] Configure the compression quality of webp through the gradle.properties configuration file in the Gradle build tool;
[0022] Execute the initialization logic of the gradlePlugin library, create a WebP format conversion task, merge the images to be converted to generate a resource set, search for mergeRes, and obtain the image set that needs to be converted to WebP;
[0023] The collection is traversed to perform whitelist verification, and the conversion command is executed on the png images that are not in the whitelist through the WebP conversion tool, and the corresponding retention operation is performed according to the size of the output image after the format conversion.
[0024] Furthermore, the conversion command is executed on the picture set, and the converted output pictures are retained or deleted according to different business logics, and finally packaged into an APK, specifically:
[0025] Determine the size of the input image and the output image. If the output image is smaller than the input image, convert it to WebP.
[0026] A system for converting image resource types during the compilation phase of an in-vehicle application, comprising:
[0027] The software environment resource configuration module builds software environment resources for image format conversion based on the Gradle build tool, and configures corresponding dependencies and WebP conversion tools;
[0028] The WebP format conversion task creation module executes the initialization logic of the gradlePlugin library, creates a WebP format conversion task, merges the images to be converted to generate a resource set, and obtains the image set that needs to be converted to WebP;
[0029] The picture set conversion module executes the conversion command on the picture set, performs corresponding retention or deletion operations on the converted output pictures according to different business logics, and finally packages them into APK.
[0030] A vehicle computer comprises the system for converting image resource types during the vehicle application compilation phase, and executes the method for converting image resource types during the vehicle application compilation phase.
[0031] An electronic device comprises: a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus; a computer program is stored in the memory, and when the computer program is executed by the processor, the processor executes the steps of the method described in the right.
[0032] A computer-readable storage medium stores a computer program executable by an electronic device. When the computer program runs on the electronic device, the electronic device executes the steps of the method.
[0033] Compared with the prior art, the present invention has the following advantages:
[0034] The present invention avoids the problem of consuming a large amount of human resources and graph calculation resources due to the huge number of images to be optimized, and only needs to integrate the developed gradlePlugin plug-in in the gradle script to realize the function of image type conversion.
[0035] The present invention can perfectly solve the problem that the internal images of the third-party aar library cannot be manually converted to the webp format, and the gradle plugin can be used to automatically complete it in the packaging stage.
[0036] After the image types are automatically converted based on the present invention, no new regulations need to be added in the subsequent iterative development phase for new requirements, thereby improving the work efficiency in the development phase and improving the iteration efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0038] Figure 1 It is a flowchart of a method for converting image resource types during the compilation phase of an in-vehicle application.
[0039] Figure 2 This is the architecture diagram of the image resource type conversion system during the compilation phase of the in-vehicle application.
[0040] Figure 3 It is an implementation method of the embodiment of the present invention in a specific application scenario.
[0041] Figure 4 It is a structural diagram of an electronic device. DETAILED DESCRIPTION
[0042] The technical solution of the present invention will be described clearly and completely below in conjunction with the accompanying drawings. Obviously, the described embodiments are only 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.
[0043] like Figure 1 The method for converting image resource types during the in-vehicle application compilation phase shown includes:
[0044] Step S1, establishing software environment resources for image format conversion based on the Gradle build tool, and configuring corresponding dependencies and WebP conversion tools;
[0045] Step S2, execute the initialization logic of the gradlePlugin library, create a WebP format conversion task, merge the images to be converted to generate a resource set, and obtain a set of images that need to be converted to WebP;
[0046] Step S3, executing the conversion command on the picture set, performing corresponding retention or deletion operations on the converted output pictures according to different business logics, and finally packaging them into APK.
[0047] Preferably, the software environment resources for image format conversion are established based on the Gradle build tool, and the corresponding dependencies and WebP conversion tools are configured, further comprising:
[0048] In the root directory of the project file, configure the path for finding and loading dependencies based on the Gradle build tool and integrate the gradlePlugin library.
[0049] Preferably, the Gradle build tool is specifically a build.gradle file, and the configuration is used to find and load the path of the dependencies, specifically: find and load the path of the dependencies through the classpath path configuration in the build.gradle file.
[0050] Exemplarily, the gradlePlugin library is a custom library, and the build.gradle file references the gradlePlugin library through the apply keyword.
[0051] In Android development, the build.gradle file is a Groovy script file that is used to define the build process of the Gradle project and configure related parameters. It is one of the core configuration files in the Gradle build tool, and its functions include but are not limited to:
[0052] Dependency management: Specify the libraries and other dependencies required by your project.
[0053] Plugin application: Apply Gradle plugins to extend build functionality.
[0054] Build variants: Define different build variations, such as different product flavors.
[0055] Task definition: Create custom build tasks.
[0056] Version management: Manage versions of libraries and plugins used in your project.
[0057] Build configuration: Set compilation options, for example, minimum SDK version, target SDK version, etc.
[0058] In Android Studio, the build.gradle file is usually located in the root directory of the project and in the directories of each module. The build.gradle file in the root directory defines the global build settings, while the build.gradle file in the module directory defines the build settings specific to the module.
[0059] Code example: A basic Android app build.gradle file:
[0060]
[0061]
[0062] Preferably, the execution of the initialization logic of the gradlePlugin library (Gradle plug-in), creating a WebP format conversion task, merging the images to be converted to generate a resource set (mergeRes), and obtaining a set of images that need to be converted to WebP further includes:
[0063] Place the WebP conversion tool in a specific folder under the project root directory;
[0064] Exemplarily, the WebP conversion tool is specifically a cwebp executable file. The executable file is placed in a specific folder under the project root directory for construction and calling. The project directory structure can be as follows:
[0065] myProject /
[0066] ├──src /
[0067] ├──lib /
[0068] └──build.gradle
[0069] myProject /
[0070] ├──cwebp /
[0071] ├──src /
[0072] ├──lib /
[0073] └──build.gradle
[0074] Copy the downloaded cwebp executable file into the cwebp folder you just created;
[0075] Update build.gradle: Add a custom Gradle task in the build.gradle file to call the cwebp tool during the build process. The code example is as follows:
[0076] task convertWebP(type:Exec){
[0077] commandLine'myProject / cwebp / cwebp','input.png','-o','output.webp'
[0078] }
[0079] Call task: This task is executed during the build process by calling the gradle convertWebP command to convert PNG images to WebP format.
[0080] Ensure permissions: Ensure that the cwebp executable file has execute permissions. Use the chmod +xcwebp command on Unix-like systems to set the execute permissions.
[0081] Test: After completing the above steps, test the build process to ensure that the cwebp tool can execute and convert the image format correctly.
[0082] Preferably, the compression quality of webp is configured through the gradle.properties configuration file in the Gradle build tool;
[0083] For example, configure the compression quality cwebp.quality of the webp conversion tool, define the default value in the gradlePlugin plugin, or use the original default value without configuration.
[0084] Preferably, the initialization logic of the gradlePlugin library (Gradle plugin) is executed to create a WebP format conversion task, for example, it can be assumed to be named transToWebpTask;
[0085] Merge the images to be converted to generate a resource set, search mergeRes, and get the image set that needs to be converted to WebP;
[0086] The collection is traversed to perform whitelist verification, and the conversion command is executed on the png images that are not in the whitelist through the WebP conversion tool, and the corresponding retention operation is performed according to the size of the output image after the format conversion.
[0087] Preferably, the conversion command is executed on the picture set, and corresponding retention or deletion operations are performed on the converted output pictures according to different business logics, and finally packaged into an APK, specifically:
[0088] Determine the size of the input image and the output image. If the output image is smaller than the input image, convert it to WebP.
[0089] The apk packaging stage is the execution stage of the Android gradle plug-in native task. After this stage is completed, the apk file can be produced.
[0090] Name explanation: A third-party aar library refers to an Android Archive (.aar) file created by an independent developer or organization and provided to other developers. It usually contains some reusable code, resources, and dependencies, and can be introduced and used by other application projects.
[0091] Unlike standard Android libraries, third-party aar libraries are created and maintained by external teams or individuals and can be shared and reused in multiple applications. Third-party aar libraries help speed up the application development process because developers do not need to write all functions from scratch, but can directly use existing stable and high-quality code. Using third-party aar libraries in application development can accelerate, simplify, and promote code reuse.
[0092] For the method steps disclosed in the above embodiments, the method steps are described as a series of action combinations for the purpose of simple description, but those skilled in the art should know that the embodiments of the present invention are not limited by the order of the actions described, because according to the embodiments of the present invention, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present invention.
[0093] Any process or method description described in a flowchart or other manner may be understood as representing a module, fragment or portion of a code including one or more executable instructions for implementing the steps of a specific logical function or process, and the scope of the preferred embodiments of the present invention includes alternative implementations, in which the order shown or discussed may not be followed, including executing and implementing the functions in a substantially simultaneous manner or in a reverse order according to the functions involved, or executing computer instructions and implementing the corresponding functions according to program structures such as loops and branches, which can be naturally understood by those skilled in the art when implementing the embodiments of the present invention.
[0094] like Figure 2 The image resource type conversion system during the in-vehicle application compilation phase shown includes:
[0095] The software environment resource configuration module builds software environment resources for image format conversion based on the Gradle build tool, and configures corresponding dependencies and WebP conversion tools;
[0096] The WebP format conversion task creation module executes the initialization logic of the gradlePlugin library, creates a WebP format conversion task, merges the images to be converted to generate a resource set, and obtains the image set that needs to be converted to WebP;
[0097] The picture set conversion module executes the conversion command on the picture set, performs corresponding retention or deletion operations on the converted output pictures according to different business logics, and finally packages them into APK.
[0098] The implementation methods of the system described above are merely illustrative, for example, the various functional modules, units or subsystems in the system may or may not be physically separated, or may or may not be physical units, that is, they may be located in the same place, or they may be distributed to multiple different systems and their subsystems or modules. Those skilled in the art may select some or all of the functional modules, units or subsystems according to actual needs to achieve the purpose of the embodiments of the present invention, and those of ordinary skill in the art may understand and implement the above-mentioned situations without creative work.
[0099] like Figure 3 The implementation method of the embodiment of the present invention in a specific application scenario is shown as follows:
[0100] 1. Coding stage:
[0101] 1. Integrate the customized gradlePlugin library through classpath in the build.gradle file in the project root directory; reference gradlePlugin through apply in the build.gradle file in the app directory.
[0102] 2. Put the cwebp executable files for Linux, MacOS and Windows platforms into the cwebp folder in the project root directory.
[0103] 3. You can configure the compression quality of webp in the gradle.properties file cwebp.quality. gradlePlugin defines the default value, or you can use the default value directly without configuring it.
[0104] 2. Plugin initialization:
[0105] (1) After the developer starts integrating the application, the initialization logic of gradlePlugin is executed, which includes creating the task transToWebpTask to convert webp.
[0106] (2) Since the native tasks of the Android gradle plug-in are executed sequentially according to an ordered acyclic graph, it is also necessary to add forward task dependencies and backward task dependencies to transToWebpTask.
[0107] (3) transToWebpTask must be executed between mergeResTask and processResTask.
[0108] 3. Resource preparation stage: When starting resource compilation, all images will be merged to generate a resource set mergeRes. Search mergeRes to obtain the png image set imageRes that needs to be converted to webp.
[0109] 4. Convert to webp stage:
[0110] (1) Traverse the imageRes collection.
[0111] (2) Perform whitelist verification each time. The whitelist is mainly used to handle some abnormal situations, such as to meet the requirement that a certain image does not need to be converted to webp.
[0112] (3) If it is not in the whitelist, the cwebp executable file in the specified directory is used to execute the conversion command on the png image. The command inputs the compression quality and the png image to be compressed input, and outputs the compressed webp image output.
[0113] (4) Determine the file sizes of input and output. If the output file size is smaller than the input, the task is a valid conversion and the input needs to be deleted while the output is retained. Otherwise, the output is deleted while the input is retained.
[0114] 5. APK packaging stage: This stage is the execution stage of the native task of the Android gradle plug-in. After this stage is completed, the apk file can be produced.
[0115] Based on the embodiments of the present application, it can be seen that the current integration of Android applications is done using the gradle scripting language. For the conversion of images to webp, an automated method can be considered. During the packaging stage of the integrated vehicle application, the compilation of resources can be intercepted by defining and applying gradlePlugin, and the dependency priority of the gradle task can be configured to control the task of converting to webp to be completed between the mergeRes and processRes tasks.
[0116] The defined gradlePlugin integrates Google's official cwebp tool internally. By executing the cwebp command, passing the image resource path and output path to be converted, the process of converting png images to webp is completed.
[0117] The defined execution environment of gradlePlugin can support linux, macos and windows.
[0118] Adding compilation and packaging tasks will increase compilation time. You can control the execution of this gradlePlugin only when building the release package.
[0119] Based on the embodiments of the present application, the content of the image processing can be further explained as follows:
[0120] A method for converting picture format, comprising the following steps:
[0121] (1) Traverse the collection file containing image resources, where the image resources stored in the collection file are stored in a specified format;
[0122] (2) Perform a whitelist check on each image in the collection to determine whether a conversion operation needs to be performed;
[0123] (3) If the image is not in the whitelist, use the executable file in the specified directory to convert the image format. The specific steps are as follows:
[0124] a) Determine the compression quality and output path of the image to be converted;
[0125] b) Execute the format conversion command to convert the image in the specified format to the webp format and generate an output file;
[0126] (4) Compare the sizes of the input file and the output file. If the output file size is smaller than the input file, the conversion is considered valid and the following operations are performed:
[0127] a) Delete the input file;
[0128] b) Keep the output files;
[0129] Otherwise, if the output file size is greater than or equal to the input file, then do the following:
[0130] a) Delete output files;
[0131] b) Keep the input file.
[0132] In the embodiment of the present application, a whitelist verification method is used to process images. The whitelist method has the following advantages and benefits:
[0133] Flexibility: Whitelist verification allows developers or users to specify which images require special processing or retain the original format, providing great flexibility for handling specific needs.
[0134] Improved efficiency: Whitelist verification can avoid unnecessary processing steps for images that do not need to be converted, thereby saving processing time and computing resources.
[0135] Error reduction: In some cases, image conversion may introduce quality loss or format incompatibility issues. Whitelist verification can ensure that these images are not converted incorrectly, reducing potential errors and problems.
[0136] Resource optimization: For some images with specific purposes, it may not be necessary or appropriate to convert them to the webp format. Whitelist verification helps to preserve the original format of these images and optimize the use of storage resources.
[0137] Customized service: Whitelist verification allows the image processing process to be customized according to different application scenarios and user needs, providing more personalized services.
[0138] Enhanced security: In some cases, images may contain sensitive information or specific copyright requirements. Whitelist verification can ensure that these images are not converted without authorization, enhancing the security of the processing process.
[0139] Easy maintenance: The maintenance and management of the whitelist is relatively simple. Images that require special processing can be easily added or deleted, making the entire image processing process more controllable.
[0140] Cost savings: By avoiding unnecessary image conversion, you can reduce server load, power consumption, and operation and maintenance costs.
[0141] Improved user experience: For images that are specifically specified by the user or have special format requirements, whitelist verification can ensure that these images are presented in the best quality, thereby improving the user experience.
[0142] Legal compliance: When specific copyright or format requirements need to be adhered to, whitelist verification helps ensure that the image processing process complies with relevant laws and regulations.
[0143] like Figure 4 As shown, the present invention provides a method and system for converting the type of in-vehicle application picture resources, and also provides corresponding electronic equipment, storage medium and vehicle computer:
[0144] A vehicle computer comprises the system for converting image resource types during the vehicle application compilation phase, and executes the method for converting image resource types during the vehicle application compilation phase.
[0145] An electronic device comprises: a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus; a computer program is stored in the memory, and when the computer program is executed by the processor, the processor executes the steps of the method.
[0146] A computer-readable storage medium stores a computer program executable by an electronic device. When the computer program runs on the electronic device, the electronic device executes the steps of the method.
[0147] like Figure 4 As shown, the device 600 includes a computing unit 601, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory 602 (ROM) or a computer program loaded from a storage unit 608 into a random access memory 603 (RAM). In the RAM, various programs and data required for the operation of the device 600 can also be stored. The computing unit 601, the ROM, and the RAM are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0148] A number of components in the device 600 are connected to the I / O interface 605, including: an input unit 606, such as a keyboard, a mouse, etc.; an output unit 607, such as various types of displays, speakers, etc.; a storage unit 608, such as a disk, an optical disk, etc.; and a communication unit 609, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 609 allows the device 600 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0149] The computing unit 601 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 601 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 601 performs the various methods and processes described above, such as a vehicle-mounted application picture resource type conversion method. For example, in some embodiments, the vehicle-mounted application picture resource type conversion method may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 608. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 600 via ROM 602 and / or communication unit 609. When the computer program is loaded into RAM 603 and executed by the computing unit 601, one or more steps of the vehicle-mounted application picture resource type conversion method described above may be performed. Alternatively, in other embodiments, the computing unit 601 may be configured to execute the vehicle-mounted application picture resource type conversion method in any other appropriate manner (for example, by means of firmware).
[0150] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0151] The program code for implementing the method of the present invention can be written in any combination of one or more programming languages. These program codes can be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other vehicle-mounted application picture resource type conversion system, so that when the program code is executed by the processor or controller, the functions / operations specified in the flow chart and / or block diagram are implemented. The program code can be executed entirely on the machine, partially on the machine, partially on the machine as a stand-alone software package and partially on a remote machine, or entirely on a remote machine or server.
[0152] In the context of the present invention, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0153] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0154] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.
[0155] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship with each other. The server may be a cloud server, a server of a distributed system, or a server combined with a blockchain.
[0156] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution disclosed in the present invention can be achieved, and this document does not limit this.
[0157] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0158] In addition, those skilled in the art will appreciate that, although some embodiments described herein include certain features included in other embodiments but not other features, the combination of features of different embodiments is meant to be within the scope of the present invention and form different embodiments. For example, any one of the embodiments claimed in the claims can be used in any combination in the embodiments of the present invention.
[0159] In the description of this specification, the description with reference to the terms "one embodiment", "example", "specific example", etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or more embodiments or examples in a suitable manner.
[0160] In addition, the technical solutions between the various embodiments of the present invention can be combined with each other, but it must be based on the fact that ordinary technicians in the field can implement it. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such combination of technical solutions does not exist and is not within the scope of protection required by the present invention.
[0161] All features disclosed in this specification, or steps in all methods or processes disclosed, except mutually exclusive features and / or steps, can be combined in any way. Any feature disclosed in this specification, unless otherwise stated, can be replaced by other equivalent or alternative features with similar purposes. That is, unless otherwise stated, each feature is only an example of a series of equivalent or similar features. Throughout the specification, the same reference numerals indicate the same elements.
[0162] Those skilled in the art will appreciate that the modules in the devices in the embodiments can be adaptively changed and set in one or more devices different from the embodiments. The modules or units or components in the embodiments can be combined into one module or unit or component, and in addition they can be divided into multiple submodules or subunits or subcomponents. Except that at least some of such features and / or processes or units are mutually exclusive, all features disclosed in this specification (including corresponding claims, abstracts and drawings) and all processes or units of any method or device disclosed in this manner can be combined in any combination. Unless otherwise explicitly stated, each feature disclosed in this specification (including corresponding claims, abstracts and drawings) can be replaced by an alternative feature that provides the same, equivalent or similar purpose.
[0163] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention 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 replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for converting image resource types during the compilation phase of an in-vehicle application. It is characterized in that include: Based on the Gradle build tool, establish the software environment resources for image format conversion, configure the corresponding dependencies and WebP conversion tools; Execute the initialization logic of the gradlePlugin library, create a WebP format conversion task, merge the images to be converted to generate a resource set, and obtain the image set that needs to be converted to WebP; The conversion command is executed on the picture set, and the converted output pictures are retained or deleted according to different business logics, and finally packaged into an APK.
2. The method for converting image resource types during the in-vehicle application compilation phase according to claim 1, It is characterized in that The software environment resources for image format conversion are established based on the Gradle build tool, and the corresponding dependencies and WebP conversion tools are configured, further comprising: In the root directory of the project file, configure the path for finding and loading dependencies based on the Gradle build tool and integrate the gradlePlugin library.
3. The method for converting image resource types during the in-vehicle application compilation phase according to claim 2, It is characterized in that The Gradle build tool is specifically a build.gradle file, and the configuration is used to find and load the path of the dependencies, specifically: find and load the path of the dependencies through the classpath path configuration in the build.gradle file.
4. The method for converting image resource types during the in-vehicle application compilation phase according to claim 2, It is characterized in that The gradlePlugin library is a custom library, and the build.gradle file references the gradlePlugin library through the apply keyword.
5. The method for converting image resource types during the in-vehicle application compilation phase according to claim 1, It is characterized in that The execution of the initialization logic of the gradlePlugin library, the creation of a WebP format conversion task, the merging of the to-be-converted images to generate a resource set, and the acquisition of the image set that needs to be converted to WebP further includes: Place the WebP conversion tool in a specific folder under the project root directory; Configure the compression quality of webp through the gradle.properties configuration file in the Gradle build tool; Execute the initialization logic of the gradlePlugin library, create a WebP format conversion task, merge the images to be converted to generate a resource set, search for mergeRes, and obtain the image set that needs to be converted to WebP; The collection is traversed to perform whitelist verification, and the conversion command is executed on the png images that are not in the whitelist through the WebP conversion tool, and the corresponding retention operation is performed according to the size of the output image after the format conversion.
6. The method for converting image resource types during the in-vehicle application compilation phase according to claim 1, It is characterized in that The conversion command is executed on the picture set, and the converted output pictures are retained or deleted according to different business logics, and finally packaged into an APK, specifically: Determine the size of the input image and the output image. If the output image is smaller than the input image, convert it to WebP.
7. A system for converting image resource types during the compilation phase of an in-vehicle application. It is characterized in that include: The software environment resource configuration module builds software environment resources for image format conversion based on the Gradle build tool, and configures corresponding dependencies and WebP conversion tools; The WebP format conversion task creation module executes the initialization logic of the gradlePlugin library, creates a WebP format conversion task, merges the images to be converted to generate a resource set, and obtains the image set that needs to be converted to WebP; The picture set conversion module executes the conversion command on the picture set, performs corresponding retention or deletion operations on the converted output pictures according to different business logics, and finally packages them into APK.
8. A vehicle computer, It is characterized in that The vehicle computer includes the system for converting image resource types during the vehicle application compilation phase according to claim 7, and executes the method for converting image resource types during the vehicle application compilation phase according to any one of claims 1 to 6.
9. An electronic device, It is characterized in that include: A processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus; a computer program is stored in the memory, and when the computer program is executed by the processor, the processor executes the steps of the method described in any one of claims 1 to 6.
10. A computer-readable storage medium, It is characterized in that It stores a computer program executable by an electronic device, and when the computer program runs on the electronic device, the electronic device executes the steps of the method described in any one of claims 1 to 6.
