Method and device for generating special effect template file, application method, device, equipment and medium
By recording layer information, special effects information, and related information as data and storing the materials on the server, the problems of large special effects template file size and difficulty in updating are solved, resulting in small, easily disseminated, and flexibly applicable special effects template files.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BEIJING ZITIAO NETWORK TECH CO LTD
- Filing Date
- 2022-06-10
- Publication Date
- 2026-06-19
AI Technical Summary
Existing special effects template files are too large to be easily distributed online, and the special effects materials are difficult to update and optimize, requiring the creation of new template files.
Layer information, effect information, and association information are recorded as layout record data, effect record data, and association record data respectively according to the specified format, and effect template files are generated. Effect materials are stored on the server, and only the acquisition method information is recorded.
The size of the special effects template files has been reduced, making them easier to distribute and update. The user experience is more flexible and convenient, and the latest optimized materials can be obtained.
Smart Images

Figure CN117252955B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of data processing technology, and in particular to a method, application method, apparatus, device and medium for generating special effects template files. Background Technology
[0002] To enhance the expressiveness of images, special effects such as text, stickers, and filters are often added to the original images during image processing. Template creators also produce dedicated special effects template files, which contain information such as the special effects materials used in image editing. This allows others to directly apply the special effects template files to the original images, enabling the original images to quickly and directly display the effects corresponding to the special effects template files. The existence of special effects template files effectively lowers the barrier for users to participate in image editing and image creation. In addition, special effects template files can be applied to other images in batches quickly and easily, and can be widely used in fields such as advertising production and image-based social networking.
[0003] However, existing special effects template files typically require all the special effects materials used for image editing to be packaged into a single file during the creation process, resulting in large file sizes that hinder rapid dissemination online. Furthermore, the special effects materials contained in the template files are fixed and difficult to update during subsequent dissemination and use. If a particular special effects material needs to be updated or optimized, a new special effects template file containing the optimized material must be created. In summary, existing special effects template files are inconvenient to use. Summary of the Invention
[0004] To solve the above-mentioned technical problems, or at least partially solve them, this disclosure provides a method, application method, apparatus, device, and medium for generating special effects template files.
[0005] This disclosure provides a method for generating a special effects template file. The method includes: acquiring layer information of a target image; wherein the layer information includes layout information of the layers used in the target image, special effects information of the special effects materials used in the layers, and association information between different layers; recording the layout information according to a first specified format to obtain layout recording data; recording the special effects information according to a second specified format to obtain special effects recording data; wherein the special effects materials are all stored on a server, and the special effects recording data contains information on the acquisition method of the special effects materials; recording the association information according to a third specified format to obtain association recording data; and generating a special effects template file based on the layout recording data, the special effects recording data, and the association recording data.
[0006] Optionally, the step of obtaining layer information of the target image includes: obtaining an editing record file of the target image; and extracting layer information of the target image based on the editing record file.
[0007] Optionally, the step of recording the layout information according to a first specified format to obtain layout record data includes: parsing the layout information according to a plurality of preset first fields to obtain the field value corresponding to each first field; wherein, the plurality of first fields are used to represent multiple of the following information: layer layout type information, layer specified vertex coordinate information, layer width information, layer height information, layer scaling information, layer displacement information, layer rotation information, and layer anchor point information; and recording the field names and field values of the plurality of first fields according to the first specified format to obtain layout record data.
[0008] Optionally, the step of recording the special effects information according to a second specified format to obtain special effects recording data includes: parsing the special effects information according to a plurality of preset second fields to obtain the field value corresponding to each second field; wherein, the plurality of second fields are used to represent multiple of the following information: special effects material type information, special effects material acquisition method information, special effects material performance intensity information, and special effects material supported platform information; and recording the field name and field value of the plurality of second fields according to the second specified format to obtain special effects recording data.
[0009] Optionally, the step of recording the association information according to a third specified format to obtain association record data includes: determining the hierarchical relationship between multiple layers based on the association information; and recording the hierarchical relationship based on a tree structure to obtain association record data.
[0010] Optionally, the step of generating an effects template file based on the layout record data, the effects record data, and the associated record data includes: performing a serialization operation on the layout record data, the effects record data, and the associated record data to obtain a serialization result; and generating an effects template file based on the serialization result.
[0011] This disclosure also provides a method for applying a special effects template file, including: acquiring an image to be processed and a target special effects template file; wherein the target special effects template file is obtained using the aforementioned method for generating special effects template files; parsing the target special effects template file to obtain target layout record data, target special effects record data, and target association record data; acquiring the target special effects material based on the acquisition method information of the target special effects material contained in the target special effects record data; and editing the image to be processed based on the target layout record data, the target special effects record data, the target association record data, and the target special effects material.
[0012] Optionally, the step of editing the image to be processed based on the target layout record data, the target effect record data, the target association record data, and the target effect material includes: performing layer creation and layout operations on the image to be processed based on the target association record data and the target layout record data to obtain multiple target layers; and mounting each of the target effect materials onto the corresponding target layer based on the target effect record data.
[0013] This disclosure also provides an electronic device, which includes: a processor; a memory for storing executable instructions of the processor; the processor is configured to read the executable instructions from the memory and execute the instructions to implement the special effects template file generation method and application method provided in this disclosure.
[0014] This disclosure also provides a computer-readable storage medium storing a computer program for executing the method for generating and applying special effects template files as provided in this disclosure.
[0015] The method and apparatus for generating special effects template files provided in this disclosure can acquire layer information of a target image (including layout information of the layers used in the target image, special effects information of the special effects materials used in the layers, and association information between different layers); then record the layout information according to a first specified format to obtain layout recording data; record the special effects information according to a second specified format to obtain special effects recording data; wherein, the special effects materials are all stored on a server, and the special effects recording data package contains information on the acquisition method of the special effects materials, and the association information is recorded according to a third specified format to obtain association recording data; finally, a special effects template file is generated based on the layout recording data, the special effects recording data, and the association recording data. Since the special effects materials are stored on a server, the special effects template file obtained by the above method does not contain special effects materials, but contains information on the acquisition method of the special effects materials. This not only greatly reduces the size of the special effects template file, but also makes it easier to update and optimize the special effects materials stored on the server. The special effects materials obtained by the special effects template file based on the acquisition method information can be updated and optimized materials, without the need to create new special effects template files for updated and optimized special effects materials. In summary, the special effects template file generated by the above method is easier to use.
[0016] The method and apparatus for applying the special effects template file provided in this disclosure can acquire an image to be processed and a target special effects template file generated in the above manner. Then, the target special effects template file is parsed to obtain target layout recording data, target special effects recording data, and target association recording data. Based on the acquisition method information of the target special effects material contained in the target special effects recording data, the target special effects material is acquired. Finally, the image to be processed is edited based on the target layout recording data, target special effects recording data, target association recording data, and target special effects material. This method can directly parse the target special effects template file generated in the aforementioned manner and acquire the target special effects material based on the acquisition method information recorded therein. Then, image editing is performed based on the various data obtained from the parsing and the target special effects material. The special effects template file, which does not contain special effects material, is smaller in size and easier to distribute / acquire. Since the special effects material is stored on a server and can be freely updated and optimized, the acquired special effects material can be the latest material updated and optimized on the server. Overall, this makes the application of special effects template files more flexible and convenient, resulting in a higher user experience.
[0017] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this disclosure, nor is it intended to limit the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description
[0018] The accompanying drawings, which are incorporated in and form a part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure.
[0019] To more clearly illustrate the technical solutions in the embodiments of this disclosure or the prior art, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0020] Figure 1 A flowchart illustrating a method for generating a special effects template file according to an embodiment of this disclosure;
[0021] Figure 2 A schematic diagram of a layer structure provided in an embodiment of this disclosure;
[0022] Figure 3 A flowchart illustrating a method for applying a special effects template file provided in this embodiment of the disclosure;
[0023] Figure 4 This is a schematic diagram illustrating the application of a special effects template file provided in an embodiment of the present disclosure;
[0024] Figure 5 A structural block diagram of a special effects template file generation device provided in this embodiment of the disclosure;
[0025] Figure 6 A structural block diagram of an application device for a special effects template file provided in this embodiment of the disclosure;
[0026] Figure 7 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this disclosure. Detailed Implementation
[0027] To better understand the above-mentioned objectives, features, and advantages of this disclosure, the solutions disclosed herein will be further described below. It should be noted that, unless otherwise specified, the embodiments and features described herein can be combined with each other.
[0028] Numerous specific details are set forth in the following description in order to provide a full understanding of this disclosure, but this disclosure may also be implemented in other ways different from those described herein; obviously, the embodiments in the specification are only some, and not all, of the embodiments of this disclosure.
[0029] Considering that the special effects template files used in related technologies generally have problems such as large size and inconvenience in updating, in order to improve at least one of the above problems, this disclosure provides a method for generating special effects template files, an application method, an apparatus, a device, and a medium, which are described by example below.
[0030] Furthermore, it should be noted that the defects in the special effects template files in the relevant technologies are the result of the applicant's practice and careful research. Therefore, the discovery process of the above defects and the solutions proposed by the present disclosure embodiments for the above defects in the following text should be regarded as the applicant's contribution to the present disclosure.
[0031] This disclosure first provides a method for generating special effects template files. This method can be executed by a device for generating special effects template files, wherein the device can be implemented in software and / or hardware, and is generally integrated into an electronic device. For example... Figure 1 The diagram shows a method for generating a special effects template file. This method mainly includes the following steps S102 to S110:
[0032] Step S102: Obtain the layer information of the target image; wherein, the layer information includes the layout information of the layers used in the target image, the special effects information of the special effects materials used in the layers, and the association information between different layers.
[0033] The aforementioned target image is an image obtained through editing with special effects materials. For example, the target image is the final image obtained by the template creator through editing the original image. Typically, at least one layer is created during the image editing process, and special effects materials can be attached to the layers to make the image more impactful and richer in presentation. These special effects materials include, but are not limited to, stickers, text, filters, graffiti, images, beauty filters, and makeup. When obtaining the layer information of the target image, the layer information of at least one specified layer of the target image can be obtained. This at least one specified layer can be a layer specified by the template creator, or it can be all layers, or it can be all layers except the background layer; this disclosure does not limit the scope of the embodiments.
[0034] In some implementations, an editing log file of the target image can be obtained first; then, the layer information of the target image can be extracted based on the editing log file. The aforementioned editing log file can completely record the image editing process, that is, it records the steps the image editor took to obtain the current target image. In practical applications, when an image editor uses image editing software, the software can completely record each step of the image editing process, thus clearly recording the layer creation process, the layout of each layer, the special effects information attached to each layer, and all other layer-related information. This embodiment of the present disclosure can directly extract the layer information of the target image from the editing log file, which is very convenient and fast.
[0035] Step S104: Record the layout information according to the first specified format to obtain layout record data.
[0036] This disclosure does not limit the first specified format. The recording method of layout information in the special effects template file can be determined according to requirements. For example, the first specified format can be a format where field names correspond to field values. Typically, the layout information of a layer is mainly used to characterize the specific position of the layer through multiple parameters. For example, the layout information includes information describing the size, displacement, rotation, scaling, etc., of the layer, used to locate the layer's position in the entire canvas. The layout information contains multiple sub-information such as displacement, rotation, and scaling. Therefore, the sub-information in the layout information can be recorded according to the first specified format to obtain layout recording data for subsequent parsing and application.
[0037] Step S106: Record the special effects information according to the second specified format to obtain special effects record data; wherein, the special effects materials are all stored on the server, and the special effects record data packet contains information on how the special effects materials were obtained.
[0038] This disclosure does not limit the second specified format. The recording method of special effects information in the special effects template file can be determined according to requirements. For example, the second specified format can be a format where field names correspond to field values. Since the target image may have multiple layers, and each layer may use one or more special effects, the special effects information corresponding to each layer can be specifically recorded. For example, the second specified format can record the special effects information corresponding to each layer in the form of an array. The special effects information may include various sub-information such as the type of special effects material, the acquisition method of the special effects material, the special effects intensity of the special effects material, and the supported platforms, which can be recorded in the form of field names and field values. In a specific example, each layer can correspond to an array, and a layer can simultaneously attach multiple special effects. Each element in the array corresponding to the layer represents a certain type of special effect attached to that layer. According to the second specified format, the sub-information in the special effects information corresponding to each layer can be clearly recorded to obtain special effects recording data, which is convenient for subsequent parsing and application.
[0039] It should be noted that the special effects recording data does not include special effects materials; it only records the material type and acquisition method of the special effects materials. The special effects materials are stored on a designated server. When used, the corresponding special effects materials can be automatically downloaded based on the acquisition method information. This not only reduces the size of the special effects template file but also avoids the problem of not being able to update and optimize due to packaging into the special effects template file. The special effects materials are stored on the server (cloud), which facilitates flexible updates and optimizations. The special effects materials downloaded from the server later based on the acquisition method can also be updated and optimized materials, making them easier to use.
[0040] In some implementations, the acquisition method information may include the special effects material identifier (such as a resource package ID) corresponding to the special effects material on the server and the download source identifier (such as a server identifier). Based on the download source identifier, a server that can be used to download the required special effects material can be determined, and the resource package of the special effects material can be downloaded using the special effects material identifier to obtain the special effects material. In this implementation, the server storing the special effects material assigns a corresponding special effects material identifier to each special effects material so that the required material can be quickly found using the special effects material identifier.
[0041] Step S108: Record the associated information according to the third specified format to obtain associated record data.
[0042] The associated information may include hierarchical relationships (or ownership relationships) between different layers. This disclosure does not limit the third specified format; the recording method of associated information in the special effects template file can be determined according to requirements. For example, the third specified format can be a tree structure format. In specific implementations, specified characters can be used in the third specified format to represent the hierarchical relationships between different layers. The hierarchical relationships between different layers ultimately present a tree structure, such as a layer group containing several sublayers or sublayer groups, and sublayer groups further containing sublayers or sublayer groups, thus forming a tree structure.
[0043] Step S110: Generate an effects template file based on layout record data, effects record data, and associated record data.
[0044] In some implementations, layout record data, effect record data, and associated record data can be directly packaged into an effect template file. In other implementations, the layout record data, effect record data, and associated record data can be further processed, such as performing serialization or converting the data to a specified base (such as binary), thereby further compressing the effect template file, reducing its size, and making it easier for the effect template file to be read and used on a computer.
[0045] In summary, the method for generating special effects template files provided in this embodiment does not contain special effects materials in the resulting special effects template files because the special effects materials are stored on the server. Instead, it contains information on how the special effects materials were obtained. This not only greatly reduces the size of the special effects template files, but also makes it easier to update and optimize the special effects materials stored on the server. The special effects materials obtained from the special effects template files based on the information on how the materials were obtained can be updated and optimized materials. There is no need to create new special effects template files for the updated and optimized materials. Therefore, the special effects template files generated in the above manner are easier to use.
[0046] For ease of understanding, this disclosure provides an implementation of the step of recording layout information according to a first specified format to obtain layout record data (i.e., the aforementioned step S104), which can be performed with reference to the following steps a to b:
[0047] Step a: Parse the layout information according to multiple preset first fields to obtain the field value corresponding to each first field; wherein, the multiple first fields are used to represent multiple of the following information: layer layout type information, layer specified top corner coordinate information, layer width information, layer height information, layer scaling information, layer displacement information, layer rotation information, and layer anchor point information.
[0048] Step b: Record the field names and values of multiple first fields according to the first specified format to obtain layout record data.
[0049] The field name and field value of the first field can be set by the user. This disclosure provides the following specific implementation example:
[0050] The layout type information for layers can have field names such as `type`, and field values such as `aspect_fit`, `center`, `fixed`, and `aspect_fill`. Different field values represent different layer layout methods, which are explained below: `aspect_fit` means the current layer's width or height fills the parent layer, and the layer's center point is aligned with the parent layer's center point. `center` means the current layer's center point is aligned with the parent layer's center point, but the width and height are based on the values recorded in the `width` and `height` fields. `fixed` means the relative coordinates of the current layer's bottom left corner to the parent layer's bottom left corner are based on the values recorded in the `x` and `y` fields, and the width and height are based on the values recorded in the `width` and `height` fields. `aspect_fill` means the current layer's width and height both fill the parent layer, and the layer's center point is aligned with the parent layer's center point. These are just examples and should not be considered limitations. In practical applications, other field names can be used to represent layout types, and other field values can represent specific layout methods.
[0051] The field names corresponding to the specified vertex coordinates of a layer can be, for example, "x" and "y". When the field name is "x", the corresponding field value is the x-coordinate of the bottom-left corner of the layer; when the field name is "y", the corresponding field value is the y-coordinate of the bottom-left corner of the layer. This is just an example and should not be considered a limitation. In practical applications, other field names can be used to represent the specified vertex coordinates, and other field values can represent the actual vertex coordinates.
[0052] The field name for layer width information can be something like "width," and the corresponding field value can be a numeric value representing the layer width. When the field value is empty, it indicates that the width will be dynamically adjusted according to the actual effect of the layer being mounted.
[0053] The field name for layer height information can be something like "height," and the corresponding field value can be a numeric value representing the layer height. When the field value is empty, it indicates that the height will be dynamically adjusted according to the actual effect of the layer being mounted.
[0054] The field name for layer scaling information can be something like "scale", and the corresponding field value can be something like {x:1.34,y:1.34}, which describes the scaling values in the x and y directions, respectively.
[0055] The field name for the layer displacement information can be something like "translate", and the corresponding field value can be something like "{x:23,y:30,z:0}", which describes the displacement values in the x, y, and z directions, respectively.
[0056] The field name for the layer rotation information can be something like "rotate", and the corresponding field value can be something like "{x:90,y:45,z:180}", which describes the rotation angles in the x, y, and z directions, respectively.
[0057] The field name for the layer anchor point information can be something like "anchor", and the corresponding field value can be something like "{x:0.5,y:0.5}". This is used to represent the anchor point for the layer to perform displacement, rotation, and scaling changes. Its value is a normalized coordinate value relative to itself.
[0058] In actual recording, the field value named "type" can be of type string, the field values named "x", "y", "width", "height", and "translate" can be of type int, the field values named "translate" and "rotate" can be of type int[], and the field values named "scale" and "anchor" can be of type float[].
[0059] It should be clarified that the above are illustrative examples and should not be considered as limitations. For instance, in practical applications, other field names or values can be used for the sub-information included in the layout information, and this is not restricted here. Furthermore, the layout information does not necessarily include all of the above information. For example, it may only include the layer's layout type information and the layer's specified top corner coordinates, instead of necessarily including sub-information such as layer width, layer height, layer scaling, layer displacement, layer rotation, and layer anchor point information. The corresponding sub-information is only included when the layer is scaled, displaced, or rotated. In addition, the layout information may also include other sub-information used to characterize the layer's position; the above examples are not exhaustive.
[0060] This disclosure provides an implementation method for recording special effects information according to a second specified format to obtain special effects recording data (i.e., the aforementioned step S106), which can be performed with reference to the following steps A to B:
[0061] Step A: Parse the special effects information according to multiple preset second fields to obtain the field value corresponding to each second field; wherein, the multiple second fields are used to represent multiple of the following information: special effects material type information, special effects material acquisition method information, special effects material performance intensity information, and special effects material supported platform information;
[0062] Step B involves recording the field names and values of multiple second fields according to the second specified format to obtain special effect record data.
[0063] The field name and field value of the second field can be set by the user. This disclosure provides the following specific implementation example:
[0064] The field name corresponding to the type information of the special effects material can be, for example, "key". The corresponding field value can be, for example, a field value of "filter" indicates a filter effect.
[0065] The field name for the information on how to obtain special effects materials can be, for example, resource_id, and the corresponding field value can be, for example, resource package ID. For example, resource package ID is the ID identifier configured by the server storing the special effects materials, which is used to retrieve the corresponding special effects material resources.
[0066] The field name corresponding to the intensity information of special effects materials can be, for example, "value", and the corresponding field value can be, for example, a normalized intensity value, taking the value [0,1], which can represent the intensity of the special effects.
[0067] The field name for the platform support information of special effects materials can be something like "platform", and the corresponding field value can be something like "all", "android", or "ios". Here, "all" means that both platforms are supported, "android" means that only the Android platform is supported, and "ios" means that only the iOS platform is supported.
[0068] In actual recording, the values of fields named key, resource_id, and platform can all be of type string, and the values of fields named value can be of type float.
[0069] It should be clarified that the above are merely illustrative examples and should not be considered as limitations. For instance, in practical applications, other field names or values can be used for the aforementioned sub-information included in the special effects information, and this is not restricted here. Furthermore, the special effects information does not necessarily include all of the above information; for example, it may not be necessary to include sub-information such as the platform information supported by the special effects material. In addition, the special effects information may also include other sub-information related to the special effects; the above examples are not exhaustive.
[0070] In practical applications, in image editing, a single layer can hold one or more special effects. For ease of recording, the effect information for each layer can be recorded as an array. Each element in the array represents the type of effect used by that layer. For example, if a layer uses N effects, the corresponding array will contain N elements. Each element can record the corresponding effect information using the field name-field value format described above. This method clearly displays the effect information for each layer in the effect template file. The array above is just an example; in practical applications, it is not limited to the array format. For instance, you can simply set a corresponding layer identifier for each layer and associate the effect information attached to that layer with that layer using the field name-field value format described above.
[0071] Because the aforementioned special effects recording data does not contain specific special effects resources, but only records information on how the special effects resources were obtained (such as the resource package ID mentioned above), the actual special effects resources are stored on cloud servers and are not distributed along with the special effects template files. Since the special effects template files do not package and distribute specific special effects resources, but only contain descriptive information about the special effects resources, combined with text compression algorithms, the entire special effects template file size can be controlled to the KB level, greatly reducing the size of the special effects template file and making it easier to distribute, apply, and store on the network.
[0072] This disclosure provides an implementation of the step of recording associated information according to a third specified format to obtain associated record data (i.e., the aforementioned step S108). For example, the hierarchical relationship between multiple layers can be determined based on the associated information; the hierarchical relationship is recorded based on a tree structure to obtain associated record data.
[0073] For easier understanding, please refer to the following: Figure 2 The diagram illustrates a layer structure, showing that the effects template file contains a top-level layer group, which in turn contains multiple layers. Each layer corresponds to a specific layout and effects, such as... Figure 2 As shown, a layer can have one or more effects attached. Figure 2 This is just a brief example, illustrating only one layer group and should not be considered a limitation. In practical applications, a layer group can contain several sublayers or sublayer groups, and sublayer groups can further contain sublayers or sublayer groups, thus forming a tree structure. Figure 2 It can clearly show the hierarchical relationship between layers. In practical applications, a tree-like hierarchical relationship can be presented using a specified data recording method, namely the aforementioned associated record data.
[0074] After obtaining the layout record data, effect record data, and associated record data, a serialization operation can be performed on these data to obtain a serialization result. An effect template file is then generated based on this result. In one specific implementation, the data can be serialized as a JSON string, and the serialization result stored in a file to obtain the effect template file. Serialization further compresses the data, reducing the size of the effect template file. In subsequent applications, the effect template file is decoded (e.g., by performing deserialization) to obtain the data recorded in the effect template file, which can then be applied to the image to be edited.
[0075] Building upon the foregoing, this disclosure also provides a method for applying special effects template files. This method can be executed by an application device for the special effects template files, wherein the device can be implemented using software and / or hardware, and is generally integrated into an electronic device. Figure 3 The diagram shows a flowchart of a method for applying a special effects template file. This method mainly includes the following steps S302 to S308:
[0076] Step S302: Obtain the image to be processed and the target effect template file; wherein, the target effect template file is obtained by the aforementioned method for generating effect template files, which will not be described in detail here.
[0077] In practical applications, users can select the image to be processed as the image to be processed, and select the desired special effects template file as the target special effects template file.
[0078] Step S304: Parse the target effect template file to obtain target layout record data, target effect record data, and target association record data.
[0079] For example, the target effect template file is a serialized file. The target effect template file can be deserialized and parsed, and the parsed layout record data, effect record data and associated record data can be used as target layout record data, target effect record data and target associated record data, respectively.
[0080] Step S306: Obtain the target special effects material based on the acquisition method information of the target special effects material contained in the target special effects record data. In some embodiments, the acquisition method information includes the special effects material identifier (such as resource package ID) corresponding to the special effects material on the server and the download source identifier (such as server identifier). Based on the download source identifier, the server used to download the required special effects material can be determined, and the resource package of the special effects material can be downloaded using the special effects material identifier, thus obtaining the target special effects material.
[0081] Step S308: Edit the image to be processed based on the target layout record data, target effect record data, target association record data, and target effect materials.
[0082] In some implementations, layer creation and layout operations can be performed on the image to be processed based on target association record data and target layout record data to obtain multiple target layers. Then, based on target effect record data, each target effect material is mounted onto the corresponding target layer. In specific implementations, the hierarchical relationship of each layer can be known based on the target association record data, and the layout method of each layer can be known based on the target layout record data. Thus, layer creation and layout are performed on the image to be processed, and corresponding effect materials are mounted on each layer based on the target effect record data. After the above editing, the image to be processed can fully present the image effects that the target effect template file can express.
[0083] Since special effects template files without special effects materials are smaller in size and easier to distribute / obtain, while special effects materials stored on the server can be freely updated and optimized, the special effects materials obtained can be the latest materials updated and optimized on the server. All of these factors make the application of special effects template files more flexible and convenient, resulting in a higher user experience.
[0084] See Figure 4 The diagram illustrates the application of a special effects template file, roughly showing three main stages in the template application process: special effects template file parsing, downloading dependent resource packages, and special effects restoration. In the special effects template file parsing stage, the client can obtain the special effects resources required by the template file, such as the resource package ID and server identifier. Based on the resource package ID, the client downloads the corresponding resource file from the server port, thus obtaining the special effects materials needed for the special effects template file. After the resource package is downloaded, the client can restore the special effects based on the dependent resource package. Specifically, the client can recreate the corresponding layers / layer groups on the image to be processed, and perform the corresponding layer layout and special effects mounting, thereby restoring the specific effects of the special effects template file to the image. Since the resource package is stored on the server, the server can update and optimize the resource package (i.e., special effects materials) corresponding to a specific resource package ID as needed (such as effect optimization and performance optimization). Therefore, the special effects materials downloaded by the client from the server port are always updated and optimized, ensuring that users get the latest effects when applying the special effects template file.
[0085] In summary, the method for generating special effects template files provided in this disclosure produces template files with very small sizes, averaging around KB, which greatly facilitates the dissemination and use of these templates online. Furthermore, since the special effects materials are stored on a server rather than packaged within the template files, special effects designers can easily update the effects attached to published templates. This allows users to download the updated effects materials and achieve the latest visual effects when using the desired templates.
[0086] Corresponding to the aforementioned method for generating special effects template files, this disclosure also provides an apparatus for generating special effects template files, see [link to apparatus]. Figure 5 The diagram shown illustrates the structure of a device for generating special effects template files, which mainly includes the following modules:
[0087] The information acquisition module 502 is used to acquire the layer information of the target image; wherein, the layer information includes the layout information of the layers used in the target image, the special effects information of the special effects materials used in the layers, and the association information between different layers;
[0088] The layout recording module 504 is used to record layout information according to a first specified format to obtain layout record data.
[0089] The special effects recording module 506 is used to record special effects information according to a second specified format to obtain special effects recording data; wherein, the special effects materials are all stored on the server, and the special effects recording data packet contains information on how the special effects materials were obtained;
[0090] The association record module 508 is used to record association information according to a third specified format to obtain association record data;
[0091] The file generation module 510 is used to generate special effects template files based on layout record data, special effects record data, and associated record data.
[0092] The special effects template files obtained by the above method do not contain special effects materials, but rather information on how to obtain the special effects materials. This not only greatly reduces the size of the special effects template files, but also makes it easier to update and optimize the special effects materials stored on the server. The special effects materials obtained by the special effects template files based on the information on the acquisition methods can be updated and optimized materials, eliminating the need to create new special effects template files for updated and optimized materials. In summary, the special effects template files generated by the above method are easier to use.
[0093] In some implementations, the information acquisition module 502 is specifically used to: acquire an editing record file of the target image; and extract layer information of the target image based on the editing record file.
[0094] In some implementations, the layout recording module 504 is specifically used to: parse the layout information according to a plurality of preset first fields to obtain the field value corresponding to each of the first fields; wherein the plurality of first fields are used to represent multiple of the following information: layer layout type information, layer specified vertex coordinate information, layer width information, layer height information, layer scaling information, layer displacement information, layer rotation information, and layer anchor point information; and record the field names and field values of the plurality of first fields according to a first specified format to obtain layout recording data.
[0095] In some implementations, the special effects recording module 506 is specifically used to: parse the special effects information according to a plurality of preset second fields to obtain the field value corresponding to each second field; wherein, the plurality of second fields are used to represent multiple of the following information: special effects material type information, special effects material acquisition method information, special effects material performance intensity information, and special effects material supported platform information; and record the field name and field value of the plurality of second fields according to a second specified format to obtain special effects recording data.
[0096] In some implementations, the association recording module 508 is specifically used to: determine the hierarchical relationship between multiple layers based on the association information; and record the hierarchical relationship based on a tree structure to obtain association recording data.
[0097] In some implementations, the file generation module 510 is specifically used to: perform a serialization operation on the layout record data, the special effects record data, and the associated record data to obtain a serialization result; and generate a special effects template file based on the serialization result.
[0098] The special effects template file generation apparatus provided in this disclosure can execute the special effects template file generation method provided in any embodiment of this disclosure, and has the corresponding functional modules and beneficial effects of the execution method.
[0099] Corresponding to the aforementioned method for applying special effects template files, this disclosure also provides an apparatus for applying special effects template files, see [link to apparatus]. Figure 6 The structural block diagram of an application device for special effects template files shown here mainly includes the following modules:
[0100] The file acquisition module 602 is used to acquire the image to be processed and the target special effects template file; wherein, the target special effects template file is obtained by the above-mentioned special effects template file generation method;
[0101] The file parsing module 604 is used to parse the target effect template file to obtain target layout record data, target effect record data and target association record data;
[0102] The special effects acquisition module 606 is used to acquire the target special effects material based on the acquisition method information of the target special effects material contained in the target special effects record data;
[0103] The image editing module 608 is used to edit the image to be processed based on the target layout recording data, target effect recording data, target association recording data, and target effect materials.
[0104] Since special effects template files without special effects materials are smaller in size and easier to distribute / obtain, while special effects materials stored on the server can be freely updated and optimized, the special effects materials obtained can be the latest materials updated and optimized on the server. All of these factors make the application of special effects template files more flexible and convenient, resulting in a higher user experience.
[0105] In some implementations, the image editing module 608 is specifically used to: perform layer creation and layout operations on the image to be processed according to the target association record data and the target layout record data to obtain multiple target layers; and mount each target effect material onto the corresponding target layer according to the target effect record data.
[0106] The application device for special effects template files provided in this disclosure can execute the application method for special effects template files provided in any embodiment of this disclosure, and has the corresponding functional modules and beneficial effects of the execution method.
[0107] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the above-described device embodiments can be referred to the corresponding process in the method embodiments, and will not be repeated here.
[0108] This disclosure also provides an electronic device, which includes: a processor; a memory for storing processor-executable instructions; and a processor for reading executable instructions from the memory and executing the instructions to implement any of the above-described methods for generating special effects template files, or to implement any of the above-described methods for applying special effects template files.
[0109] Figure 7 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this disclosure. Figure 7 As shown, the electronic device 700 includes one or more processors 701 and memory 702.
[0110] The processor 701 may be a central processing unit (CPU) or other form of processing unit with data processing capabilities and / or instruction execution capabilities, and may control other components in the electronic device 700 to perform desired functions.
[0111] The memory 702 may include one or more computer program products, which may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. The volatile memory may include, for example, random access memory (RAM) and / or cache memory. The non-volatile memory may include, for example, read-only memory (ROM), hard disk, flash memory, etc. One or more computer program instructions may be stored on the computer-readable storage medium, and the processor 701 may execute the program instructions to implement the method for generating and applying special effects template files according to the embodiments of this disclosure described above, and / or other desired functions. Various contents such as input signals, signal components, and noise components may also be stored in the computer-readable storage medium.
[0112] In one example, the electronic device 700 may also include an input device 703 and an output device 704, which are interconnected via a bus system and / or other forms of connection mechanism (not shown).
[0113] In addition, the input device 703 may also include, for example, a keyboard, a mouse, etc.
[0114] The output device 704 can output various information to the outside, including determined distance information, direction information, etc. The output device 704 may include, for example, a display, a speaker, a printer, and a communication network and its connected remote output devices, etc.
[0115] Of course, for the sake of simplicity, Figure 7 Only some of the components of the electronic device 700 relevant to this disclosure are shown, omitting components such as buses, input / output interfaces, etc. In addition, the electronic device 700 may include any other suitable components depending on the specific application.
[0116] In addition to the methods and devices described above, embodiments of this disclosure may also be computer program products, which include computer program instructions that, when executed by a processor, cause the processor to perform the method for generating and applying special effects template files provided in the embodiments of this disclosure.
[0117] The computer program product can be written in any combination of one or more programming languages to perform the operations of the embodiments of this disclosure. The programming languages include object-oriented programming languages such as Java and C++, as well as conventional procedural programming languages such as C or similar languages. The program code can be executed entirely on a user's computing device, partially on a user's computing device, as a standalone software package, partially on a user's computing device and partially on a remote computing device, or entirely on a remote computing device or server.
[0118] Furthermore, embodiments of this disclosure may also be computer-readable storage media storing computer program instructions thereon, which, when executed by a processor, cause the processor to perform the special effects template file generation and application methods provided in embodiments of this disclosure.
[0119] The computer-readable storage medium may be any combination of one or more readable media. A readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may, for example, include, but is not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatuses, or devices, or any combination thereof. More specific examples of readable storage media (a non-exhaustive list) include: electrical connections having one or more wires, portable disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0120] This disclosure also provides a computer program product, including a computer program / instruction, which, when executed by a processor, implements the method for generating and applying special effects template files as described in this disclosure.
[0121] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0122] The above description is merely a specific embodiment of this disclosure, enabling those skilled in the art to understand or implement it. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this disclosure. Therefore, this disclosure is not to be limited to the embodiments described herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method of generating a special effect template file, characterized by, include: Obtain the layer information of the target image; wherein, the layer information includes the layout information of the layers used by the target image, the special effects information of the special effects materials used by the layers, and the association information between different layers; The layout information is recorded according to the first specified format to obtain layout record data; The special effects information is recorded according to the second specified format to obtain special effects recording data; wherein, the special effects materials are all stored on the server, and the special effects recording data packet contains information on the acquisition method of the special effects materials; The associated information is recorded according to the third specified format to obtain associated record data; An effects template file is generated based on the layout record data, the effects record data, and the associated record data.
2. The method of claim 1, wherein, The steps to obtain layer information of the target image include: Obtain the editing history file of the target image; The layer information of the target image is extracted based on the edit history file.
3. The method of claim 1, wherein, The step of recording the layout information according to a first specified format to obtain layout record data includes: The layout information is parsed according to a plurality of preset first fields to obtain the field value corresponding to each first field; wherein, the plurality of first fields are used to represent multiple of the following information: layer layout type information, layer specified vertex coordinate information, layer width information, layer height information, layer scaling information, layer displacement information, layer rotation information, and layer anchor point information; Record the field names and values of multiple first fields according to the first specified format to obtain layout record data.
4. The method of claim 1, wherein, The step of recording the special effects information according to the second specified format to obtain special effects recording data includes: The special effects information is parsed according to a plurality of preset second fields to obtain the field value corresponding to each second field; wherein, the plurality of second fields are used to represent multiple of the following information: special effects material type information, special effects material acquisition method information, special effects material performance intensity information, and special effects material supported platform information; Record the field names and values of multiple fields of the second field according to the second specified format to obtain special effect record data.
5. The method of claim 1, wherein, The step of recording the associated information according to the third specified format to obtain associated record data includes: The hierarchical relationship between the multiple layers is determined based on the association information; Based on the tree structure, the hierarchical relationship is recorded to obtain the associated record data.
6. The method of claim 1, wherein, The steps of generating an effects template file based on the layout record data, the effects record data, and the associated record data include: Perform a serialization operation on the layout record data, the special effects record data, and the associated record data to obtain a serialization result; A special effects template file is generated based on the serialization result.
7. A method for applying a special effects template file, characterized in that, include: Obtain the image to be processed and the target special effects template file; wherein, the target special effects template file is obtained by the special effects template file generation method according to any one of claims 1 to 6; The target effect template file is parsed to obtain target layout record data, target effect record data, and target association record data; Based on the acquisition method information of the target special effects material contained in the target special effects record data, the target special effects material is obtained; The image to be processed is edited based on the target layout record data, the target effect record data, the target association record data, and the target effect material.
8. The method of claim 7, wherein, The steps of editing the image to be processed based on the target layout record data, the target effect record data, the target association record data, and the target effect material include: Based on the target association record data and the target layout record data, layer creation and layout operations are performed on the image to be processed to obtain multiple target layers; Based on the target effect recording data, each target effect material is mounted onto the corresponding target layer.
9. A device for generating special effects template files, characterized in that, include: The information acquisition module is used to acquire layer information of the target image; wherein, the layer information includes layout information of the layers used in the target image, special effects information of the special effects materials used in the layers, and association information between different layers; The layout recording module is used to record the layout information according to a first specified format to obtain layout recording data; The special effects recording module is used to record the special effects information according to a second specified format to obtain special effects recording data; wherein, the special effects materials are all stored on the server, and the special effects recording data package contains information on the acquisition method of the special effects materials; The association record module is used to record the association information according to a third specified format to obtain association record data; The file generation module is used to generate special effects template files based on the layout record data, the special effects record data, and the associated record data.
10. An application device for a special effects template file, characterized in that, include: The file acquisition module is used to acquire the image to be processed and the target special effects template file; wherein, the target special effects template file is obtained by the special effects template file generation method according to any one of claims 1 to 6; The file parsing module is used to parse the target effect template file to obtain target layout record data, target effect record data, and target association record data; The special effects acquisition module is used to acquire the target special effects material based on the acquisition method information of the target special effects material contained in the target special effects record data; The image editing module is used to edit the image to be processed based on the target layout recording data, the target special effects recording data, the target association recording data, and the target special effects material.
11. An electronic device, comprising: The electronic device includes: processor; Memory used to store the processor's executable instructions; The processor is configured to read the executable instructions from the memory and execute the instructions to implement the method for generating special effects template files according to any one of claims 1-6, or to implement the method for applying special effects template files according to any one of claims 7-8.
12. A computer-readable storage medium, characterized in that, The storage medium stores a computer program, which is used to execute the method for generating special effects template files according to any one of claims 1-6, or to execute the method for applying special effects template files according to any one of claims 7-8.