WO2021051597A1 - Animation playing method and apparatus, and computer device and storage medium - Google Patents

Animation playing method and apparatus, and computer device and storage medium Download PDF

Info

Publication number
WO2021051597A1
WO2021051597A1 PCT/CN2019/118265 CN2019118265W WO2021051597A1 WO 2021051597 A1 WO2021051597 A1 WO 2021051597A1 CN 2019118265 W CN2019118265 W CN 2019118265W WO 2021051597 A1 WO2021051597 A1 WO 2021051597A1
Authority
WO
WIPO (PCT)
Prior art keywords
frame
image data
animation
key frame
sequence
Prior art date
Application number
PCT/CN2019/118265
Other languages
French (fr)
Chinese (zh)
Inventor
孙葛亮
顾研
袁超文
Original Assignee
平安科技(深圳)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 平安科技(深圳)有限公司 filed Critical 平安科技(深圳)有限公司
Publication of WO2021051597A1 publication Critical patent/WO2021051597A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/957Browsing optimisation, e.g. caching or content distillation
    • G06F16/9574Browsing optimisation, e.g. caching or content distillation of access to content, e.g. by caching

Definitions

  • This application relates to an animation playback method, device, computer equipment and storage medium.
  • GIF Graphics Interchange Format
  • an animation playback method device, computer equipment, and storage medium are provided.
  • An animation playback method includes:
  • the key frame animation is loaded into the corresponding web page.
  • An animation playback device the device includes:
  • the image data acquisition module is used to decompose the dynamic image file into a sequence of frame images and acquire the frame image data corresponding to each frame;
  • An image encoding acquisition module used to compress each of the frame image data, and convert the compressed frame image data into base64 format image data
  • a key frame animation generating module used to convert each of the image data in the base64 format into a picture file object in the Blob format; generate the key frames based on the cascading style sheet one by one from the picture file objects in the Blob format to obtain the key frames Animation;
  • the animation playing module is used to load the key frame animation to the corresponding web page when receiving a moving image loading request based on the web page.
  • a computer device including a memory and one or more processors, the memory stores computer readable instructions, and when the computer readable instructions are executed by the processor, the one or more processors execute The following steps:
  • the key frame animation is loaded into the corresponding web page.
  • One or more non-volatile computer-readable storage media storing computer-readable instructions.
  • the computer-readable instructions When executed by one or more processors, the one or more processors perform the following steps:
  • the key frame animation is loaded into the corresponding web page.
  • Fig. 1 is an application scenario diagram of an animation playing method according to one or more embodiments.
  • Figure 2 is a block diagram of a computer device according to one or more embodiments.
  • Fig. 3 is a schematic flowchart of an animation playing method according to one or more embodiments.
  • Fig. 4 is a schematic flowchart of an animation playing method in another embodiment.
  • Fig. 5 is a block diagram of an animation playing method and apparatus according to one or more embodiments.
  • Fig. 1 is an application environment diagram of an animation playing method in an embodiment.
  • the animation playing method is applied to computer equipment, and the computer equipment may be a server.
  • the server 102 obtains a dynamic image file that originally needs to be played, such as a GIF image file, and the server 102 decomposes the GIF image file into frame-by-frame image data.
  • the compressed image data is converted into image data in base64 format, and then the image data in base64 format is converted into a picture file object in Blob format, and finally a stacking style sheet is generated based on the picture file object (Cascading Style Sheets, CSS) key frame animation
  • the web page can directly load the key frame animation based on CSS to realize the playback of image file objects corresponding to multiple frame image data to form
  • this method converts the image data of each frame in a dynamic image file with a large file volume into a small image file object in Blob format, and uses image coding to encode each frame in a CSS-based key frame.
  • Frame images are played to achieve animation effects, so that the animation loading speed and the smoothness of animation playback are improved.
  • Fig. 2 is a schematic diagram of the internal structure of a computer device in an embodiment.
  • the computer device includes a processor, a memory, a network interface, and a database connected through a system bus.
  • the processor of the computer device is used to provide calculation and control capabilities.
  • the memory of the computer device includes a non-volatile storage medium and an internal memory.
  • the non-volatile storage medium stores an operating system, a computer program, and a database.
  • the internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium.
  • the database of the computer equipment is used to store different data information such as GIF image data and image coding.
  • the network interface of the computer device is used to communicate with an external terminal through a network connection.
  • the computer program is executed by the processor to realize an animation playback method.
  • FIG. 1 and FIG. 2 are only part of the scenarios related to the solution of the present application, and do not constitute a limitation on the application environment of the present application.
  • an animation playback method is provided. Taking the method applied to the server in FIG. 1 as an example for description, the method includes the following steps:
  • Step 202 Decompose the dynamic image file into a sequence of frame images, and obtain frame image data corresponding to each frame.
  • the dynamic image file can be a GIF (Graphics Interchange Format, image interchange format) image file, flash image file, etc.; the dynamic image file stores multiple image data, and the dynamic image file displays these image data one by one. Read the display to form an animation; specifically, the server obtains a sequence of frame images from the dynamic image file by analyzing the dynamic image file, and extracts the frame image data corresponding to each frame image.
  • GIF Graphics Interchange Format, image interchange format
  • Step 204 Compress each frame of image data, and convert the compressed frame of image data into base64 format image data.
  • base64 is the encoding method used to transmit 8bit byte codes
  • the Tiantu cave data in base64 format is a string of string codes that can be directly written into HTML web pages or Cascading Style Sheets (CSS) .
  • the server can compress the frame image data to reduce the data volume of the frame image data, and then transcode the frame image data into base64 format image encoding.
  • the server can compress the frame image data of each frame through the image processing compression tool under the condition that the picture is not distorted, so as to reduce the The file volume of one frame of frame image data; after the frame image data is compressed, the server uses the Webpack packaging tool to transcode the compressed frame image data into base64 format image encoding.
  • Step 206 Convert the image data in each base64 format into a picture file object in the Blob format, and generate a key frame animation based on the cascading style sheet according to the picture file object in each Blob format.
  • the Blob (Binary Large Object) format is a binary type of large object; the server converts the image encoding into a text data string in the Blob format to obtain the image file object, which further compresses the image data while ensuring the accuracy of the image remains unchanged. volume.
  • the step of generating a key frame animation based on the cascading style sheet according to the picture file objects in each Blob format includes generating key frames based on the cascading style sheet for each picture file object in the Blob format one by one to obtain the key frame animation.
  • the server further compresses the image data in the base64 format into the image file object in the Blob format
  • the image file object corresponding to the frame image data of each frame is generated one by one based on the key frame of the cascading style sheet to form the key frame animation ;
  • Subsequent loading of the image file object with a small file size when loading the key frame while maintaining the image quality and high precision without affecting the fluency, ensuring the image loading and rendering, and improving the fluency of animation playback.
  • Step 208 When receiving the animation loading request based on the web page, load the key frame animation to the corresponding web page.
  • the server When receiving the web page loading request sent by the client, the server responds to the loading request.
  • the web page When the web page is loaded, it directly loads the CSS-based key frame animation, so that the original dynamic image file is performed in the form of CSS key frame animation Play.
  • the dynamic image file is decomposed into a sequence of frame images to obtain the frame image data corresponding to each frame, and the image data of each frame is compressed, and the compressed frame image data is converted into base64 format.
  • the image data in the base64 format is converted into the image file object in the Blob format, and the key frame animation based on the cascading style sheet is generated according to the image file object in the Blob format, and then the animation based on the web page is received.
  • the key frame animation is loaded into the corresponding web page.
  • This method converts the frame image data of each frame in the dynamic image file with a large file volume into a small Blob format image file object to realize the preservation of the image
  • the file volume is compressed, and the image file object is played to each frame of image in the form of CSS-based key frames to achieve animation effects, so that the animation loading speed and the smoothness of animation playback are improved.
  • the step of generating key frames based on the cascading style sheet for each Blob format picture file object to obtain the key frame animation includes: setting the key frame according to the sequence of each frame image data in the sequence of frame images The trigger percentage value of each key frame in the animation; the Blob format picture file object corresponding to the image data of each frame is set as the image style of each key frame to obtain the key frame animation.
  • the trigger percentage value of the key frame refers to different time nodes in the key frame animation; setting the trigger percentage value of each key frame also defines that different key frames are displayed at different percentage values (time nodes).
  • the server can determine the display order of the image data of each frame according to the sequence of the image data of each frame in the sequence of frame images, so as to set the trigger percentage value of the key frame according to the display order of the image data of each frame, thereby changing
  • the image code corresponding to the frame image data is written into the corresponding key frame as the element state, and the picture style of each key frame in the key frame animation is set, so that a frame image data is displayed at a trigger percentage value (time node) to realize animation playback effect.
  • the step of setting the trigger percentage value of each key frame in the key frame animation according to the sequence of each frame image data in the sequence frame image includes: obtaining the display duration of the key frame animation; The sequence of the frame image data and the display duration determine the display time of the frame image data corresponding to each frame; the trigger percentage value of each key frame in the key frame animation is set according to the display time.
  • the display duration refers to the time it takes for the key frame animation to be played once.
  • the server may obtain the playing time of the dynamic image file and determine it as the display duration of the key frame animation, or the server may obtain the preset key frame animation The frame rate and the number of frame image data determine the display duration of the key frame animation.
  • the server after the server obtains the display duration of the key frame animation, it can determine the display time of each frame of image data according to the playback time and the sequence of each frame of image data, and then set the key corresponding to each frame of image data according to the display time.
  • the trigger percentage value of the frame After the server obtains the display duration of the key frame animation, it can determine the display time of each frame of image data according to the playback time and the sequence of each frame of image data, and then set the key corresponding to each frame of image data according to the display time.
  • the trigger percentage value of the frame is Specifically, after the server obtains the display duration of the key frame animation, it can determine the display time of each frame of image data according to the playback time and the sequence of each frame of image data, and then set the key corresponding to each frame of image data according to the display time. The trigger percentage value of the frame.
  • the step of generating a key frame animation based on the cascading style sheet according to the sequence between the frame image data and each picture file object includes: creating a request link for each picture file object in the Blob format; The corresponding request links are respectively set as the picture style of each key frame, and the key frame animation is obtained.
  • the request link of the picture file object refers to the request address of the picture file object; after the server converts the image code into a text data string in the Blob format, it saves the picture file object in the Blob format and generates this
  • the request address Blob URL of the picture file object is written into the corresponding key frame as the element state of the request address of the picture file object to realize the setting of the picture style of each key frame in the key frame animation.
  • the length of the Blob URL is generally relatively short.
  • an animation playback method is provided. Taking the method applied to the server in Fig. 1 as an example for description, the method includes the following steps:
  • Step 302 Determine the decoding algorithm of the dynamic image file according to the file type of the dynamic image file
  • Step 304 Parse the dynamic image file to obtain image data blocks in the dynamic image file
  • Step 306 Use a decoding algorithm to decode the image data block to obtain a decoded sequence of frame images
  • Step 308 Obtain frame image data corresponding to each frame
  • Step 310 Compress each frame of image data, and convert the compressed frame of image data into base64 format image data;
  • Step 312 Convert each image data in base64 format into a picture file object in Blob format
  • Step 314 Obtain the display duration of the key frame animation
  • Step 316 Determine the display time of the frame image data corresponding to each frame according to the sequence and display duration of each frame image data in the sequence of frame images;
  • Step 318 Set the trigger percentage value of each key frame in the key frame animation according to the display moment
  • Step 320 Create a request link for each Blob format picture file object, and set the request link corresponding to each frame of image data to the picture style of each key frame to obtain the key frame animation;
  • Step 322 When receiving the animation loading request based on the web page, load the key frame animation to the corresponding web page.
  • the compressed frame image data is converted from the frame image data of the ordinary picture format, such as jpg format— >base64 format image encoding—>Blob format image file object conversion, the finally obtained Blob format image file object maintains the accuracy of the image, while the file volume is compressed, so that the image file object corresponding to the frame image data is used as an element
  • the state is written into the corresponding key frame to realize the setting of the picture style of each key frame in the key frame animation, so that a frame image data is displayed at a trigger percentage value (time node) to realize the animation playback effect.
  • the step of decomposing the dynamic image file into a sequence of frame images and obtaining the frame image data corresponding to each frame includes the following steps: determining the decoding algorithm for the dynamic image file according to the file type of the dynamic image file; Analyze the dynamic image file to obtain the image data block in the dynamic image file; use the decoding algorithm to decode the image data block to obtain the decoded sequence frame image.
  • the image data block is the data block that stores the image data; the server determines the decoding algorithm of the dynamic image file through the type of the dynamic image file, and the decoding process is to use the decoding algorithm to encode and compress the image data block in the dynamic image file.
  • the decoded data stream is obtained, that is, multiple consecutive frame images are obtained, so that the frame image data corresponding to each frame is obtained in the decoded data stream.
  • the structure of the GIF image file includes three parts: the file header, the image interchange format data stream, and the file format terminator.
  • the image interchange format data stream is the image data that stores the image data. Block, and obtained by encoding using the LZW compression algorithm.
  • the server determines that the decoding algorithm is the LZW decoding algorithm, and uses the LZW decoding algorithm to decode the image interchange format data stream in the GIF dynamic image file to obtain the GIF dynamic image file Sequence of frame images.
  • an animation playback device including: a frame image data acquisition module 410, an image encoding acquisition module 420, a key frame animation generation module 430, and an animation playback module 440, wherein:
  • the image data acquisition module 410 is used for decomposing the dynamic image file into a sequence of frame images, and acquiring frame image data corresponding to each frame;
  • the image encoding acquisition module 420 is used to compress each frame of image data and convert the compressed frame image data into base64 format image data;
  • the key frame animation generating module 430 is used to convert the image data of each base64 format into the picture file object of the Blob format; generate the key frame based on the cascading style sheet one by one of the picture file objects of each Blob format to obtain the key frame animation; and
  • the animation playing module 440 is configured to load the key frame animation into the corresponding web page when receiving the animation loading request based on the web page.
  • the key frame animation generation module is used to set the trigger percentage value of each key frame in the key frame animation according to the sequence of each frame image data in the sequence frame image; the Blob format corresponding to each frame image data The image file object of is set to the image style of each key frame, and the key frame animation is obtained.
  • the key frame animation generation module is also used to obtain the display duration of the key frame animation; according to the sequence and display duration of each frame image data in the sequence of frame images, the display of the frame image data corresponding to each frame is determined Time: Set the trigger percentage value of each key frame in the key frame animation according to the display time.
  • the key frame animation generation module is also used to create a request link for each Blob format picture file object; the request link corresponding to each frame of image data is set to the picture style of each key frame to obtain the key frame Animation.
  • the image data acquisition module is used to determine the decoding algorithm of the dynamic image file according to the file type of the dynamic image file; parse the dynamic image file to obtain the image data block in the dynamic image file; The data block is decoded, and the decoded sequence frame image is obtained.
  • the various modules in the above-mentioned animation playback device can be implemented in whole or in part by software, hardware and a combination thereof.
  • the above-mentioned modules may be embedded in the form of hardware or independent of the processor in the computer equipment, or may be stored in the memory of the computer equipment in the form of software, so that the processor can call and execute the operations corresponding to the above-mentioned modules.
  • a computer device is provided.
  • the computer device may be a server, and its internal structure diagram may be as shown in FIG. 2.
  • the computer equipment includes a processor, a memory, a network interface, and a database connected through a system bus. Among them, the processor of the computer device is used to provide calculation and control capabilities.
  • the memory of the computer device includes a non-volatile computer-readable storage medium and internal memory.
  • the non-volatile computer-readable storage medium stores an operating system, computer-readable instructions, and a database.
  • the internal memory provides an environment for the operation of the operating system and computer-readable instructions in the non-volatile computer-readable storage medium.
  • the database of the computer equipment is used to store dynamic image files, image data and other data.
  • the network interface of the computer device is used to communicate with an external terminal through a network connection.
  • the computer readable instruction is executed by the processor to realize an animation playback method.
  • FIG. 2 is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied.
  • the specific computer device may Including more or fewer parts than shown in the figure, or combining some parts, or having a different arrangement of parts.
  • a computer device includes a memory and one or more processors.
  • the memory stores computer-readable instructions.
  • the one or more processors perform the following steps:
  • the key frame animation is loaded into the corresponding web page.
  • the processor executes computer-readable instructions to realize the step of generating key frames based on the cascading style sheet for each Blob format picture file object one by one to obtain the key frame animation, which specifically implements the following steps: according to the sequence of frame images Set the trigger percentage value of each key frame in the key frame animation in the sequence of each frame of image data in the key frame animation; set the Blob format picture file object corresponding to each frame of image data to the image style of each key frame to obtain the key frame animation.
  • the processor executes computer-readable instructions to implement the step of setting the trigger percentage value of each key frame in the key frame animation according to the sequence of each frame image data in the sequence of frame images, which specifically includes the following steps: obtaining key frames Animation display time; according to the sequence and display duration of each frame image data in the sequence of frame images, determine the display time of the frame image data corresponding to each frame; set the trigger percentage value of each key frame in the key frame animation according to the display time.
  • the processor executes computer-readable instructions to implement the steps of setting the Blob format picture file object corresponding to each frame of image data to the image style of each key frame to obtain the key frame animation, which specifically implements the following steps : Create a request link for each Blob format picture file object; set the request link corresponding to each frame of image data to the picture style of each key frame to obtain the key frame animation.
  • the processor executes computer-readable instructions to realize the step of decomposing the dynamic image file into a sequence of frame images, specifically implementing the following steps: determining the file type of the dynamic image file and the decoding algorithm of the dynamic image file; analyzing the dynamic image file The image file obtains the image data block in the dynamic image file; the image data block is decoded by the decoding algorithm to obtain the decoded sequence frame image.
  • One or more non-volatile computer-readable storage media storing computer-readable instructions.
  • the computer-readable instructions When executed by one or more processors, the one or more processors perform the following steps:
  • the key frame animation is loaded into the corresponding web page.
  • the computer-readable instructions are executed by the processor to generate key frames based on the cascading style sheet for each picture file object in the Blob format, and when the key frame animation is obtained, the following steps are specifically implemented: according to the sequence Set the sequence of each frame of image data in the frame image, set the trigger percentage value of each key frame in the key frame animation; set the Blob format picture file object corresponding to each frame of image data to the image style of each key frame to obtain the key frame Animation.
  • the step of setting the trigger percentage value of each key frame in the key frame animation according to the sequence of each frame image data in the sequence of frame images is also implemented, which specifically implements the following steps: Obtain the display duration of the key frame animation; determine the display time of the frame image data corresponding to each frame according to the sequence and display duration of each frame image data in the sequence frame image; set the trigger percentage of each key frame in the key frame animation according to the display time value.
  • the computer-readable instructions are executed by the processor to implement the steps of setting the Blob format picture file object corresponding to each frame of image data to the image style of each key frame to obtain the key frame animation.
  • the specific implementation is as follows Steps: Create request links for picture file objects in each Blob format; set the request links corresponding to each frame of image data to the picture style of each key frame to obtain the key frame animation.
  • the step of decomposing the dynamic image file into a sequence of frame images is also implemented, and the following steps are specifically implemented: determining the file type of the dynamic image file and the decoding algorithm of the dynamic image file Analyze the dynamic image file to obtain the image data block in the dynamic image file; use the decoding algorithm to decode the image data block to obtain the decoded sequence frame image.
  • Non-volatile memory may include read only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory.
  • Volatile memory may include random access memory (RAM) or external cache memory.
  • RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous chain Channel (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Processing Or Creating Images (AREA)

Abstract

An animation playing method, comprising: decomposing a dynamic image file into a sequence frame image, and acquiring frame image data corresponding to each frame; compressing each piece of frame image data, and converting the compressed frame image data to image data of a base64 format; converting the image data of the base64 format to a picture file object of a Blob format, and generating, according to each picture file object of the Blob format, a key frame animation based on a cascading style sheet; and when an animation loading request sent based on a webpage is received, loading the key frame animation into the corresponding webpage.

Description

动画播放方法、装置、计算机设备和存储介质Animation playing method, device, computer equipment and storage medium
本申请要求于2019年9月18日提交中国专利局,申请号为2019108819381,申请名称为“动画播放方法、装置、计算机设备和存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of a Chinese patent application filed with the Chinese Patent Office on September 18, 2019. The application number is 2019108819381 and the application name is "animation playback method, device, computer equipment and storage medium". The entire content is incorporated by reference. In this application.
技术领域Technical field
本申请涉及一种动画播放方法、装置、计算机设备和存储介质。This application relates to an animation playback method, device, computer equipment and storage medium.
背景技术Background technique
随着网页技术的发展,越来越多的网页页面通过展示动态图像,以实现页面的动画效果,丰富网页页面内容。目前,常见的动态图片为图像互换格式(Graphics Interchange Format,GIF)图像,GIF图像文件中存储有多幅图像,通过将这些图像逐幅读出并显示到屏幕上,构成了动态图的效果,实现显示简单动画;但是,发明人意识到,基于HTML5的网页通过播放GIF图像以实现动画效果时,由于动态图像文件较大,往往导致在网页加载过程中,加载GIF图像所需要的时间长,导致动画播放的速度慢、流畅度差。With the development of web page technology, more and more web pages display dynamic images to achieve page animation effects and enrich web page content. At present, common dynamic pictures are graphics interchange format (Graphics Interchange Format, GIF) images. GIF image files store multiple images. These images are read out one by one and displayed on the screen to form the effect of the dynamic picture. , To realize the display of simple animation; however, the inventor realized that when HTML5-based web pages play GIF images to achieve animation effects, due to the large dynamic image files, it often takes a long time to load GIF images during the web page loading process , Resulting in slow animation playback speed and poor fluency.
发明内容Summary of the invention
根据本申请公开的各种实施例,提供一种动画播放方法、装置、计算机设备和存储介质。According to various embodiments disclosed in the present application, an animation playback method, device, computer equipment, and storage medium are provided.
一种动画播放方法包括:An animation playback method includes:
将动态图像文件分解为序列帧图像,并获取每一帧对应的帧图像数据;Decompose the dynamic image file into a sequence of frame images, and obtain the frame image data corresponding to each frame;
对各所述帧图像数据进行压缩,并将压缩后的帧图像数据转换为base64格式的图像数据;Compressing each of the frame image data, and converting the compressed frame image data into base64 format image data;
将各所述base64格式的图像数据转换为Blob格式的图片文件对象;Converting each of the image data in the base64 format into a picture file object in the Blob format;
将各所述Blob格式的图片文件对象一一生成基于层叠样式表的关键帧, 得到关键帧动画;及Generate key frames based on the cascading style sheet for each of the picture file objects in the Blob format one by one to obtain the key frame animation; and
在接收到基于网页页面发出的动图加载请求时,将所述关键帧动画加载至对应的网页页面中。When receiving the animation loading request based on the web page, the key frame animation is loaded into the corresponding web page.
一种动画播放装置,所述装置包括:An animation playback device, the device includes:
图像数据获取模块,用于将动态图像文件分解为序列帧图像,并获取每一帧对应的帧图像数据;The image data acquisition module is used to decompose the dynamic image file into a sequence of frame images and acquire the frame image data corresponding to each frame;
图像编码获取模块,用于对各所述帧图像数据进行压缩,并将压缩后的帧图像数据转换为base64格式的图像数据;An image encoding acquisition module, used to compress each of the frame image data, and convert the compressed frame image data into base64 format image data;
关键帧动画生成模块,用于将各所述base64格式的图像数据转换为Blob格式的图片文件对象;将各所述Blob格式的图片文件对象一一生成基于层叠样式表的关键帧,得到关键帧动画;及A key frame animation generating module, used to convert each of the image data in the base64 format into a picture file object in the Blob format; generate the key frames based on the cascading style sheet one by one from the picture file objects in the Blob format to obtain the key frames Animation; and
动画播放模块,用于在接收到基于网页页面发出的动图加载请求时,将所述关键帧动画加载至对应的网页页面中。The animation playing module is used to load the key frame animation to the corresponding web page when receiving a moving image loading request based on the web page.
一种计算机设备,包括存储器和一个或多个处理器,所述存储器中储存有计算机可读指令,所述计算机可读指令被所述处理器执行时,使得所述一个或多个处理器执行以下步骤:A computer device, including a memory and one or more processors, the memory stores computer readable instructions, and when the computer readable instructions are executed by the processor, the one or more processors execute The following steps:
将动态图像文件分解为序列帧图像,并获取每一帧对应的帧图像数据;Decompose the dynamic image file into a sequence of frame images, and obtain the frame image data corresponding to each frame;
对各所述帧图像数据进行压缩,并将压缩后的帧图像数据转换为base64格式的图像数据;Compressing each of the frame image data, and converting the compressed frame image data into base64 format image data;
将各所述base64格式的图像数据转换为Blob格式的图片文件对象;Converting each of the image data in the base64 format into a picture file object in the Blob format;
将各所述Blob格式的图片文件对象一一生成基于层叠样式表的关键帧,得到关键帧动画;及Generate key frames based on the cascading style sheet one by one of the picture file objects in the Blob format to obtain the key frame animation; and
在接收到基于网页页面发出的动图加载请求时,将所述关键帧动画加载至对应的网页页面中。When receiving the animation loading request based on the web page, the key frame animation is loaded into the corresponding web page.
一个或多个存储有计算机可读指令的非易失性计算机可读存储介质,计算机可读指令被一个或多个处理器执行时,使得一个或多个处理器执行以下步骤:One or more non-volatile computer-readable storage media storing computer-readable instructions. When the computer-readable instructions are executed by one or more processors, the one or more processors perform the following steps:
将动态图像文件分解为序列帧图像,并获取每一帧对应的帧图像数据;Decompose the dynamic image file into a sequence of frame images, and obtain the frame image data corresponding to each frame;
对各所述帧图像数据进行压缩,并将压缩后的帧图像数据转换为base64格式的图像数据;Compressing each of the frame image data, and converting the compressed frame image data into base64 format image data;
将各所述base64格式的图像数据转换为Blob格式的图片文件对象;Converting each of the image data in the base64 format into a picture file object in the Blob format;
将各所述Blob格式的图片文件对象一一生成基于层叠样式表的关键帧,得到关键帧动画;及Generate key frames based on the cascading style sheet one by one of the picture file objects in the Blob format to obtain the key frame animation; and
在接收到基于网页页面发出的动图加载请求时,将所述关键帧动画加载至对应的网页页面中。When receiving the animation loading request based on the web page, the key frame animation is loaded into the corresponding web page.
本申请的一个或多个实施例的细节在下面的附图和描述中提出。本申请的其它特征和优点将从说明书、附图以及权利要求书变得明显。The details of one or more embodiments of the present application are set forth in the following drawings and description. Other features and advantages of this application will become apparent from the description, drawings and claims.
附图说明Description of the drawings
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其它的附图。In order to more clearly describe the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings needed in the embodiments. Obviously, the drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, without creative work, other drawings can be obtained from these drawings.
图1为根据一个或多个实施例中动画播放方法的应用场景图。Fig. 1 is an application scenario diagram of an animation playing method according to one or more embodiments.
图2为根据一个或多个实施例中计算机设备的框图。Figure 2 is a block diagram of a computer device according to one or more embodiments.
图3为根据一个或多个实施例中动画播放方法的流程示意图。Fig. 3 is a schematic flowchart of an animation playing method according to one or more embodiments.
图4为另一个实施例中动画播放方法的流程示意图。Fig. 4 is a schematic flowchart of an animation playing method in another embodiment.
图5为根据一个或多个实施例中动画播放方法装置的框图。Fig. 5 is a block diagram of an animation playing method and apparatus according to one or more embodiments.
具体实施方式detailed description
为了使本申请的技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。In order to make the technical solutions and advantages of the present application clearer, the following further describes the present application in detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described here are only used to explain the present application, and are not used to limit the present application.
图1为一个实施例中动画播放方法的应用环境图。该动画播放方法应用 与计算机设备中,该计算机设备可以是服务器。如图1所示,以该计算机设备为服务器102为例,服务器102获取原本需要播放的动态图像文件,例如GIF图像文件,服务器102将该GIF图像文件分解为逐帧的帧图像数据,对每帧图像数据进行压缩后,将压缩后的图像数据转换为格式为base64格式的图像数据,进而将base64格式的图像数据转换为Blob格式的图片文件对象,最终在根据图片文件对象生成基于层叠样式表(Cascading Style Sheets,CSS)的关键帧动画,在用户通过浏览器访问网页页面时,网页页面可直接加载基于CSS的关键帧动画,实现将多个帧图像数据对应的图片文件对象进行播放以形成动态的动画,本方法通过将文件体积大的动态图像文件中每一帧的图像数据转换为体积较小的Blob格式的图片文件对象,并利用图像编码以基于CSS的关键帧的方式对每一帧图像进行播放,实现动画效果,使得动画加载速度以及动画播放的流畅性得到提升。Fig. 1 is an application environment diagram of an animation playing method in an embodiment. The animation playing method is applied to computer equipment, and the computer equipment may be a server. As shown in Fig. 1, taking the computer device as the server 102 as an example, the server 102 obtains a dynamic image file that originally needs to be played, such as a GIF image file, and the server 102 decomposes the GIF image file into frame-by-frame image data. After the frame image data is compressed, the compressed image data is converted into image data in base64 format, and then the image data in base64 format is converted into a picture file object in Blob format, and finally a stacking style sheet is generated based on the picture file object (Cascading Style Sheets, CSS) key frame animation, when the user accesses the web page through the browser, the web page can directly load the key frame animation based on CSS to realize the playback of image file objects corresponding to multiple frame image data to form For dynamic animation, this method converts the image data of each frame in a dynamic image file with a large file volume into a small image file object in Blob format, and uses image coding to encode each frame in a CSS-based key frame. Frame images are played to achieve animation effects, so that the animation loading speed and the smoothness of animation playback are improved.
图2为一个实施例中计算机设备的内部结构示意图。如图2所示,该计算机设备包括通过系统总线连接的处理器、存储器、网络接口和数据库。该计算机设备的处理器用于提供计算和控制能力。该计算机设备的存储器包括非易失性存储介质、内存储器。该非易失性存储介质存储有操作系统、计算机程序和数据库。该内存储器为非易失性存储介质中的操作系统和计算机程序的运行提供环境。该计算机设备的数据库用于存储GIF图像数据、图像编码等不同数据信息。该计算机设备的网络接口用于与外部的终端通过网络连接通信。该计算机程序被处理器执行时以实现一种动画播放方法。Fig. 2 is a schematic diagram of the internal structure of a computer device in an embodiment. As shown in Figure 2, the computer device includes a processor, a memory, a network interface, and a database connected through a system bus. The processor of the computer device is used to provide calculation and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The database of the computer equipment is used to store different data information such as GIF image data and image coding. The network interface of the computer device is used to communicate with an external terminal through a network connection. The computer program is executed by the processor to realize an animation playback method.
本领域技术人员可以理解,图1以及图2示出的图例,仅仅与本申请方案相关的部分场景,并不构成对本申请应用环境的限定。Those skilled in the art can understand that the illustrations shown in FIG. 1 and FIG. 2 are only part of the scenarios related to the solution of the present application, and do not constitute a limitation on the application environment of the present application.
在其中一个实施例中,如图3所示,提供了一种动画播放方法,以该方法应用于图1中的服务器为例进行说明,包括以下步骤:In one of the embodiments, as shown in FIG. 3, an animation playback method is provided. Taking the method applied to the server in FIG. 1 as an example for description, the method includes the following steps:
步骤202:将动态图像文件分解为序列帧图像,并获取每一帧对应的帧图像数据。Step 202: Decompose the dynamic image file into a sequence of frame images, and obtain frame image data corresponding to each frame.
本步骤中,动态图像文件可以是GIF(Graphics Interchange Format,图像 互换格式)图像文件、flash图像文件等;动态图像文件中存储多幅图像数据,动态图像文件在显示时将这些图像数据逐幅读取显示以形成动画;具体的,服务器通过对动态图像文件进行解析,从中获取序列帧图像,并提取每一帧图像对应的帧图像数据。In this step, the dynamic image file can be a GIF (Graphics Interchange Format, image interchange format) image file, flash image file, etc.; the dynamic image file stores multiple image data, and the dynamic image file displays these image data one by one. Read the display to form an animation; specifically, the server obtains a sequence of frame images from the dynamic image file by analyzing the dynamic image file, and extracts the frame image data corresponding to each frame image.
步骤204:对各帧图像数据进行压缩,并将压缩后的帧图像数据转换为base64格式的图像数据。Step 204: Compress each frame of image data, and convert the compressed frame of image data into base64 format image data.
本步骤中,base64是用于传输8bit字节码的编码方式,base64格式的天突穴数据是一串字符串码,可以直接写入至HTML网页或层叠样式表(Cascading Style Sheets,CSS)中。服务器在获取到帧图像数据后,可以对帧图像数据进行压缩,以降低帧图像数据的数据量,然后对帧图像数据进行转码,转换为base64格式的图像编码。In this step, base64 is the encoding method used to transmit 8bit byte codes, and the Tiantu cave data in base64 format is a string of string codes that can be directly written into HTML web pages or Cascading Style Sheets (CSS) . After obtaining the frame image data, the server can compress the frame image data to reduce the data volume of the frame image data, and then transcode the frame image data into base64 format image encoding.
具体的,服务器在获取到动态图像文件中的每一帧对应的帧图像数据后,在保证图片不失真的情况下,可以通过图片处理压缩工具对各帧的帧图像数据进行压缩,以降低每一帧的帧图像数据的文件体积;在对帧图像数据进行压缩后,服务器使用Webpack打包工具将压缩后的帧图像数据转码为base64格式的图像编码。Specifically, after the server obtains the frame image data corresponding to each frame in the dynamic image file, it can compress the frame image data of each frame through the image processing compression tool under the condition that the picture is not distorted, so as to reduce the The file volume of one frame of frame image data; after the frame image data is compressed, the server uses the Webpack packaging tool to transcode the compressed frame image data into base64 format image encoding.
步骤206:将各base64格式的图像数据转换为Blob格式的图片文件对象,根据各Blob格式的图片文件对象生成基于层叠样式表的关键帧动画。Step 206: Convert the image data in each base64 format into a picture file object in the Blob format, and generate a key frame animation based on the cascading style sheet according to the picture file object in each Blob format.
其中,Blob(Binary Large Object)格式是二进制类型的大对象;服务器将图像编码转换为以Blob格式的文本数据串形式,得到图片文件对象,在保证图片精度不变的同时,进一步压缩图片数据的体积。Among them, the Blob (Binary Large Object) format is a binary type of large object; the server converts the image encoding into a text data string in the Blob format to obtain the image file object, which further compresses the image data while ensuring the accuracy of the image remains unchanged. volume.
其中,根据各Blob格式的图片文件对象生成基于层叠样式表的关键帧动画的步骤,包括将各所述Blob格式的图片文件对象一一生成基于层叠样式表的关键帧,得到关键帧动画。具体的,服务器在将base64格式的图像数据进一步压缩为Blob格式的图片文件对象后,将每一帧的帧图像数据对应的图片文件对象一一生成基于层叠样式表的关键帧,形成关键帧动画;后续在加载关键帧时对文件体积较小图片文件对象进行加载,在保持图片质量高精度的 同时不影响流畅性,保证图片加载渲染,提高动画播放的流畅性。Wherein, the step of generating a key frame animation based on the cascading style sheet according to the picture file objects in each Blob format includes generating key frames based on the cascading style sheet for each picture file object in the Blob format one by one to obtain the key frame animation. Specifically, after the server further compresses the image data in the base64 format into the image file object in the Blob format, the image file object corresponding to the frame image data of each frame is generated one by one based on the key frame of the cascading style sheet to form the key frame animation ; Subsequent loading of the image file object with a small file size when loading the key frame, while maintaining the image quality and high precision without affecting the fluency, ensuring the image loading and rendering, and improving the fluency of animation playback.
步骤208:在接收到基于网页页面发出的动图加载请求时,将关键帧动画加载至对应的网页页面中。Step 208: When receiving the animation loading request based on the web page, load the key frame animation to the corresponding web page.
当接收到客户端发送的网页页面加载请求时,服务器响应加载请求,在加载网页页面时,直接将基于CSS的关键帧动画进行加载,使原有的动态图像文件以CSS的关键帧动画形式进行播放。When receiving the web page loading request sent by the client, the server responds to the loading request. When the web page is loaded, it directly loads the CSS-based key frame animation, so that the original dynamic image file is performed in the form of CSS key frame animation Play.
上述动画播放方法中,通过将动态图像文件分解为序列帧图像,以获取每一帧对应的帧图像数据,在对各帧图像数据进行压缩,并在将压缩后的帧图像数据转换为base64格式的图像数据后,将各base64格式的图像数据转换为Blob格式的图片文件对象,根据各Blob格式的图片文件对象生成基于层叠样式表的关键帧动画,后续在接收到基于网页页面发出的动图加载请求时,将关键帧动画加载至对应的网页页面中,本方法通过将文件体积大的动态图像文件中每一帧的帧图像数据转换为体积小的Blob格式的图片文件对象,实现保持图片精度的同时,文件体积得到压缩,将图片文件对象以基于CSS的关键帧的方式对每一帧图像进行播放,实现动画效果,使得动画加载速度以及动画播放的流畅性得到提升。In the above animation playback method, the dynamic image file is decomposed into a sequence of frame images to obtain the frame image data corresponding to each frame, and the image data of each frame is compressed, and the compressed frame image data is converted into base64 format. After the image data, the image data in the base64 format is converted into the image file object in the Blob format, and the key frame animation based on the cascading style sheet is generated according to the image file object in the Blob format, and then the animation based on the web page is received. When loading the request, the key frame animation is loaded into the corresponding web page. This method converts the frame image data of each frame in the dynamic image file with a large file volume into a small Blob format image file object to realize the preservation of the image At the same time of accuracy, the file volume is compressed, and the image file object is played to each frame of image in the form of CSS-based key frames to achieve animation effects, so that the animation loading speed and the smoothness of animation playback are improved.
在其中一个实施例中,将各Blob格式的图片文件对象一一生成基于层叠样式表的关键帧,得到关键帧动画的步骤,包括:根据序列帧图像中各个帧图像数据的顺序,设置关键帧动画中各个关键帧的触发百分比值;将与各帧图像数据对应的Blob格式的图片文件对象分别设置为各关键帧的图像样式,得到关键帧动画。In one of the embodiments, the step of generating key frames based on the cascading style sheet for each Blob format picture file object to obtain the key frame animation includes: setting the key frame according to the sequence of each frame image data in the sequence of frame images The trigger percentage value of each key frame in the animation; the Blob format picture file object corresponding to the image data of each frame is set as the image style of each key frame to obtain the key frame animation.
其中,关键帧的触发百分比值是指关键帧动画中不同的时间节点;设置各个关键帧的触发百分比值也就是定义的是在不同百分比值(时间节点)时显示不同的关键帧。Among them, the trigger percentage value of the key frame refers to different time nodes in the key frame animation; setting the trigger percentage value of each key frame also defines that different key frames are displayed at different percentage values (time nodes).
具体地,服务器根据序列帧图像中每帧帧图像数据间的顺序,即可确定每帧帧图像数据的显示顺序,从而根据各帧帧图像数据的显示顺序设置关键帧的触发百分比值,从而将帧图像数据对应的图像编码作为元素状态写入至 对应关键帧中,实现设置关键帧动画中各个关键帧的图片样式,使得在一个触发百分比值(时间节点)显示一个帧图像数据,实现动画播放效果。Specifically, the server can determine the display order of the image data of each frame according to the sequence of the image data of each frame in the sequence of frame images, so as to set the trigger percentage value of the key frame according to the display order of the image data of each frame, thereby changing The image code corresponding to the frame image data is written into the corresponding key frame as the element state, and the picture style of each key frame in the key frame animation is set, so that a frame image data is displayed at a trigger percentage value (time node) to realize animation playback effect.
在其中一个实施例中,根据序列帧图像中各个帧图像数据的顺序,设置关键帧动画中各个关键帧的触发百分比值的步骤,包括:获取关键帧动画的显示时长;根据序列帧图像中各个帧图像数据的顺序以及显示时长,确定每一帧对应的帧图像数据的显示时刻;根据显示时刻设置关键帧动画中各个关键帧的触发百分比值。In one of the embodiments, the step of setting the trigger percentage value of each key frame in the key frame animation according to the sequence of each frame image data in the sequence frame image includes: obtaining the display duration of the key frame animation; The sequence of the frame image data and the display duration determine the display time of the frame image data corresponding to each frame; the trigger percentage value of each key frame in the key frame animation is set according to the display time.
显示时长是指关键帧动画播放一次所用的时间,在其中一个实施例中,服务器可以获取动态图像文件的播放时间,确定为关键帧动画的显示时长,或者,服务器可以获取预设的关键帧动画的帧频以及帧图像数据的数量,确定关键帧动画的显示时长。The display duration refers to the time it takes for the key frame animation to be played once. In one embodiment, the server may obtain the playing time of the dynamic image file and determine it as the display duration of the key frame animation, or the server may obtain the preset key frame animation The frame rate and the number of frame image data determine the display duration of the key frame animation.
具体地,服务器在获取到关键帧动画的显示时长后,可以根据播放时间以及各个帧图像数据的顺序,分别确定各个帧图像数据的显示时刻,进而根据显示时刻设置各个帧图像数据所对应的关键帧的触发百分比值。Specifically, after the server obtains the display duration of the key frame animation, it can determine the display time of each frame of image data according to the playback time and the sequence of each frame of image data, and then set the key corresponding to each frame of image data according to the display time. The trigger percentage value of the frame.
在其中一个实施例中,根据帧图像数据间的序列以及各图片文件对象生成基于层叠样式表的关键帧动画的步骤,包括:创建各Blob格式的图片文件对象的请求链接;将各帧图像数据对应的请求链接分别设置为各关键帧的图片样式,得到关键帧动画。In one of the embodiments, the step of generating a key frame animation based on the cascading style sheet according to the sequence between the frame image data and each picture file object includes: creating a request link for each picture file object in the Blob format; The corresponding request links are respectively set as the picture style of each key frame, and the key frame animation is obtained.
本实施例中,图片文件对象的请求链接是指图片文件对象的请求地址;服务器在将图像编码转换为以Blob格式的文本数据串形式后,将Blob格式的图片文件对象进行保存,并生成该图片文件对象的请求地址Blob URL,通过将图片文件对象的请求地址作为元素状态写入至对应关键帧中,实现设置关键帧动画中各个关键帧的图片样式。Blob URL的长度一般比较短,在显示大图片时,相对于直接使用帧图像数据的base64格式的图像编码,使用图片文件对象的请求地址可以有效提高图片的加载速度,进而提高动画加载速度以及流畅度。In this embodiment, the request link of the picture file object refers to the request address of the picture file object; after the server converts the image code into a text data string in the Blob format, it saves the picture file object in the Blob format and generates this The request address Blob URL of the picture file object is written into the corresponding key frame as the element state of the request address of the picture file object to realize the setting of the picture style of each key frame in the key frame animation. The length of the Blob URL is generally relatively short. When displaying large pictures, compared to the base64 format image encoding that directly uses the frame image data, the use of the request address of the picture file object can effectively increase the loading speed of the picture, thereby improving the loading speed and smoothness of the animation degree.
在其中一个实施例中,如图4所示,提供了一种动画播放方法,以该方 法应用于图1中的服务器为例进行说明,包括以下步骤:In one of the embodiments, as shown in Fig. 4, an animation playback method is provided. Taking the method applied to the server in Fig. 1 as an example for description, the method includes the following steps:
步骤302:根据动态图像文件的文件类型确定与动态图像文件的解码算法;Step 302: Determine the decoding algorithm of the dynamic image file according to the file type of the dynamic image file;
步骤304:解析动态图像文件,获得动态图像文件中的图像数据块;Step 304: Parse the dynamic image file to obtain image data blocks in the dynamic image file;
步骤306:利用解码算法对图像数据块进行解码,得到解码后的序列帧图像;Step 306: Use a decoding algorithm to decode the image data block to obtain a decoded sequence of frame images;
步骤308:获取每一帧对应的帧图像数据;Step 308: Obtain frame image data corresponding to each frame;
步骤310:对各帧图像数据进行压缩,并将压缩后的帧图像数据转换为base64格式的图像数据;Step 310: Compress each frame of image data, and convert the compressed frame of image data into base64 format image data;
步骤312:将各base64格式的图像数据转换为Blob格式的图片文件对象;Step 312: Convert each image data in base64 format into a picture file object in Blob format;
步骤314:获取关键帧动画的显示时长;Step 314: Obtain the display duration of the key frame animation;
步骤316:根据序列帧图像中各个帧图像数据的顺序以及显示时长,确定每一帧对应的帧图像数据的显示时刻;Step 316: Determine the display time of the frame image data corresponding to each frame according to the sequence and display duration of each frame image data in the sequence of frame images;
步骤318:根据显示时刻设置关键帧动画中各个关键帧的触发百分比值;Step 318: Set the trigger percentage value of each key frame in the key frame animation according to the display moment;
步骤320:创建各Blob格式的图片文件对象的请求链接,将各帧图像数据对应的请求链接分别设置为各关键帧的图片样式,得到关键帧动画;Step 320: Create a request link for each Blob format picture file object, and set the request link corresponding to each frame of image data to the picture style of each key frame to obtain the key frame animation;
步骤322:在接收到基于网页页面发出的动图加载请求时,将关键帧动画加载至对应的网页页面中。Step 322: When receiving the animation loading request based on the web page, load the key frame animation to the corresponding web page.
本实施例中,通过将动态图像文件逐帧分解为帧图像数据,并对每帧的帧图像数据进行压缩后,对压缩后的帧图像数据进行从普通图片格式例如jpg格式的帧图像数据—>base64格式的图像编码—>Blob格式的图片文件对象的转换,最终获得的Blob格式的图片文件对象在保持图片精度的同时,文件体积得到压缩,从而将帧图像数据对应的图片文件对象作为元素状态写入至对应关键帧中,实现设置关键帧动画中各个关键帧的图片样式,使得在一个触发百分比值(时间节点)显示一个帧图像数据,实现动画播放效果,当用户通过浏览器访问web网页时,web网页中的动画加载速度提升,同时提高了动画的清晰度以及流畅度。In this embodiment, by decomposing the dynamic image file frame by frame into frame image data, and compressing the frame image data of each frame, the compressed frame image data is converted from the frame image data of the ordinary picture format, such as jpg format— >base64 format image encoding—>Blob format image file object conversion, the finally obtained Blob format image file object maintains the accuracy of the image, while the file volume is compressed, so that the image file object corresponding to the frame image data is used as an element The state is written into the corresponding key frame to realize the setting of the picture style of each key frame in the key frame animation, so that a frame image data is displayed at a trigger percentage value (time node) to realize the animation playback effect. When the user accesses the web through a browser The loading speed of the animation in the web page is increased while the web page is being used, and the clarity and smoothness of the animation are also improved.
在其中一个实施例中,将动态图像文件分解为序列帧图像,并获取每一帧对应的帧图像数据的步骤,包括以下步骤:根据动态图像文件的文件类型确定与动态图像文件的解码算法;解析动态图像文件,获得动态图像文件中的图像数据块;利用解码算法对图像数据块进行解码,得到解码后的序列帧图像。In one of the embodiments, the step of decomposing the dynamic image file into a sequence of frame images and obtaining the frame image data corresponding to each frame includes the following steps: determining the decoding algorithm for the dynamic image file according to the file type of the dynamic image file; Analyze the dynamic image file to obtain the image data block in the dynamic image file; use the decoding algorithm to decode the image data block to obtain the decoded sequence frame image.
本实施例中,图像数据块为保存着图像数据的数据块;服务器通过动态图像文件的类型确定动态图像文件的解码算法,解码过程就是利用解码算法对动态图像文件中已编码压缩的图像数据块进行解码,得到解码后的数据流,即得到多帧连续的序列帧图像,从而在解码后的数据流中获取每一帧对应的帧帧图像数据。In this embodiment, the image data block is the data block that stores the image data; the server determines the decoding algorithm of the dynamic image file through the type of the dynamic image file, and the decoding process is to use the decoding algorithm to encode and compress the image data block in the dynamic image file. After decoding, the decoded data stream is obtained, that is, multiple consecutive frame images are obtained, so that the frame image data corresponding to each frame is obtained in the decoded data stream.
以动态图像文件为GIF图像文件为例,GIF图像文件的结构包括文件头、图像互换格式数据流和文件格式终结器三部分,其中,图像互换格式数据流为保存着图像数据的图像数据块,且使用LZW压缩算法编码获得的。服务器在确定到动态图像文件的文件类型为GIF图后,确定解码算法为LZW解码算法,并利用LZW解码算法对GIF动态图像文件中的图像互换格式数据流进行解码,获取GIF动态图像文件的序列帧图像。通过对GIF动态图像文件分解为序列帧图像,以获取GIF动态图像文件中每一帧的图像,以便后续实现以CSS关键帧动画的形式展示该GIF动态图像文件。Taking the dynamic image file as a GIF image file as an example, the structure of the GIF image file includes three parts: the file header, the image interchange format data stream, and the file format terminator. Among them, the image interchange format data stream is the image data that stores the image data. Block, and obtained by encoding using the LZW compression algorithm. After determining that the file type of the dynamic image file is a GIF image, the server determines that the decoding algorithm is the LZW decoding algorithm, and uses the LZW decoding algorithm to decode the image interchange format data stream in the GIF dynamic image file to obtain the GIF dynamic image file Sequence of frame images. By decomposing the GIF dynamic image file into a sequence of frame images, the image of each frame in the GIF dynamic image file is obtained, so that the subsequent realization of the GIF dynamic image file is displayed in the form of CSS key frame animation.
应该理解的是,虽然图3以及图4的流程图中的各个步骤按照箭头的指示依次显示,但是这些步骤并不是必然按照箭头指示的顺序依次执行。除非本文中有明确的说明,这些步骤的执行并没有严格的顺序限制,这些步骤可以以其它的顺序执行。而且,图3以及图4中的至少一部分步骤可以包括多个子步骤或者多个阶段,这些子步骤或者阶段并不必然是在同一时刻执行完成,而是可以在不同的时刻执行,这些子步骤或者阶段的执行顺序也不必然是依次进行,而是可以与其它步骤或者其它步骤的子步骤或者阶段的至少一部分轮流或者交替地执行。It should be understood that although the various steps in the flowcharts of FIG. 3 and FIG. 4 are displayed in sequence as indicated by the arrows, these steps are not necessarily performed in sequence in the order indicated by the arrows. Unless there is a clear description in this article, there is no strict order for the execution of these steps, and these steps can be executed in other orders. Moreover, at least part of the steps in Figure 3 and Figure 4 may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. These sub-steps or The execution order of the stages is not necessarily carried out sequentially, but may be executed alternately or alternately with at least a part of other steps or sub-steps or stages of other steps.
在其中一个实施例中,如图5所示,提供了一种动画播放装置,包括:帧图像数据获取模块410、图像编码获取模块420、关键帧动画生成模块430和动画播放模块440,其中:In one of the embodiments, as shown in FIG. 5, an animation playback device is provided, including: a frame image data acquisition module 410, an image encoding acquisition module 420, a key frame animation generation module 430, and an animation playback module 440, wherein:
图像数据获取模块410,用于将动态图像文件分解为序列帧图像,并获取每一帧对应的帧图像数据;The image data acquisition module 410 is used for decomposing the dynamic image file into a sequence of frame images, and acquiring frame image data corresponding to each frame;
图像编码获取模块420,用于对各帧图像数据进行压缩,并将压缩后的帧图像数据转换为base64格式的图像数据;The image encoding acquisition module 420 is used to compress each frame of image data and convert the compressed frame image data into base64 format image data;
关键帧动画生成模块430,用于将各base64格式的图像数据转换为Blob格式的图片文件对象;将各Blob格式的图片文件对象一一生成基于层叠样式表的关键帧,得到关键帧动画;及The key frame animation generating module 430 is used to convert the image data of each base64 format into the picture file object of the Blob format; generate the key frame based on the cascading style sheet one by one of the picture file objects of each Blob format to obtain the key frame animation; and
动画播放模块440,用于在接收到基于网页页面发出的动图加载请求时,将关键帧动画加载至对应的网页页面中。The animation playing module 440 is configured to load the key frame animation into the corresponding web page when receiving the animation loading request based on the web page.
在其中一个实施例中,关键帧动画生成模块,用于根据序列帧图像中各个帧图像数据的顺序,设置关键帧动画中各个关键帧的触发百分比值;将与各帧图像数据对应的Blob格式的图片文件对象分别设置为各关键帧的图像样式,得到关键帧动画。In one of the embodiments, the key frame animation generation module is used to set the trigger percentage value of each key frame in the key frame animation according to the sequence of each frame image data in the sequence frame image; the Blob format corresponding to each frame image data The image file object of is set to the image style of each key frame, and the key frame animation is obtained.
在其中一个实施例中,关键帧动画生成模块,还用于获取关键帧动画的显示时长;根据序列帧图像中各个帧图像数据的顺序以及显示时长,确定每一帧对应的帧图像数据的显示时刻;根据显示时刻设置关键帧动画中各个关键帧的触发百分比值。In one of the embodiments, the key frame animation generation module is also used to obtain the display duration of the key frame animation; according to the sequence and display duration of each frame image data in the sequence of frame images, the display of the frame image data corresponding to each frame is determined Time: Set the trigger percentage value of each key frame in the key frame animation according to the display time.
在其中一个实施例中,关键帧动画生成模块,还用于创建各Blob格式的图片文件对象的请求链接;将各帧图像数据对应的请求链接分别设置为各关键帧的图片样式,得到关键帧动画。In one of the embodiments, the key frame animation generation module is also used to create a request link for each Blob format picture file object; the request link corresponding to each frame of image data is set to the picture style of each key frame to obtain the key frame Animation.
在其中一个实施例中,图像数据获取模块,用于根据动态图像文件的文件类型确定与动态图像文件的解码算法;解析动态图像文件,获得动态图像文件中的图像数据块;利用解码算法对图像数据块进行解码,得到解码后的序列帧图像。In one of the embodiments, the image data acquisition module is used to determine the decoding algorithm of the dynamic image file according to the file type of the dynamic image file; parse the dynamic image file to obtain the image data block in the dynamic image file; The data block is decoded, and the decoded sequence frame image is obtained.
关于动画播放装置的具体限定可以参见上文中对于动画播放方法的限定,在此不再赘述。上述动画播放装置中的各个模块可全部或部分通过软件、硬件及其组合来实现。上述各模块可以硬件形式内嵌于或独立于计算机设备中的处理器中,也可以以软件形式存储于计算机设备中的存储器中,以便于处理器调用执行以上各个模块对应的操作。For the specific limitation of the animation playback device, please refer to the above limitation of the animation playback method, which will not be repeated here. The various modules in the above-mentioned animation playback device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules may be embedded in the form of hardware or independent of the processor in the computer equipment, or may be stored in the memory of the computer equipment in the form of software, so that the processor can call and execute the operations corresponding to the above-mentioned modules.
在一个实施例中,提供了一种计算机设备,该计算机设备可以是服务器,其内部结构图可以如图2所示。该计算机设备包括通过系统总线连接的处理器、存储器、网络接口和数据库。其中,该计算机设备的处理器用于提供计算和控制能力。该计算机设备的存储器包括非易失性计算机可读存储介质、内存储器。该非易失性计算机可读存储介质存储有操作系统、计算机可读指令和数据库。该内存储器为非易失性计算机可读存储介质中的操作系统和计算机可读指令的运行提供环境。该计算机设备的数据库用于存储动态图像文件、图像数据等数据。该计算机设备的网络接口用于与外部的终端通过网络连接通信。该计算机可读指令被处理器执行时以实现一种动画播放方法。In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as shown in FIG. 2. The computer equipment includes a processor, a memory, a network interface, and a database connected through a system bus. Among them, the processor of the computer device is used to provide calculation and control capabilities. The memory of the computer device includes a non-volatile computer-readable storage medium and internal memory. The non-volatile computer-readable storage medium stores an operating system, computer-readable instructions, and a database. The internal memory provides an environment for the operation of the operating system and computer-readable instructions in the non-volatile computer-readable storage medium. The database of the computer equipment is used to store dynamic image files, image data and other data. The network interface of the computer device is used to communicate with an external terminal through a network connection. The computer readable instruction is executed by the processor to realize an animation playback method.
本领域技术人员可以理解,图2中示出的结构,仅仅是与本申请方案相关的部分结构的框图,并不构成对本申请方案所应用于其上的计算机设备的限定,具体的计算机设备可以包括比图中所示更多或更少的部件,或者组合某些部件,或者具有不同的部件布置。Those skilled in the art can understand that the structure shown in FIG. 2 is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may Including more or fewer parts than shown in the figure, or combining some parts, or having a different arrangement of parts.
一种计算机设备,包括存储器和一个或多个处理器,存储器中储存有计算机可读指令,计算机可读指令被处理器执行时,使得一个或多个处理器执行以下步骤:A computer device includes a memory and one or more processors. The memory stores computer-readable instructions. When the computer-readable instructions are executed by the processor, the one or more processors perform the following steps:
将动态图像文件分解为序列帧图像,并获取每一帧对应的帧图像数据;Decompose the dynamic image file into a sequence of frame images, and obtain the frame image data corresponding to each frame;
对各帧图像数据进行压缩,并将压缩后的帧图像数据转换为base64格式的图像数据;Compress each frame of image data, and convert the compressed frame image data into base64 format image data;
将各base64格式的图像数据转换为Blob格式的图片文件对象;将各Blob格式的图片文件对象一一生成基于层叠样式表的关键帧,得到关键帧动画;及Convert image data in base64 format into picture file objects in Blob format; generate key frames based on cascading style sheets one by one from picture file objects in Blob format to obtain key frame animation; and
在接收到基于网页页面发出的动图加载请求时,将关键帧动画加载至对应的网页页面中。When receiving the animation loading request based on the web page, the key frame animation is loaded into the corresponding web page.
在其中一个实施例中,处理器执行计算机可读指令实现将各Blob格式的图片文件对象一一生成基于层叠样式表的关键帧,得到关键帧动画的步骤,具体实现以下步骤:根据序列帧图像中各个帧图像数据的顺序,设置关键帧动画中各个关键帧的触发百分比值;将与各帧图像数据对应的Blob格式的图片文件对象分别设置为各关键帧的图像样式,得到关键帧动画。In one of the embodiments, the processor executes computer-readable instructions to realize the step of generating key frames based on the cascading style sheet for each Blob format picture file object one by one to obtain the key frame animation, which specifically implements the following steps: according to the sequence of frame images Set the trigger percentage value of each key frame in the key frame animation in the sequence of each frame of image data in the key frame animation; set the Blob format picture file object corresponding to each frame of image data to the image style of each key frame to obtain the key frame animation.
在其中一个实施例中,处理器执行计算机可读指令实现根据序列帧图像中各个帧图像数据的顺序,设置关键帧动画中各个关键帧的触发百分比值的步骤,具体包括以下步骤:获取关键帧动画的显示时长;根据序列帧图像中各个帧图像数据的顺序以及显示时长,确定每一帧对应的帧图像数据的显示时刻;根据显示时刻设置关键帧动画中各个关键帧的触发百分比值。In one of the embodiments, the processor executes computer-readable instructions to implement the step of setting the trigger percentage value of each key frame in the key frame animation according to the sequence of each frame image data in the sequence of frame images, which specifically includes the following steps: obtaining key frames Animation display time; according to the sequence and display duration of each frame image data in the sequence of frame images, determine the display time of the frame image data corresponding to each frame; set the trigger percentage value of each key frame in the key frame animation according to the display time.
在其中一个实施例中,处理器执行计算机可读指令实现将与各帧图像数据对应的Blob格式的图片文件对象分别设置为各关键帧的图像样式,得到关键帧动画的步骤,具体实现以下步骤:创建各Blob格式的图片文件对象的请求链接;将各帧图像数据对应的请求链接分别设置为各关键帧的图片样式,得到关键帧动画。In one of the embodiments, the processor executes computer-readable instructions to implement the steps of setting the Blob format picture file object corresponding to each frame of image data to the image style of each key frame to obtain the key frame animation, which specifically implements the following steps : Create a request link for each Blob format picture file object; set the request link corresponding to each frame of image data to the picture style of each key frame to obtain the key frame animation.
在其中一个实施例中,处理器执行计算机可读指令实现将动态图像文件分解为序列帧图像的步骤,具体实现以下步骤:根据动态图像文件的文件类型确定与动态图像文件的解码算法;解析动态图像文件,获得动态图像文件中的图像数据块;利用解码算法对图像数据块进行解码,得到解码后的序列帧图像。In one of the embodiments, the processor executes computer-readable instructions to realize the step of decomposing the dynamic image file into a sequence of frame images, specifically implementing the following steps: determining the file type of the dynamic image file and the decoding algorithm of the dynamic image file; analyzing the dynamic image file The image file obtains the image data block in the dynamic image file; the image data block is decoded by the decoding algorithm to obtain the decoded sequence frame image.
一个或多个存储有计算机可读指令的非易失性计算机可读存储介质,计算机可读指令被一个或多个处理器执行时,使得一个或多个处理器执行以下步骤:One or more non-volatile computer-readable storage media storing computer-readable instructions. When the computer-readable instructions are executed by one or more processors, the one or more processors perform the following steps:
将动态图像文件分解为序列帧图像,并获取每一帧对应的帧图像数据;Decompose the dynamic image file into a sequence of frame images, and obtain the frame image data corresponding to each frame;
对各帧图像数据进行压缩,并将压缩后的帧图像数据转换为base64格式的图像数据;Compress each frame of image data, and convert the compressed frame image data into base64 format image data;
将各base64格式的图像数据转换为Blob格式的图片文件对象;将各Blob格式的图片文件对象一一生成基于层叠样式表的关键帧,得到关键帧动画;及Convert image data in base64 format into picture file objects in Blob format; generate key frames based on cascading style sheets one by one from picture file objects in Blob format to obtain key frame animation; and
在接收到基于网页页面发出的动图加载请求时,将关键帧动画加载至对应的网页页面中。When receiving the animation loading request based on the web page, the key frame animation is loaded into the corresponding web page.
在其中一个实施例中,计算机可读指令被处理器执行实现将各Blob格式的图片文件对象一一生成基于层叠样式表的关键帧,得到关键帧动画的步骤时,具体实现以下步骤:根据序列帧图像中各个帧图像数据的顺序,设置关键帧动画中各个关键帧的触发百分比值;将与各帧图像数据对应的Blob格式的图片文件对象分别设置为各关键帧的图像样式,得到关键帧动画。In one of the embodiments, the computer-readable instructions are executed by the processor to generate key frames based on the cascading style sheet for each picture file object in the Blob format, and when the key frame animation is obtained, the following steps are specifically implemented: according to the sequence Set the sequence of each frame of image data in the frame image, set the trigger percentage value of each key frame in the key frame animation; set the Blob format picture file object corresponding to each frame of image data to the image style of each key frame to obtain the key frame Animation.
在其中一个实施例中,计算机可读指令被处理器执行时还实现根据序列帧图像中各个帧图像数据的顺序,设置关键帧动画中各个关键帧的触发百分比值的步骤,具体实现以下步骤:获取关键帧动画的显示时长;根据序列帧图像中各个帧图像数据的顺序以及显示时长,确定每一帧对应的帧图像数据的显示时刻;根据显示时刻设置关键帧动画中各个关键帧的触发百分比值。In one of the embodiments, when the computer-readable instruction is executed by the processor, the step of setting the trigger percentage value of each key frame in the key frame animation according to the sequence of each frame image data in the sequence of frame images is also implemented, which specifically implements the following steps: Obtain the display duration of the key frame animation; determine the display time of the frame image data corresponding to each frame according to the sequence and display duration of each frame image data in the sequence frame image; set the trigger percentage of each key frame in the key frame animation according to the display time value.
在其中一个实施例中,计算机可读指令被处理器执行实现将与各帧图像数据对应的Blob格式的图片文件对象分别设置为各关键帧的图像样式,得到关键帧动画的步骤,具体实现以下步骤:创建各Blob格式的图片文件对象的请求链接;将各帧图像数据对应的请求链接分别设置为各关键帧的图片样式,得到关键帧动画。In one of the embodiments, the computer-readable instructions are executed by the processor to implement the steps of setting the Blob format picture file object corresponding to each frame of image data to the image style of each key frame to obtain the key frame animation. The specific implementation is as follows Steps: Create request links for picture file objects in each Blob format; set the request links corresponding to each frame of image data to the picture style of each key frame to obtain the key frame animation.
在其中一个实施例中,计算机可读指令被处理器执行时还实现将动态图像文件分解为序列帧图像的步骤,具体实现以下步骤:根据动态图像文件的文件类型确定与动态图像文件的解码算法;解析动态图像文件,获得动态图像文件中的图像数据块;利用解码算法对图像数据块进行解码,得到解码后的序列帧图像。In one of the embodiments, when the computer-readable instructions are executed by the processor, the step of decomposing the dynamic image file into a sequence of frame images is also implemented, and the following steps are specifically implemented: determining the file type of the dynamic image file and the decoding algorithm of the dynamic image file Analyze the dynamic image file to obtain the image data block in the dynamic image file; use the decoding algorithm to decode the image data block to obtain the decoded sequence frame image.
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机可读指令来指令相关的硬件来完成,所述的计算机可读指令可存储于一非易失性计算机可读取存储介质中,该计算机可读指令在执行时,可包括如上述各方法的实施例的流程。其中,本申请所提供的各实施例中所使用的对存储器、存储、数据库或其它介质的任何引用,均可包括非易失性和/或易失性存储器。非易失性存储器可包括只读存储器(ROM)、可编程ROM(PROM)、电可编程ROM(EPROM)、电可擦除可编程ROM(EEPROM)或闪存。易失性存储器可包括随机存取存储器(RAM)或者外部高速缓冲存储器。作为说明而非局限,RAM以多种形式可得,诸如静态RAM(SRAM)、动态RAM(DRAM)、同步DRAM(SDRAM)、双数据率SDRAM(DDRSDRAM)、增强型SDRAM(ESDRAM)、同步链路(Synchlink)DRAM(SLDRAM)、存储器总线(Rambus)直接RAM(RDRAM)、直接存储器总线动态RAM(DRDRAM)、以及存储器总线动态RAM(RDRAM)等。A person of ordinary skill in the art can understand that all or part of the processes in the methods of the above-mentioned embodiments can be implemented by instructing relevant hardware through computer-readable instructions. The computer-readable instructions can be stored in a non-volatile computer. In a readable storage medium, when the computer-readable instructions are executed, they may include the processes of the above-mentioned method embodiments. Wherein, any reference to memory, storage, database or other media used in the embodiments provided in this application may include non-volatile and/or volatile memory. Non-volatile memory may include read only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not a limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous chain Channel (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
以上实施例的各技术特征可以进行任意的组合,为使描述简洁,未对上述实施例中的各个技术特征所有可能的组合都进行描述,然而,只要这些技术特征的组合不存在矛盾,都应当认为是本说明书记载的范围。The technical features of the above embodiments can be combined arbitrarily. In order to make the description concise, all possible combinations of the technical features in the above embodiments are not described. However, as long as there is no contradiction in the combination of these technical features, they should be It is considered as the range described in this specification.
以上实施例仅表达了本申请的几种实施方式,其描述较为具体和详细,但并不能因此而理解为对发明专利范围的限制。应当指出的是,对于本领域的普通技术人员来说,在不脱离本申请构思的前提下,还可以做出若干变形和改进,这些都属于本申请的保护范围。因此,本申请专利的保护范围应以所附权利要求为准。The above examples only express a few implementation modes of the present application, and the description is relatively specific and detailed, but it should not be understood as a limitation on the scope of the invention patent. It should be noted that for those of ordinary skill in the art, without departing from the concept of this application, several modifications and improvements can be made, and these all fall within the protection scope of this application. Therefore, the scope of protection of the patent of this application shall be subject to the appended claims.

Claims (20)

  1. 一种动画播放方法,包括:An animation playback method, including:
    将动态图像文件分解为序列帧图像,并获取每一帧对应的帧图像数据;Decompose the dynamic image file into a sequence of frame images, and obtain the frame image data corresponding to each frame;
    对各所述帧图像数据进行压缩,并将压缩后的帧图像数据转换为base64格式的图像数据;Compressing each of the frame image data, and converting the compressed frame image data into base64 format image data;
    将各所述base64格式的图像数据转换为Blob格式的图片文件对象;Converting each of the image data in the base64 format into a picture file object in the Blob format;
    将各所述Blob格式的图片文件对象一一生成基于层叠样式表的关键帧,得到关键帧动画;及Generate key frames based on the cascading style sheet one by one of the picture file objects in the Blob format to obtain the key frame animation; and
    在接收到基于网页页面发出的动图加载请求时,将所述关键帧动画加载至对应的网页页面中。When receiving the animation loading request based on the web page, the key frame animation is loaded into the corresponding web page.
  2. 根据权利要求1所述的方法,其特征在于,所述将各所述Blob格式的图片文件对象一一生成基于层叠样式表的关键帧,得到关键帧动画,包括:The method according to claim 1, wherein the generating key frames based on a cascading style sheet one by one of the picture file objects in the Blob format to obtain the key frame animation comprises:
    根据所述序列帧图像中各个帧图像数据的顺序,设置关键帧动画中各个关键帧的触发百分比值;及Set the trigger percentage value of each key frame in the key frame animation according to the sequence of each frame image data in the sequence of frame images; and
    将与各所述帧图像数据对应的Blob格式的图片文件对象分别设置为各关键帧的图像样式,得到关键帧动画。The picture file objects in the Blob format corresponding to each of the frame image data are respectively set as the image styles of each key frame to obtain the key frame animation.
  3. 根据权利要求2所述的方法,其特征在于,所述根据所述序列帧图像中各个帧图像数据的顺序,设置关键帧动画中各个关键帧的触发百分比值,包括:The method according to claim 2, wherein the setting the trigger percentage value of each key frame in the key frame animation according to the sequence of each frame image data in the sequence of frame images comprises:
    获取所述关键帧动画的显示时长;Acquiring the display duration of the key frame animation;
    根据所述序列帧图像中各个帧图像数据的顺序以及所述显示时长,确定所述每一帧对应的帧图像数据的显示时刻;及Determining the display time of the frame image data corresponding to each frame according to the sequence of each frame image data in the sequence of frame images and the display duration; and
    根据所述显示时刻设置所述关键帧动画中各个关键帧的触发百分比值。The trigger percentage value of each key frame in the key frame animation is set according to the display moment.
  4. 根据权利要求2所述的方法,其特征在于,所述将与各所述帧图像数据对应的Blob格式的图片文件对象分别设置为各关键帧的图像样式,得到关键帧动画,包括:The method according to claim 2, wherein the setting the picture file object in the Blob format corresponding to each of the frame image data to the image style of each key frame respectively to obtain the key frame animation comprises:
    创建各所述Blob格式的图片文件对象的请求链接;及Creating a request link for each of the image file objects in the Blob format; and
    将各所述帧图像数据对应的请求链接分别设置为各关键帧的图片样式,得到关键帧动画。The request link corresponding to each frame image data is respectively set as the picture style of each key frame to obtain the key frame animation.
  5. 根据权利要求1至4任意一项所述的方法,其特征在于,所述将动态图像文件分解为序列帧图像,包括:The method according to any one of claims 1 to 4, wherein the decomposing a dynamic image file into a sequence of frame images comprises:
    根据所述动态图像文件的文件类型确定与所述动态图像文件的解码算法;Determining a decoding algorithm for the dynamic image file according to the file type of the dynamic image file;
    解析所述动态图像文件,获得所述动态图像文件中的图像数据块;及Parse the dynamic image file to obtain image data blocks in the dynamic image file; and
    利用所述解码算法对所述图像数据块进行解码,得到解码后的序列帧图像。Use the decoding algorithm to decode the image data block to obtain a decoded sequence of frame images.
  6. 一种动画播放装置,包括:An animation playback device, including:
    图像数据获取模块,用于将动态图像文件分解为序列帧图像,并获取每一帧对应的帧图像数据;The image data acquisition module is used to decompose the dynamic image file into a sequence of frame images and acquire the frame image data corresponding to each frame;
    图像编码获取模块,用于对各所述帧图像数据进行压缩,并将压缩后的帧图像数据转换为base64格式的图像数据;An image encoding acquisition module, used to compress each of the frame image data, and convert the compressed frame image data into base64 format image data;
    关键帧动画生成模块,用于将各所述base64格式的图像数据转换为Blob格式的图片文件对象;将各所述Blob格式的图片文件对象一一生成基于层叠样式表的关键帧,得到关键帧动画;及A key frame animation generating module, used to convert each of the image data in the base64 format into a picture file object in the Blob format; generate the key frames based on the cascading style sheet one by one from the picture file objects in the Blob format to obtain the key frames Animation; and
    动画播放模块,用于在接收到基于网页页面发出的动图加载请求时,将所述关键帧动画加载至对应的网页页面中。The animation playing module is used to load the key frame animation to the corresponding web page when receiving a moving image loading request based on the web page.
  7. 根据权利要求6所述的装置,其特征在于,所述关键帧动画生成模块,用于:The device according to claim 6, wherein the key frame animation generating module is configured to:
    根据所述序列帧图像中各个帧图像数据的顺序,设置关键帧动画中各个关键帧的触发百分比值;及Set the trigger percentage value of each key frame in the key frame animation according to the sequence of each frame image data in the sequence of frame images; and
    将与各所述帧图像数据对应的Blob格式的图片文件对象分别设置为各关键帧的图像样式,得到关键帧动画。The picture file objects in the Blob format corresponding to each of the frame image data are respectively set as the image styles of each key frame to obtain the key frame animation.
  8. 根据权利要求7所述的装置,其特征在于,所述关键帧动画生成模块,具体用于:The device according to claim 7, wherein the key frame animation generating module is specifically configured to:
    获取所述关键帧动画的显示时长;Acquiring the display duration of the key frame animation;
    根据所述序列帧图像中各个帧图像数据的顺序以及所述显示时长,确定所述每一帧对应的帧图像数据的显示时刻;及Determining the display time of the frame image data corresponding to each frame according to the sequence of each frame image data in the sequence of frame images and the display duration; and
    根据所述显示时刻设置所述关键帧动画中各个关键帧的触发百分比值。The trigger percentage value of each key frame in the key frame animation is set according to the display moment.
  9. 根据权利要求7所述的装置,其特征在于,所述关键帧动画生成模块,用于:The device according to claim 7, wherein the key frame animation generating module is configured to:
    创建各所述Blob格式的图片文件对象的请求链接;及Creating a request link for each of the image file objects in the Blob format; and
    将各所述帧图像数据对应的请求链接分别设置为各关键帧的图片样式,得到关键帧动画。The request link corresponding to each frame image data is respectively set as the picture style of each key frame to obtain the key frame animation.
  10. 根据权利要求6所述的装置,其特征在于,所述图像数据获取模块,具体用于:The device according to claim 6, wherein the image data acquisition module is specifically configured to:
    根据所述动态图像文件的文件类型确定与所述动态图像文件的解码算法;Determining a decoding algorithm for the dynamic image file according to the file type of the dynamic image file;
    解析所述动态图像文件,获得所述动态图像文件中的图像数据块;及Parse the dynamic image file to obtain image data blocks in the dynamic image file; and
    利用所述解码算法对所述图像数据块进行解码,得到解码后的序列帧图像。Use the decoding algorithm to decode the image data block to obtain a decoded sequence of frame images.
  11. 一种计算机设备,包括存储器及一个或多个处理器,所述存储器中储存有计算机可读指令,所述计算机可读指令被所述一个或多个处理器执行时,使得所述一个或多个处理器执行以下步骤:A computer device includes a memory and one or more processors. The memory stores computer-readable instructions. When the computer-readable instructions are executed by the one or more processors, the one or more Each processor performs the following steps:
    将动态图像文件分解为序列帧图像,并获取每一帧对应的帧图像数据;Decompose the dynamic image file into a sequence of frame images, and obtain the frame image data corresponding to each frame;
    对各所述帧图像数据进行压缩,并将压缩后的帧图像数据转换为base64格式的图像数据;Compressing each of the frame image data, and converting the compressed frame image data into base64 format image data;
    将各所述base64格式的图像数据转换为Blob格式的图片文件对象;Converting each of the image data in the base64 format into a picture file object in the Blob format;
    将各所述Blob格式的图片文件对象一一生成基于层叠样式表的关键帧,得到关键帧动画;及Generate key frames based on the cascading style sheet one by one of the picture file objects in the Blob format to obtain the key frame animation; and
    在接收到基于网页页面发出的动图加载请求时,将所述关键帧动画加载至对应的网页页面中。When receiving the animation loading request based on the web page, the key frame animation is loaded into the corresponding web page.
  12. 根据权利要求11所述的计算机设备,其特征在于,所述处理器执行所述计算机可读指令时还执行以下步骤:The computer device according to claim 11, wherein the processor further executes the following steps when executing the computer-readable instruction:
    根据所述序列帧图像中各个帧图像数据的顺序,设置关键帧动画中各个关键帧的触发百分比值;及Set the trigger percentage value of each key frame in the key frame animation according to the sequence of each frame image data in the sequence of frame images; and
    将与各所述帧图像数据对应的Blob格式的图片文件对象分别设置为各关键帧的图像样式,得到关键帧动画。The picture file objects in the Blob format corresponding to each of the frame image data are respectively set as the image styles of each key frame to obtain the key frame animation.
  13. 根据权利要求12所述的计算机设备,其特征在于,所述处理器执行所述计算机可读指令时还执行以下步骤:The computer device according to claim 12, wherein the processor further executes the following steps when executing the computer-readable instruction:
    获取所述关键帧动画的显示时长;Acquiring the display duration of the key frame animation;
    根据所述序列帧图像中各个帧图像数据的顺序以及所述显示时长,确定所述每一帧对应的帧图像数据的显示时刻;及Determining the display time of the frame image data corresponding to each frame according to the sequence of each frame image data in the sequence of frame images and the display duration; and
    根据所述显示时刻设置所述关键帧动画中各个关键帧的触发百分比值。The trigger percentage value of each key frame in the key frame animation is set according to the display moment.
  14. 根据权利要求10所述的计算机设备,其特征在于,所述处理器执行所述计算机可读指令时还执行以下步骤:The computer device according to claim 10, wherein the processor further executes the following steps when executing the computer-readable instruction:
    创建各所述Blob格式的图片文件对象的请求链接;Creating a request link for each of the image file objects in the Blob format;
    将各所述帧图像数据对应的请求链接分别设置为各关键帧的图片样式,得到关键帧动画。The request link corresponding to each frame image data is respectively set as the picture style of each key frame to obtain the key frame animation.
  15. 根据权利要求10所述的计算机设备,其特征在于,所述处理器执行所述计算机可读指令时还执行以下步骤:The computer device according to claim 10, wherein the processor further executes the following steps when executing the computer-readable instruction:
    根据所述动态图像文件的文件类型确定与所述动态图像文件的解码算法;Determining a decoding algorithm for the dynamic image file according to the file type of the dynamic image file;
    解析所述动态图像文件,获得所述动态图像文件中的图像数据块;及Parse the dynamic image file to obtain image data blocks in the dynamic image file; and
    利用所述解码算法对所述图像数据块进行解码,得到解码后的序列帧图像。Use the decoding algorithm to decode the image data block to obtain a decoded sequence of frame images.
  16. 一个或多个存储有计算机可读指令的非易失性计算机可读存储介质,所述计算机可读指令被一个或多个处理器执行时,使得所述一个或多个处理器执行以下步骤:One or more non-volatile computer-readable storage media storing computer-readable instructions. When the computer-readable instructions are executed by one or more processors, the one or more processors perform the following steps:
    将动态图像文件分解为序列帧图像,并获取每一帧对应的帧图像数据;Decompose the dynamic image file into a sequence of frame images, and obtain the frame image data corresponding to each frame;
    对各所述帧图像数据进行压缩,并将压缩后的帧图像数据转换为base64格式的图像数据;Compressing each of the frame image data, and converting the compressed frame image data into base64 format image data;
    将各所述base64格式的图像数据转换为Blob格式的图片文件对象;Converting each of the image data in the base64 format into a picture file object in the Blob format;
    将各所述Blob格式的图片文件对象一一生成基于层叠样式表的关键帧,得到关键帧动画;及Generate key frames based on the cascading style sheet one by one of the picture file objects in the Blob format to obtain the key frame animation; and
    在接收到基于网页页面发出的动图加载请求时,将所述关键帧动画加载至对应的网页页面中。When receiving the animation loading request based on the web page, the key frame animation is loaded into the corresponding web page.
  17. 根据权利要求16所述的存储介质,其特征在于,所述计算机可读指令被所述处理器执行时还执行以下步骤:The storage medium according to claim 16, wherein the following steps are further executed when the computer-readable instructions are executed by the processor:
    根据所述序列帧图像中各个帧图像数据的顺序,设置关键帧动画中各个关键帧的触发百分比值;According to the sequence of each frame image data in the sequence of frame images, setting the trigger percentage value of each key frame in the key frame animation;
    将与各所述帧图像数据对应的Blob格式的图片文件对象分别设置为各关键帧的图像样式,得到关键帧动画。The picture file objects in the Blob format corresponding to each of the frame image data are respectively set as the image styles of each key frame to obtain the key frame animation.
  18. 根据权利要求17所述的存储介质,其特征在于,所述计算机可读指令被所述处理器执行时还执行以下步骤:18. The storage medium of claim 17, wherein the following steps are further performed when the computer-readable instructions are executed by the processor:
    获取所述关键帧动画的显示时长;Acquiring the display duration of the key frame animation;
    根据所述序列帧图像中各个帧图像数据的顺序以及所述显示时长,确定所述每一帧对应的帧图像数据的显示时刻;Determining the display time of the frame image data corresponding to each frame according to the sequence of each frame image data in the sequence of frame images and the display duration;
    根据所述显示时刻设置所述关键帧动画中各个关键帧的触发百分比值。The trigger percentage value of each key frame in the key frame animation is set according to the display moment.
  19. 根据权利要求16所述的存储介质,其特征在于,所述计算机可读指令被所述处理器执行时还执行以下步骤:创建各所述Blob格式的图片文件对象的请求链接;The storage medium according to claim 16, wherein when the computer-readable instructions are executed by the processor, the following steps are further executed: creating a request link for each of the Blob format picture file objects;
    将各所述帧图像数据对应的请求链接分别设置为各关键帧的图片样式,得到关键帧动画。The request link corresponding to each frame image data is respectively set as the picture style of each key frame to obtain the key frame animation.
  20. 根据权利要求16所述的存储介质,其特征在于,所述计算机可读指令被所述处理器执行时还执行以下步骤:The storage medium according to claim 16, wherein the following steps are further executed when the computer-readable instructions are executed by the processor:
    根据所述动态图像文件的文件类型确定与所述动态图像文件的解码算法;Determining a decoding algorithm for the dynamic image file according to the file type of the dynamic image file;
    解析所述动态图像文件,获得所述动态图像文件中的图像数据块;及Parse the dynamic image file to obtain image data blocks in the dynamic image file; and
    利用所述解码算法对所述图像数据块进行解码,得到解码后的序列帧图像。Use the decoding algorithm to decode the image data block to obtain a decoded sequence of frame images.
PCT/CN2019/118265 2019-09-18 2019-11-14 Animation playing method and apparatus, and computer device and storage medium WO2021051597A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910881938.1A CN110647703A (en) 2019-09-18 2019-09-18 Animation playing method and device, computer equipment and storage medium
CN201910881938.1 2019-09-18

Publications (1)

Publication Number Publication Date
WO2021051597A1 true WO2021051597A1 (en) 2021-03-25

Family

ID=69010793

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/118265 WO2021051597A1 (en) 2019-09-18 2019-11-14 Animation playing method and apparatus, and computer device and storage medium

Country Status (2)

Country Link
CN (1) CN110647703A (en)
WO (1) WO2021051597A1 (en)

Families Citing this family (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111163358A (en) * 2020-01-07 2020-05-15 广州虎牙科技有限公司 GIF image generation method, device, server and storage medium
CN113496534B (en) * 2020-03-20 2024-04-19 阿里巴巴集团控股有限公司 Dynamic bitmap synthesis method, device, electronic equipment and computer storage medium
CN111447219B (en) * 2020-03-26 2023-02-03 深圳平安医疗健康科技服务有限公司 Image display method and device, storage medium and computer equipment
CN111954006A (en) * 2020-06-30 2020-11-17 深圳点猫科技有限公司 Cross-platform video playing implementation method and device for mobile terminal
CN112256990B (en) * 2020-09-01 2023-09-26 北京沃东天骏信息技术有限公司 Image processing method and device and computer readable storage medium
CN112435313A (en) * 2020-11-10 2021-03-02 北京百度网讯科技有限公司 Method and device for playing frame animation, electronic equipment and readable storage medium
CN112380379B (en) * 2020-11-18 2023-05-02 抖音视界有限公司 Lyric special effect display method and device, electronic equipment and computer readable medium
CN112802168A (en) * 2021-01-26 2021-05-14 广州欢网科技有限责任公司 Animation generation method and device and television terminal
CN113986438B (en) * 2021-10-30 2024-01-30 深圳市快易典教育科技有限公司 Animation loading method, system, device and computer readable storage medium
CN114143490A (en) * 2021-11-29 2022-03-04 云门(深圳)技术有限公司 Method for previewing SDI video signal in webpage
CN113989425B (en) * 2021-12-24 2022-04-26 北京搜狐新动力信息技术有限公司 Frame animation playing method and device, storage medium and electronic equipment
CN114880613B (en) * 2022-05-12 2024-03-22 苏州轻棹科技有限公司 Image playing processing method

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2007123470A2 (en) * 2006-04-26 2007-11-01 Momail Ab Method and apparatus for adapting electronic mail
CN101739442A (en) * 2008-11-21 2010-06-16 国际商业机器公司 System and method for displaying information
CN107122486A (en) * 2017-05-09 2017-09-01 中国科学院计算机网络信息中心 A kind of polynary big data fusion method and system for supporting BLOB
CN107247544A (en) * 2015-10-01 2017-10-13 Sap欧洲公司 Use interaction figure picture optimization software application user interface capabilities
CN108881997A (en) * 2018-07-24 2018-11-23 北京奇艺世纪科技有限公司 Animation file generates and playback method, device and system

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2010147454A1 (en) * 2009-06-16 2010-12-23 Emanual System Sdn Bhd System and method of binary data storage and management in database management systems
JP6735140B2 (en) * 2016-04-27 2020-08-05 株式会社エムティーアイ Video generation/transmission method, video generation/transmission system, and video playback program
CN109547533A (en) * 2018-10-26 2019-03-29 深圳点猫科技有限公司 A kind of mobile terminal the html5 picture upload preprocess method and electronic equipment of educational system

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2007123470A2 (en) * 2006-04-26 2007-11-01 Momail Ab Method and apparatus for adapting electronic mail
CN101739442A (en) * 2008-11-21 2010-06-16 国际商业机器公司 System and method for displaying information
CN107247544A (en) * 2015-10-01 2017-10-13 Sap欧洲公司 Use interaction figure picture optimization software application user interface capabilities
CN107122486A (en) * 2017-05-09 2017-09-01 中国科学院计算机网络信息中心 A kind of polynary big data fusion method and system for supporting BLOB
CN108881997A (en) * 2018-07-24 2018-11-23 北京奇艺世纪科技有限公司 Animation file generates and playback method, device and system

Also Published As

Publication number Publication date
CN110647703A (en) 2020-01-03

Similar Documents

Publication Publication Date Title
WO2021051597A1 (en) Animation playing method and apparatus, and computer device and storage medium
US7975215B2 (en) Sharing editable ink annotated images with annotation-unaware applications
JP2012529115A (en) Web page optimization
WO2020248948A1 (en) Animation file processing method and apparatus, computer readable storage medium, and computer device
JP2020518207A5 (en)
WO2021037041A1 (en) Data decoding method and apparatus, and data coding method and apparatus
US10108594B2 (en) Systems and methods for applying a residual error image
CN108495174B (en) Method and system for generating video file by H5 page effect
CN112689197B (en) File format conversion method and device and computer storage medium
CN111263164A (en) High frame frequency video parallel coding and recombination method
CN114222156A (en) Video editing method, video editing device, computer equipment and storage medium
US9208250B2 (en) System and method for dynamic modification of web page content to ensure consistent response time
US20240040147A1 (en) Data processing method and apparatus, computer device, and storage medium
CN112650957B (en) Image display method, apparatus, computer-readable storage medium, and computer device
US11889093B2 (en) Methods, apparatuses, computer programs and computer-readable media for scalable video coding and transmission
JP2017192080A (en) Image compression device, image decoding device, image compression method, and image compression program
CN109474826B (en) Picture compression method and device, electronic equipment and storage medium
JP6990179B2 (en) Methods and equipment for selecting processes to be applied to video data from a candidate process set driven by a common information dataset.
CN111324586B (en) Picture display method and device based on cache, electronic equipment and medium
CN114419203A (en) File processing method and device
CN115866248B (en) Video transcoding method, device, computer equipment and storage medium
JP7130050B2 (en) Secure and consistent video compression across devices
KR102377449B1 (en) Decoding method for 360 degree immersive video based on multi-codec and decoder
JP7247184B2 (en) Information processing device, information processing system, program and information processing method
CN115118385A (en) Decoding method and device

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19946232

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19946232

Country of ref document: EP

Kind code of ref document: A1