CN-122024260-A - Image file generation method, image file and system
Abstract
The application relates to an image file generation method, an image file and a system, which comprise the steps of identifying a text area in an original image, extracting original text of an original language mark in the text area, identifying position information and visual rendering attributes of the original text in the original image as global style data, removing the original text in the original image to obtain basic image data, translating the original text into translated texts corresponding to different language marks, using the translated texts corresponding to the different language marks as multi-language text data, creating an initial multi-layer container structure file, filling the basic image data into a basic image layer, filling the global style data into a global style layer, filling the multi-language text data into a multi-language text layer, and packaging to obtain a target image file, wherein the target image file is used for generating target images of different language marks. The embodiment of the application improves the generation efficiency of the images of different language marks.
Inventors
- LI QIANG
- PENG FEI
Assignees
- 北京城市网邻信息技术有限公司
Dates
- Publication Date
- 20260512
- Application Date
- 20260116
Claims (14)
- 1. An image file generation method, the method comprising: Acquiring an original image; Identifying a text region in the original image, extracting an original text marked by an original language in the text region, and identifying position information and visual rendering attributes of the original text in the original image as global style data; removing the original text corresponding to the position of the position information in the original image to obtain basic image data; Translating the original text into translated texts corresponding to different language identifiers, and taking the translated texts corresponding to the different language identifiers as multi-language text data; creating an initial multi-level container structure file, wherein the initial multi-level container structure file at least comprises a basic image layer, a global style layer and a multi-language text layer; Filling the basic image data into the basic image layer, filling the global style data into the global style layer, filling the multi-language text data into the multi-language text layer, and packaging to obtain a target image file, wherein the target image file is used for generating target images with different language identifications.
- 2. The method according to claim 1, wherein said removing the original text corresponding to the position of the position information in the original image to obtain the base image data includes: Removing the original text corresponding to the position of the position information in the original image through a preset image processing tool or an artificial intelligent image segmentation model, and repairing the position of the original image, from which the original text is removed, to obtain basic image data.
- 3. The method of claim 1, wherein the visual rendering attributes comprise one or more of font family, font size, color, transparency, word spacing, alignment, and word orientation.
- 4. The method of claim 1, wherein the step of determining the position of the substrate comprises, The global style data is stored in the global style layer according to a first appointed format, and the first appointed format at least comprises one or more of an object representation JSON format and an extensible markup language XML format; The multi-language text data is stored in the multi-language text layer according to a second specified format, wherein the second specified format at least comprises one or more of a binary key value pair format, an object representation JSON format and an extensible markup language XML format.
- 5. The method of claim 1, wherein the global style data has a style inheritance rule defined therein, the style inheritance rule being a visual rendering attribute of the global style data that allows an overlay portion or inherits a visual rendering attribute of all of the global style data.
- 6. The method of claim 1, wherein the extension of the target image file is a custom extension, the custom extension comprising at least xlimg, and wherein the header of the target image file comprises a magic number for identifying the format of the target image file.
- 7. An image generation method based on an image file, the method comprising: The method comprises the steps of loading a target image file, wherein the target image file is generated according to the image file generation method according to any one of claims 1 to 6, and at least comprises a basic image layer, a global style layer and a multi-language text layer, wherein the basic image layer comprises basic image data, the global style layer comprises global style data, the global style data comprises position information and visual rendering attributes of original texts of original images, the multi-language text layer comprises multi-language text data, and the multi-language text data comprises translation texts corresponding to different language identifications; Acquiring a target language identifier; Acquiring a target translation text corresponding to the target language identifier from a multilingual text layer of the target image file; And filling the target translation text into a position corresponding to the basic image data according to the position information, and rendering the basic image data filled with the target translation text by adopting the visual rendering attribute to generate a target image corresponding to the target language identifier.
- 8. The method of claim 7, wherein the obtaining the target language identification comprises: Determining a region identifier corresponding to the terminal equipment loading the target image file; and acquiring the language identifier corresponding to the region identifier as a target language identifier.
- 9. The method of claim 7, wherein rendering the base image data populated with the target translated text using visual rendering attributes of the global style data comprises: If the appointed attribute configuration data corresponding to the target language identifier is obtained from the multi-language text layer, rendering the basic image data filled in the target translation text by adopting visual rendering attributes in the appointed attribute configuration data; and if the appointed attribute configuration data corresponding to the target language identifier is not obtained from the multi-language text layer, rendering the basic image data filled in the target translation text by adopting the visual rendering attribute in the global style data.
- 10. The method of claim 7, wherein the visual rendering attributes comprise dynamic attributes, the rendering the base image data populated with the target translated text using the visual rendering attributes of the global style data comprising: if the visual rendering attribute of the global style data does not belong to the dynamic attribute, rendering the basic image data filled in the target translation text by adopting an attribute value corresponding to the visual rendering attribute; if the visual rendering attribute of the global style data belongs to a dynamic attribute, a predefined logic or an external parameter is obtained, an attribute value corresponding to the dynamic attribute is determined according to the predefined logic or the external parameter, and the basic image data filled in the target translation text is rendered by adopting the attribute value corresponding to the dynamic attribute.
- 11. An image file generated according to the image file generation method of any one of claims 1 to 6, the image file comprising at least a base image layer, a global style layer, and a multilingual text layer.
- 12. A multi-language UI library construction system adapted to the image file of claim 11, comprising: the template management module is used for managing the image file; the text translation management module is used for centrally managing multi-language text data in a multi-language text layer of the image file; the compiling and publishing module is used for determining a target language identifier, acquiring a target translation text corresponding to the target language identifier from the text translation management module, and generating a target image with the image file managed by the template management module so as to generate a deployable static resource or dynamic service interface according to the target image.
- 13. An electronic device, comprising: A processor; A memory for storing processor-executable instructions; wherein the processor is configured to execute the instructions to implement the image file generation method of any one of claims 1 to 6 or to implement the image file based image generation method of any one of claims 7 to 10.
- 14. A computer readable storage medium, characterized in that instructions in the storage medium, when executed by a processor of a mobile terminal, enable the mobile terminal to perform the image file generation method of any one of claims 1 to 6 or to perform the image file based image generation method of any one of claims 7 to 10.
Description
Image file generation method, image file and system Technical Field The application belongs to the field of image processing, and particularly relates to an image file generation method, an image file and a system. Background In globalization software, websites, mobile applications, and multimedia content development, in order to accommodate users in different country regions, it is necessary to make images of multiple language versions (language identification) for the same UI (User Interface) element, banner (Banner advertisement), information graph, operation guide, or the like, and for example, designers need to make images of language identifications of China, england, japan, korea, or the like. It is currently common practice to manually replace text on an original image by a designer for each language identifier, wherein the original image is usually in a format such as PSD (Photoshop dedicated format), and then ensure consistency of style and layout, and respectively export static image files in a format such as PNG, JPG, and the like. However, although the above-mentioned general method can accurately obtain images of different language marks with consistent patterns and layouts, the more language marks, the more images of different language marks need to be made, resulting in a linear increase in the workload of repeatedly making images. Disclosure of Invention It is an object of embodiments of the present application to provide an image file generation method, an image file and a system, so as to provide a method for overcoming or at least partially solving the above-mentioned problems. In order to solve the technical problems, the application is realized as follows: an image file generation method, the method comprising: Acquiring an original image; Identifying a text region in the original image, extracting an original text marked by an original language in the text region, and identifying position information and visual rendering attributes of the original text in the original image as global style data; removing the original text corresponding to the position of the position information in the original image to obtain basic image data; Translating the original text into translated texts corresponding to different language identifiers, and taking the translated texts corresponding to the different language identifiers as multi-language text data; creating an initial multi-level container structure file, wherein the initial multi-level container structure file at least comprises a basic image layer, a global style layer and a multi-language text layer; Filling the basic image data into the basic image layer, filling the global style data into the global style layer, filling the multi-language text data into the multi-language text layer, and packaging to obtain a target image file, wherein the target image file is used for generating target images with different language identifications. An image generation method based on an image file, the method comprising: Loading a target image file; the target image file is generated according to the image file generation method, wherein the image file at least comprises a basic image layer, a global style layer and a multilingual text layer, the basic image layer comprises basic image data, the global style layer comprises global style data, the global style data comprises position information and visual rendering attributes of an original text of an original image, the multilingual text layer comprises multilingual text data, and the multilingual text data comprises translation texts corresponding to different language identifications; Acquiring a target language identifier; Acquiring a target translation text corresponding to the target language identifier from a multilingual text layer of the target image file; And filling the target translation text into a position corresponding to the basic image data according to the position information, and rendering the basic image data filled with the target translation text by adopting the visual rendering attribute to generate a target image corresponding to the target language identifier. An image file is generated according to the image file generation method, and the image file at least comprises a basic image layer, a global style layer and a multilingual text layer. A multi-language UI material library construction system is applicable to the image files, and comprises: the template management module is used for managing the image file; the text translation management module is used for centrally managing multi-language text data in a multi-language text layer of the image file; the compiling and publishing module is used for determining a target language identifier, acquiring a target translation text corresponding to the target language identifier from the text translation management module, and generating a target image with the image file managed by the template management module so as to generate a