Animation sticker manufacturing method and device, electronic equipment and storage medium
By acquiring and rendering image data from target files in a preset format, the problem of low efficiency in animation sticker production in existing technologies is solved, enabling batch conversion of multiple sets of material images and improving production efficiency.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-03
- Publication Date
- 2026-03-31
AI Technical Summary
When faced with a large amount of material, existing technology requires converting each element individually to create animated stickers, resulting in low production efficiency.
By acquiring target files in a preset format, including file header data, byte sequence, and index list, and using a preset software development kit to read and render image data, multiple sets of material images can be converted into animated stickers in batches.
It improves the efficiency of creating animated stickers, enabling batch production of multiple target animated stickers when faced with multiple sets of source images.
Smart Images

Figure CN121767512A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of sticker manufacturing technology, and in particular to a method for manufacturing animated stickers, an apparatus for manufacturing animated stickers, an electronic device, and a computer-readable storage medium. Background Technology
[0002] In modern life, people enjoy editing their videos and photos to create more vibrant and colorful images. Animated stickers are one of the most commonly used decorative effects. While there are many animated stickers available on the market, some are not usable. When users encounter a style of animated sticker they like, they may create a usable one. However, when faced with a large amount of material and needing to create multiple animated stickers, it is necessary to convert and create each material individually, which takes a considerable amount of time and is inefficient. Summary of the Invention
[0003] In view of the above problems, embodiments of the present invention are proposed to provide a method for making animated stickers, an apparatus for making animated stickers, an electronic device, and a computer-readable storage medium that overcome or at least partially solve the above problems.
[0004] To address the aforementioned problems, this invention discloses a method for creating animated stickers, comprising: Obtain at least one target file in a preset format; the target file includes: file header data, byte sequences, and an index list; the byte sequences are determined by converting image data; the image data is determined based on a set of source images; the index elements of the index list are used to indicate the identifier of each byte sequence and the number of bytes in each byte sequence; For a target file in the preset format, a preset software development kit is invoked to read the target file and determine the file header data of the target file; The index list is obtained from the target file based on the file header data; Each byte sequence is read from the target file based on the identifier of each byte sequence in the index list and the number of bytes in each byte sequence; Based on each of the byte sequences, determine the corresponding image data; The image data is rendered based on the file header data to obtain the target animated sticker.
[0005] Optionally, before acquiring at least one target file in a preset format, the method further includes: Obtain at least one set of source images; For a set of material images, determine the image data corresponding to the material images, and convert each image data to obtain a byte sequence corresponding to each image data. Generate an index list; Get the file header data; The file header data, the byte sequence, and the index list are encapsulated to obtain a target file in a preset format.
[0006] Optionally, the generation of the index list includes: The number of bytes in each byte sequence is determined based on the byte sequence corresponding to each of the image data. An offset for each byte sequence is determined based on the number of bytes in each byte sequence; the offset is used to indicate the starting position of the byte sequence. An index list is generated based on the identifier of each byte sequence, the number of bytes, and the offset.
[0007] Optionally, obtaining the file header data includes: Obtain data parameters; the data parameters include: rendering parameters, the number of bytes in the file header data, and the total number of bytes in all the byte sequences; The data parameters are filled into a preset data structure to obtain the file header data.
[0008] Optionally, the file header data includes: the number of bytes in the file header data and the total number of bytes in all the byte sequences; based on the file header data, the index list is read from the target file, including: The index list is obtained from the target file based on the number of bytes in the file header data and the total number of bytes in all the byte sequences.
[0009] Optionally, the step of reading each byte sequence from the target file based on the identifier of each byte sequence in the index list and the number of bytes in each byte sequence includes: The position of each byte sequence is determined from the target file based on the identifier of each byte sequence in the index list and the offset of each byte sequence; Each byte sequence is read from the target file based on its position and the number of bytes in each byte sequence.
[0010] Optionally, the file header data includes: sticker frame rate and sticker loop mode; the step of rendering the image data according to the file header data to obtain the target animated sticker includes: The image data is rendered according to the sticker frame rate and the sticker looping mode to obtain the target animated sticker.
[0011] This invention also discloses an apparatus for making animated stickers, comprising: The first acquisition module is used to acquire at least one target file in a preset format; the target file includes: file header data, byte sequence, and index list; the byte sequence is determined by converting image data; the image data is determined based on a set of source images; the index elements of the index list are used to indicate the identifier of each byte sequence and the number of bytes in each byte sequence; The first determining module is used to, for a target file of the preset format, call a preset software development kit, read the target file, and determine the file header data of the target file; The first reading module is used to read the index list from the target file based on the file header data; The second reading module is used to read each byte sequence from the target file according to the identifier of each byte sequence in the index list and the number of bytes in each byte sequence; The second determining module is used to determine the corresponding image data based on each of the byte sequences; The rendering module is used to render the image data based on the file header data to obtain the target animated sticker.
[0012] Optionally, the device further includes: The first acquisition submodule is used to acquire at least one set of source images; The third determining module is used to determine the image data corresponding to the set of material images, and to convert each image data to obtain a byte sequence corresponding to each image data. The generation module is used to generate the index list; The second acquisition module is used to acquire file header data; The encapsulation module is used to encapsulate the file header data, the byte sequence, and the index list to obtain a target file in a preset format.
[0013] Optionally, the generation module includes: The first determining submodule is used to determine the number of bytes in each byte sequence based on the byte sequence corresponding to each of the image data. The second determining submodule is used to determine the offset of each byte sequence based on the number of bytes in each byte sequence; the offset is used to indicate the starting position of the byte sequence. The generation module is used to generate an index list based on the identifier of each byte sequence, the number of bytes, and the offset.
[0014] Optionally, the second acquisition module includes: The second acquisition submodule is used to acquire data parameters; the data parameters include: rendering parameters, the number of bytes in the file header data, and the total number of bytes in all the byte sequences; The fill-in submodule is used to fill the data parameters into a preset data structure to obtain the file header data.
[0015] Optionally, the file header data includes: the number of bytes in the file header data and the total number of bytes in all the byte sequences; the first reading module includes: The first reading submodule is used to read the index list from the target file based on the number of bytes in the file header data and the total number of bytes in all the byte sequences.
[0016] Optionally, the second reading module includes: The third determining submodule is used to determine the position of each byte sequence from the target file based on the identifier of each byte sequence in the index list and the offset of each byte sequence; The second reading submodule is used to read each byte sequence from the target file according to the position of each byte sequence and the number of bytes in each byte sequence.
[0017] Optionally, the file header data includes: sticker frame rate and sticker loop mode; the rendering module includes: The rendering submodule is used to render the image data according to the sticker frame rate and the sticker looping mode to obtain the target animated sticker.
[0018] The present invention also discloses an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the animated sticker creation method described above.
[0019] The present invention also discloses a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the above-described method for creating animated stickers.
[0020] The embodiments of the present invention have the following advantages: In this embodiment of the invention, at least one target file in a preset format is obtained. The target file includes: header data, byte sequences, and an index list. The byte sequences are determined by converting image data. The image data is determined based on a set of source images. The index elements of the index list indicate the identifier of each byte sequence and the number of bytes in each byte sequence. For a target file in a preset format, a preset software development kit (SDK) is invoked to read the target file and determine its header data. Based on the header data, the index list is read from the target file. Based on the identifier of each byte sequence in the index list and the number of bytes in each byte sequence, each byte sequence is read from the target file. Based on each byte sequence, the corresponding image data is determined. The image data is rendered based on the header data to obtain the target animated sticker. Therefore, when dealing with multiple sets of source images, it is only necessary to obtain the target file in the preset format corresponding to each set of source images, then invoke the preset SSD to determine the image data corresponding to each set of source images, and finally render the image data based on the header data of each target file in the preset format to obtain multiple target animated stickers. This achieves batch conversion of multiple sets of source images to obtain multiple target animated stickers, improving the production efficiency of animated stickers. Attached Figure Description
[0021] Figure 1 This is a flowchart illustrating the steps of a method for creating an animated sticker according to an embodiment of the present invention; Figure 2 This is a flowchart of another method for creating animated stickers provided in an embodiment of the present invention; Figure 3 This is a schematic diagram of a display interface for creating animated stickers provided in an embodiment of the present invention; Figure 4 This is a schematic diagram of another display interface for creating animated stickers provided in an embodiment of the present invention; Figure 5 This is a schematic diagram of another display interface for creating animated stickers provided in an embodiment of the present invention; Figure 6 This is a structural block diagram of an animation sticker production device provided in an embodiment of the present invention. Detailed Implementation
[0022] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0023] In related technologies, when creating animated stickers from a large amount of material, each material needs to be converted and processed sequentially, which takes a long time and is inefficient. To solve the above technical problems, this invention discloses a method for creating animated stickers. The core concept involves obtaining at least one target file in a preset format. The target file includes: file header data, byte sequences, and an index list. The byte sequences are determined by converting image data, and the image data is determined based on a set of material images. The index elements of the index list indicate the identifier of each byte sequence and the number of bytes in each byte sequence. For a target file in a preset format, a preset software development kit is called to read the target file and determine its file header data. Based on the file header data, the index list is read from the target file. Based on the identifier of each byte sequence in the index list and the number of bytes in each byte sequence, each byte sequence is read from the target file. Based on each byte sequence, the corresponding image data is determined. The image data is rendered based on the file header data to obtain the target animated sticker. Therefore, when faced with multiple sets of source images, it is only necessary to obtain the target file in the preset format corresponding to each set of source images, then call the preset software development kit to determine the image data corresponding to each set of source images, and finally render the image data according to the file header data of each preset format target file to obtain multiple target animated stickers. This enables batch conversion of multiple sets of source images to obtain multiple target animated stickers, improving the production efficiency of animated stickers.
[0024] Reference Figure 1 The diagram illustrates a flowchart of a method for creating an animated sticker according to an embodiment of the present invention. The method may specifically include the following steps: Step 101: Obtain at least one target file in a preset format; the target file includes: file header data, byte sequences, and an index list; the byte sequences are determined by converting image data; the image data is determined based on a set of source images; the index elements of the index list are used to indicate the identifier of each byte sequence and the number of bytes in each byte sequence.
[0025] In this invention, the method for creating animated stickers can be applied to electronic devices, such as mobile phones, tablets, and computers. Pre-installed applications can be deployed on the electronic terminals, and the method for creating animated stickers can be based on these applications. In this invention, at least one target file in a preset format can be obtained first. Each target file in the preset format corresponds to a set of source images. Each preset target file can include: file header data, a byte sequence, and an index list. The byte sequence is determined by converting the image data, and the image data is determined based on a set of source images. The index elements of the index list indicate the identifier of each byte sequence and the number of bytes in each byte sequence.
[0026] Step 102: For a target file in the preset format, call the preset software development kit to read the target file and determine the file header data of the target file.
[0027] In this invention, the processing method is the same when dealing with multiple sets of image materials, i.e., multiple target files in preset formats, as it is when dealing with a single set of image materials, i.e., a single target file in preset formats. The only difference is that when dealing with multiple sets of image materials, each set of image materials is processed simultaneously. To facilitate understanding and description of the embodiments of this invention, this invention will use a single target file in preset formats as an example for illustration. When dealing with a single target file in preset formats, a preset software development kit can be called to read the target file in preset formats and then determine the file header data of the target file in preset formats.
[0028] Step 103: Based on the file header data, read the index list from the target file.
[0029] In this invention, after determining the header data of the target file, the index list can be read from the target file based on the header data.
[0030] Step 104: Read each byte sequence from the target file according to the identifier of each byte sequence in the index list and the number of bytes in each byte sequence.
[0031] In this embodiment of the invention, after reading the index list from the target file, each byte sequence can be read from the target file according to the identifier of each byte sequence in the read index list and the number of bytes in each byte sequence, wherein one byte sequence corresponds to one material image in a group of material images.
[0032] Step 105: Determine the corresponding image data based on each byte sequence.
[0033] In this invention, after obtaining each byte sequence, the corresponding image data can be determined based on each byte sequence.
[0034] Step 106: Render the image data according to the file header data to obtain the target animated sticker.
[0035] In this invention, after determining the image data, the image data can be rendered according to the file header data to obtain the target animated sticker. In this invention, when multiple target animated stickers need to be made for multiple sets of material images, the target files in preset formats corresponding to multiple sets of material images can be obtained. Then, according to the animated sticker making method of this invention, the target files in multiple preset formats are processed simultaneously to obtain the target animated stickers corresponding to multiple sets of material images. Thus, the corresponding animated stickers can be made in batches for multiple sets of material images.
[0036] In this embodiment of the invention, at least one target file in a preset format is obtained. The target file includes: header data, byte sequences, and an index list. The byte sequences are determined by converting image data. The image data is determined based on a set of source images. The index elements of the index list indicate the identifier of each byte sequence and the number of bytes in each byte sequence. For a target file in a preset format, a preset software development kit (SDK) is invoked to read the target file and determine its header data. Based on the header data, the index list is read from the target file. Based on the identifier of each byte sequence in the index list and the number of bytes in each byte sequence, each byte sequence is read from the target file. Based on each byte sequence, the corresponding image data is determined. The image data is rendered based on the header data to obtain the target animated sticker. Therefore, when dealing with multiple sets of source images, only the target file in the preset format corresponding to each set of source images needs to be obtained. Then, the preset application development kit is invoked to determine the image data corresponding to each set of source images. Finally, the image data is rendered based on the header data of each target file in the preset format to obtain multiple target animated stickers. This achieves batch conversion of multiple sets of source images to obtain multiple target animated stickers, improving the production efficiency of animated stickers.
[0037] Reference Figure 2 The diagram illustrates a flowchart of another method for creating animated stickers according to an embodiment of the present invention. The method may specifically include the following steps: Step 201: Obtain at least one set of source images.
[0038] In this embodiment of the invention, at least one set of source images can be obtained first. These source images can consist of static images or dynamic images.
[0039] In this invention, when a user needs to create animated stickers, they can open a preset application. Once opened, the preset application displays controls for converting static images to animated stickers and controls for converting animated images to animated stickers. For example... Figure 3 The diagram shows a schematic of a display interface for creating animated stickers according to an embodiment of the present invention.
[0040] When a user needs to convert a static image into an animated sticker, they can click the "Static Image to Animated Sticker" control to proceed to the next display screen, such as... Figure 4 The diagram shows another display interface for creating animated stickers provided by an embodiment of the present invention. Figure 4 The display interface includes a static image control, which allows users to upload source images that they want to turn into animated stickers. Figure 4 The display interface also includes a confirmation control. When a user needs to create multiple animated stickers, that is, when a user needs to upload multiple sets of static images, they can click the confirmation control after uploading one set of static images. The application will then confirm this set of static images as a set of material images. After clicking the confirmation control, the user can click the add static image control to upload a second set of material images.
[0041] When a user needs to convert an animated GIF into an animated sticker, they can click the "Animated GIF to Animated Sticker" control to proceed to the next display screen, such as... Figure 5 The diagram shows another display interface for creating animated stickers provided by an embodiment of the present invention. Figure 5 The display interface includes a control for adding animated images. Users can click the control to upload source images that they want to turn into animated stickers. Figure 5 The display interface also includes a confirmation control. When a user needs to create multiple animated stickers, i.e., upload multiple sets of animated images, they can click the confirmation control after uploading one set of animated images. The application will then automatically recognize this set of animated images as a set of source images. After clicking the confirmation control, the user can then click the "Add Animated Image" control to upload a second set of source images. In this invention, Figure 4 and Figure 5 It may also include a material information display area and other functional controls (not shown in the figure), such as a clear list control, a set keep path control, and a return to homepage control.
[0042] Step 202: For a set of material images, determine the image data corresponding to the material images, and convert each image data to obtain a byte sequence corresponding to each image data.
[0043] In this embodiment of the invention, after acquiring at least one set of source images, the user can click... Figure 4 and Figure 5 The conversion control in the program allows the application to determine the image data corresponding to each set of source images. For example, if a set of source images contains animated images, the QImageReader interface can be used to obtain the image of each frame of each animated image, i.e., obtain the static image corresponding to the animated image. Then, all static images in the set of source images are traversed to obtain the QImage of each static image, i.e., obtain the image data corresponding to each static image. Then, each QImage is converted to obtain the QByteArray byte sequence corresponding to each image data. In this invention, determining the corresponding byte sequence for multiple sets of source images is the same as determining the corresponding byte sequence for a single set of source images. When dealing with multiple sets of source images, each set of source images can be converted simultaneously to obtain the byte sequence corresponding to each set of image source images.
[0044] Step 203: Generate an index list.
[0045] In this embodiment of the invention, after determining the byte sequence corresponding to each image data, an index table can be generated based on the determined direct sequence.
[0046] In one embodiment, generating an index list includes: determining the number of bytes in each byte sequence based on the byte sequence corresponding to each image data; determining the offset of each byte sequence based on the number of bytes in each byte sequence; the offset is used to indicate the starting position of the byte sequence; and generating an index list based on the identifier, number of bytes, and offset of each byte sequence.
[0047] In this invention, after determining the byte sequence corresponding to each image data, the number of bytes in each byte sequence can be determined first. For example, for three static images A1, B1, and C1, the corresponding image data is determined to be A2, B2, and C2, and the corresponding byte sequences are determined to be A3, B3, and C3. The number of bytes in the three byte sequences are 2000 bytes, 2200 bytes, and 1800 bytes, respectively. Then, the offset of byte sequence A3 can be determined to be 0, the offset of byte sequence B3 to be 2000, and the offset of byte sequence C3 to be 4200. Finally, an index table can be generated based on the identifier, number of bytes, and offset of each byte sequence. The following table (1) is an example of a generated index table:
[0048] Table (1) Step 204: Obtain the file header data.
[0049] In this embodiment of the invention, after generating the index list, the file header data can be obtained.
[0050] In one embodiment, obtaining file header data may include: obtaining data parameters; the data parameters include: rendering parameters, the number of bytes in the file header data, and the total number of bytes in all the byte sequences; The data parameters are filled into a preset data structure to obtain the file header data.
[0051] In this invention, such as Figure 4 and Figure 5 The display interface includes a data parameter setting area where users can fill in data parameters as needed. These parameters can include rendering parameters. The number of bytes in the file header data can be preset. After obtaining the data parameters, the application can automatically fill them into a preset data structure to obtain the file header data. The following is a data structure for the file header data after automatically filling in the preset data structure: Struct NvFileHeader { int version; / / Version number: 4 bytes; int headerSize; / / File header size, 4 bytes; fixed at 64, meaning the total file header information occupies 64 bytes; String imageFormat; / / Image format: PNG or JPG, 4 bytes; int imageWidth; / / Image width, 4 bytes; int imageHeight; / / Image height, 4 bytes; int frameRate; / / Frame rate, 4 bytes; int frameCount; / / Number of frames, 4 bytes; int defaultLoopMode; / / Loop mode: loop from the beginning, repeat the last frame, 4 bytes; long frameIndexTableOffset; / / File offset position of all images, 4 bytes; } Step 205: Encapsulate the file header data, the byte sequence, and the index list to obtain a target file in a preset format.
[0052] In this embodiment of the invention, after obtaining the file header data, the file header data, byte sequence, and index list can be sequentially encapsulated into a file of a preset format to obtain a target file of the preset format. Alternatively, the byte sequence can be written into the file of the preset format first, then the file header data can be written into the beginning text of the file of the preset format, and finally the index list can be written into the end of the file to obtain a target file of the preset format. In this invention, the file of the preset format can be an animatesticker file.
[0053] Step 206: Obtain at least one target file in a preset format.
[0054] In this embodiment of the invention, step 206 is the same as step 101, and will not be described again here.
[0055] Step 207: For a target file in the preset format, call the preset software development kit, read the target file, and determine the file header data of the target file.
[0056] In this embodiment of the invention, the preset application can call a preset software development kit to obtain target files. When there are multiple target files with preset formats, the preset software development kit can be called to obtain multiple target files and determine the file header data corresponding to each target file.
[0057] Step 208: Based on the file header data, read the index list from the target file.
[0058] In this invention, after determining the header data of the target file, the index list can be read from the target file based on the header data.
[0059] In one embodiment, the file header data includes: the number of bytes in the file header data and the total number of bytes in all byte sequences; reading an index list from the target file based on the file header data includes: reading an index list from the target file based on the number of bytes in the file header data and the total number of bytes in all byte sequences.
[0060] In this invention, after determining the header data of the target file, the number of bytes in the header data and the total number of bytes in all byte sequences can be read first. For example, if the header data is 64 bytes and the total number of bytes in all byte sequences is 6000 bytes, then the first 64 bytes in the target file are the header data, bytes 65 to 6054 are all byte sequences, and bytes 6055 and the remaining bytes are all data belonging to the index list. Thus, the index list is obtained by reading from byte 6055.
[0061] Step 209: Read each byte sequence from the target file according to the identifier of each byte sequence in the index list and the number of bytes in each byte sequence.
[0062] In this embodiment of the invention, after reading the index list from the target file, each byte sequence can be read from the target file according to the identifier of each byte sequence in the read index list and the number of bytes in each byte sequence, wherein one byte sequence corresponds to one material image in a group of material images.
[0063] In one embodiment, reading each byte sequence from the target file based on the identifier of each byte sequence in the index list and the number of bytes in each byte sequence includes: determining the position of each byte sequence from the target file based on the identifier of each byte sequence in the index list and the offset of each byte sequence; and reading each byte sequence from the target file based on the position of each byte sequence and the number of bytes in each byte sequence.
[0064] For example, if the index list is read as shown in Table (1) above, then we can obtain that the number of bytes corresponding to the identifier A3 of the byte sequence is 2000 bytes, the offset of the byte sequence A3 is 0, the number of bytes corresponding to the identifier B3 of the byte sequence is 2200 bytes, the offset of the byte sequence B3 is 2000, the number of bytes corresponding to the identifier C3 of the byte sequence is 1800 bytes, and the offset of the byte sequence A3 is 4200. Then we can determine that the total number of bytes in all byte sequences is 6000 bytes. Among these 6000 bytes, the first byte is the starting position of the byte sequence A3, the 2001st byte is the starting position of the byte sequence B3, and the 4201st byte is the starting position of the byte sequence C3. Then, the 2000 bytes obtained from the first byte of these 6000 bytes are the data of the byte sequence A3, the 2200 bytes obtained from the 2001st byte are the data of the byte sequence B3, and the 1800 bytes obtained from the 4201st byte are the data of the byte sequence C3.
[0065] Step 210: Determine the corresponding image data based on each byte sequence.
[0066] In this invention, after obtaining each byte sequence, each byte sequence can be converted to obtain image data corresponding to each byte sequence.
[0067] Step 211: Render the image data according to the file header data to obtain the target animated sticker.
[0068] In this invention, after determining the image data, the image data can be rendered according to the file header data to obtain the target animated sticker. In this invention, when multiple target animated stickers need to be made for multiple sets of material images, the target files in preset formats corresponding to multiple sets of material images can be obtained. Then, according to the animated sticker making method of this invention, the target files in multiple preset formats are processed simultaneously to obtain the target animated stickers corresponding to multiple sets of material images. Thus, the corresponding animated stickers can be made in batches for multiple sets of material images.
[0069] For example, based on the byte sequence A3, B3, C3, the corresponding image data is determined to be A2, B2, C2. The image data A2, B2, C2 are then rendered based on the file header data to obtain the final target animated sticker.
[0070] In one embodiment, the file header data includes: sticker frame rate and sticker loop mode; rendering the image data according to the file header data to obtain the target animated sticker includes: rendering the image data according to the sticker frame rate and sticker loop mode to obtain the target animated sticker.
[0071] In this invention, the file header data may include: sticker frame rate and sticker loop mode. For example, if the sticker frame rate is 10fps and the sticker loop mode is loop from beginning to end, then the image data can be rendered according to this sticker frame rate and sticker loop mode to obtain the target animated sticker. In this invention, the file header data may also include data parameters such as the sticker size.
[0072] In this invention, when faced with multiple sets of source images, for example, when faced with set a, set b, and set c source images, indicating that three animated stickers need to be created for each of the three sets of source images, the animated sticker creation method of this embodiment can be used to process set a, set b, and set c source images simultaneously to obtain three animated stickers that correspond one-to-one with set a, set b, and set c source images. This enables batch production of animated stickers and improves the efficiency of animated sticker production.
[0073] In this embodiment of the invention, at least one target file in a preset format is obtained. The target file includes: header data, byte sequences, and an index list. The byte sequences are determined by converting image data. The image data is determined based on a set of source images. The index elements of the index list indicate the identifier of each byte sequence and the number of bytes in each byte sequence. For a target file in a preset format, a preset software development kit (SDK) is invoked to read the target file and determine its header data. Based on the header data, the index list is read from the target file. Based on the identifier of each byte sequence in the index list and the number of bytes in each byte sequence, each byte sequence is read from the target file. Based on each byte sequence, the corresponding image data is determined. The image data is rendered based on the header data to obtain the target animated sticker. Therefore, when dealing with multiple sets of source images, it is only necessary to obtain the target file in the preset format corresponding to each set of source images, then invoke the preset SSD to determine the image data corresponding to each set of source images, and finally render the image data based on the header data of each target file in the preset format to obtain multiple target animated stickers. This achieves batch conversion of multiple sets of source images to obtain multiple target animated stickers, improving the production efficiency of animated stickers.
[0074] It should be noted that, for the sake of simplicity, the method embodiments are all described as a series of actions. However, those skilled in the art should understand that the embodiments of the present invention are not limited to the described order of actions, because according to the embodiments of the present invention, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions involved are not necessarily essential to the embodiments of the present invention.
[0075] Reference Figure 6 The diagram shows a structural block diagram of an animation sticker making device provided by an embodiment of the present invention, which may specifically include the following modules: The first acquisition module 601 is used to acquire at least one target file in a preset format; the target file includes: file header data, byte sequence, and index list; the byte sequence is determined by converting image data; the image data is determined based on a set of source images; the index elements of the index list are used to indicate the identifier of each byte sequence and the number of bytes in each byte sequence; The first determining module 602 is used to, for a target file of the preset format, call a preset software development kit, read the target file, and determine the file header data of the target file; The first reading module 603 is used to read the index list from the target file based on the file header data; The second reading module 604 is used to read each byte sequence from the target file according to the identifier of each byte sequence in the index list and the number of bytes of each byte sequence; The second determining module 605 is used to determine the corresponding image data based on each of the byte sequences; The rendering module 606 is used to render the image data according to the file header data to obtain the target animation sticker.
[0076] In one embodiment, the device further includes: The first acquisition submodule is used to acquire at least one set of source images; The third determining module is used to determine the image data corresponding to the set of material images, and to convert each image data to obtain a byte sequence corresponding to each image data. The generation module is used to generate the index list; The second acquisition module is used to acquire file header data; The encapsulation module is used to encapsulate the file header data, the byte sequence, and the index list to obtain a target file in a preset format.
[0077] In one embodiment, the generation module includes: The first determining submodule is used to determine the number of bytes in each byte sequence based on the byte sequence corresponding to each of the image data. The second determining submodule is used to determine the offset of each byte sequence based on the number of bytes in each byte sequence; the offset is used to indicate the starting position of the byte sequence. The generation module is used to generate an index list based on the identifier of each byte sequence, the number of bytes, and the offset.
[0078] In one embodiment, the second acquisition module includes: The second acquisition submodule is used to acquire data parameters; the data parameters include: rendering parameters, the number of bytes in the file header data, and the total number of bytes in all the byte sequences; The fill-in submodule is used to fill the data parameters into a preset data structure to obtain the file header data.
[0079] In one embodiment, the file header data includes: the number of bytes in the file header data and the total number of bytes in all the byte sequences; the first reading module 603 includes: The first reading submodule is used to read the index list from the target file based on the number of bytes in the file header data and the total number of bytes in all the byte sequences.
[0080] In one embodiment, the second reading module 604 includes: The third determining submodule is used to determine the position of each byte sequence from the target file based on the identifier of each byte sequence in the index list and the offset of each byte sequence; The second reading submodule is used to read each byte sequence from the target file according to the position of each byte sequence and the number of bytes in each byte sequence.
[0081] In one embodiment, the file header data includes: sticker frame rate and sticker loop mode; the rendering module 606 includes: The rendering submodule is used to render the image data according to the sticker frame rate and the sticker looping mode to obtain the target animated sticker.
[0082] In this embodiment of the invention, a first acquisition module is used to acquire at least one target file in a preset format; the target file includes: file header data, byte sequences, and an index list; the byte sequences are determined by converting image data; the image data is determined based on a set of source images; the index elements of the index list are used to indicate the identifier of each byte sequence and the number of bytes in each byte sequence; a first determination module is used to, for a target file in a preset format, call a preset software development kit, read the target file, and determine the file header data of the target file; a first reading module is used to read the index list from the target file based on the file header data; a second reading module is used to read each byte sequence from the target file based on the identifier of each byte sequence in the index list and the number of bytes in each byte sequence; a second determination module is used to determine the corresponding image data based on each byte sequence; and a rendering module is used to render the image data based on the file header data to obtain the target animation sticker. Therefore, when faced with multiple sets of source images, it is only necessary to obtain the target file in the preset format corresponding to each set of source images, then call the preset software development kit to determine the image data corresponding to each set of source images, and finally render the image data according to the file header data of each preset format target file to obtain multiple target animated stickers. This enables batch conversion of multiple sets of source images to obtain multiple target animated stickers, improving the production efficiency of animated stickers.
[0083] As the device embodiment is basically similar to the method embodiment, the description is relatively simple, and relevant parts can be found in the description of the method embodiment.
[0084] This invention also provides an electronic device, comprising: It includes a processor, a memory, and a computer program stored in the memory and capable of running on the processor. When the computer program is executed by the processor, it implements the various processes of the above-described method embodiment for creating animated stickers and achieves the same technical effect. To avoid repetition, it will not be described again here.
[0085] This invention also provides a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, it implements the various processes of the above-described method for creating animated stickers and achieves the same technical effect. To avoid repetition, it will not be described again here.
[0086] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.
[0087] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, apparatus, or computer program products. Therefore, embodiments of the present invention can take the form of entirely hardware embodiments, entirely software embodiments, or embodiments combining software and hardware aspects. Furthermore, embodiments of the present invention can take the form of computer program products implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0088] Embodiments of the present invention are described with reference to flowchart illustrations and / or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing terminal device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal device, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0089] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing terminal device to operate in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0090] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal equipment, causing a series of operational steps to be performed on the computer or other programmable terminal equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable terminal equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0091] Although preferred embodiments of the present invention have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of the embodiments of the present invention.
[0092] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only 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 terminal device 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 terminal device. 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 terminal device that includes said element.
[0093] The foregoing has provided a detailed description of a method for making animated stickers, an apparatus for making animated stickers, an electronic device, and a computer-readable storage medium provided by the present invention. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, for those skilled in the art, there will be changes in specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.
Claims
1. A method for producing animated stickers, characterized in that, include: Obtain at least one target file in a preset format; The target file includes: file header data, byte sequences, and an index list; the byte sequences are determined by converting image data; the image data is determined based on a set of source images; the index elements of the index list are used to indicate the identifier of each byte sequence and the number of bytes in each byte sequence; For a target file in the preset format, a preset software development kit is invoked to read the target file and determine the file header data of the target file; The index list is obtained from the target file based on the file header data; Each byte sequence is read from the target file based on the identifier of each byte sequence in the index list and the number of bytes in each byte sequence; Based on each of the byte sequences, determine the corresponding image data; The image data is rendered based on the file header data to obtain the target animated sticker.
2. The method for producing animated stickers according to claim 1, characterized in that, Before obtaining at least one target file in a preset format, the method further includes: Obtain at least one set of source images; For a set of material images, determine the image data corresponding to the material images, and convert each image data to obtain a byte sequence corresponding to each image data. Generate an index list; Get the file header data; The file header data, the byte sequence, and the index list are encapsulated to obtain a target file in a preset format.
3. The method for producing animated stickers according to claim 2, characterized in that, The generated index list includes: The number of bytes in each byte sequence is determined based on the byte sequence corresponding to each of the image data. An offset for each byte sequence is determined based on the number of bytes in each byte sequence; the offset is used to indicate the starting position of the byte sequence. An index list is generated based on the identifier of each byte sequence, the number of bytes, and the offset.
4. The method for producing animated stickers according to claim 2, characterized in that, The acquisition of file header data includes: Obtain data parameters; the data parameters include: rendering parameters, the number of bytes in the file header data, and the total number of bytes in all the byte sequences; The data parameters are filled into a preset data structure to obtain the file header data.
5. The method for producing animated stickers according to claim 1, characterized in that, The file header data includes: the number of bytes in the file header data and the total number of bytes in all the byte sequences; the step of reading the index list from the target file based on the file header data includes: The index list is obtained from the target file based on the number of bytes in the file header data and the total number of bytes in all the byte sequences.
6. The method for producing animated stickers according to claim 3, characterized in that, The step of reading each byte sequence from the target file based on the identifier of each byte sequence in the index list and the number of bytes in each byte sequence includes: The position of each byte sequence is determined from the target file based on the identifier of each byte sequence in the index list and the offset of each byte sequence; Each byte sequence is read from the target file based on its position and the number of bytes in each byte sequence.
7. The method for producing animated stickers according to claim 1, characterized in that, The file header data includes: sticker frame rate and sticker loop mode; the rendering of the image data based on the file header data to obtain the target animated sticker includes: The image data is rendered according to the sticker frame rate and the sticker looping mode to obtain the target animated sticker.
8. An apparatus for producing animated stickers, characterized in that, include: The first acquisition module is used to acquire at least one target file in a preset format; The target file includes: file header data, byte sequences, and an index list; the byte sequences are determined by converting image data; the image data is determined based on a set of source images; the index elements of the index list are used to indicate the identifier of each byte sequence and the number of bytes in each byte sequence; The first determining module is used to, for a target file of the preset format, call a preset software development kit, read the target file, and determine the file header data of the target file; The first reading module is used to read the index list from the target file based on the file header data; The second reading module is used to read each byte sequence from the target file according to the identifier of each byte sequence in the index list and the number of bytes in each byte sequence; The second determining module is used to determine the corresponding image data based on each of the byte sequences; The rendering module is used to render the image data based on the file header data to obtain the target animated sticker.
9. An electronic device, characterized in that, include: A processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein the computer program, when executed by the processor, implements the steps of the method for creating animated stickers as described in any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, A computer program is stored on the computer-readable storage medium, which, when executed by a processor, implements the steps of the method for creating animated stickers as described in any one of claims 1-7.
Citation Information
Patent Citations
Animation data encoding method and device, animation data decoding method and device, storage medium and computer equipment
CN112070850A