A method and apparatus for loading picture resources

By customizing attributes and fragment sets in the control, GIF image resources can be processed, solving the problem of relying on third-party SDKs in existing technologies. This enables custom looping and playback control, and can obtain frame fragments, avoiding image distortion and repeated downloads.

CN115203452BActive Publication Date: 2026-06-12SHANGHAI WANWUXINSHENG ENVIRONMENTAL PROTECTION TECH GRP CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
SHANGHAI WANWUXINSHENG ENVIRONMENTAL PROTECTION TECH GRP CO LTD
Filing Date
2022-05-30
Publication Date
2026-06-12

AI Technical Summary

Technical Problem

In existing technologies, loading GIF image resources requires a third-party SDK, resulting in large file size, complex integration, and the inability to customize the loop count and playback duration, as well as the inability to obtain image resource frame fragments.

Method used

Customize the attribute information and fragment set of image resources in the preset control, download and process the image resource file through the image control, determine whether it is in GIF format, cut and store fragments, arrange the collection in time sequence, and set playback parameters for processing.

🎯Benefits of technology

It enables GIF image loading without relying on third-party SDKs, allows for custom loop counts and playback duration, and can acquire image resource frame fragments, avoiding image distortion and repeated downloads.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115203452B_ABST
    Figure CN115203452B_ABST
Patent Text Reader

Abstract

The application aims to provide a method and device for loading picture resources. The application creates a picture control by customizing attribute information and a fragment set of a picture resource in a preset control for loading picture resources. The application downloads a picture resource file to be processed based on the picture control, processes the picture resource file to be processed according to attribute information of the picture resource in the picture control, and obtains a new picture resource file. The application judges whether the new picture resource file is a graphic interchange format file. If yes, the application stores fragments obtained after cutting in the fragment set, arranges all the fragment sets in time sequence to obtain a picture set arranged in time sequence, processes the picture set according to related playing parameters, obtains a target picture resource file, and plays the target picture resource file in a mobile terminal. Thus, the application does not depend on a third-party SDK, realizes custom playing parameters, and avoids picture deformation and repeated downloading.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computers, and more particularly to a method and apparatus for loading image resources. Background Technology

[0002] When loading network images or GIF image resources, a third-party SDK is generally used for faster loading. Commonly used third-party SDKs include SDWebImage and FLAnimatedImageView.

[0003] The disadvantages of the above two SDKs are as follows:

[0004] 1. The SDK is large in size, and only a small portion of its functions are used after integration with CocoaPods, and the integration process is quite complex.

[0005] 2. After obtaining GIF image resources, it is not possible to customize the loop count or playback duration, and it is not possible to obtain image resource frame fragments after playback is complete. Summary of the Invention

[0006] One objective of this application is to provide a method and device for loading image resources, which solves the problems in the prior art where loading GIFs relies on a third-party SDK and the loop count and playback duration cannot be customized, and image resource frame fragments cannot be obtained after playback.

[0007] According to one aspect of this application, a method for loading image resources is provided, the method comprising:

[0008] Customize the image resource's attribute information and fragment set in the preset control used to load image resources to create an image control;

[0009] Download the image resource file to be processed based on the image control, and process the image resource file to be processed according to the attribute information of the image resource in the image control to obtain a new image resource file;

[0010] Determine whether the new image resource file is a Graphics Interchange Format file. If so, store the fragments obtained after cutting in the fragment set, and arrange all the fragment sets in chronological order to obtain the image set arranged in chronological order.

[0011] The image set is processed by setting relevant playback parameters to obtain the target image resource file, which is then played on the mobile terminal.

[0012] Optionally, the attribute information of the image resource includes the address path and size of the image resource. The image resource file to be processed is downloaded based on the image control, and the image resource file to be processed is processed according to the attribute information of the image resource in the image control, including:

[0013] Based on the address path of the image resource, the relevant function is called to download the image resource file to be processed from the address where the image control is located;

[0014] The relevant function is used to scale the image resource file proportionally according to its size and the display ratio of the mobile terminal.

[0015] Optionally, the method further includes:

[0016] Determine whether the new image resource file is a Graphics Interchange Format (GUI) file. If not, call the system's SetImage function to display the new image resource file.

[0017] Optionally, the relevant functions include image processing functions and download functions. The step of calling the relevant functions based on the address path of the image resource to download the image resource file to be processed from the address where the image control is located includes:

[0018] Based on the resource file address of the image, the image processing function is called to create a temporary variable and remove the historical image fragments saved in the image control;

[0019] The download process is initiated using a download function based on the image resource file address. The download function is then used to assign values ​​to the temporary variables to obtain the image resource file to be processed.

[0020] Optionally, the relevant function is used to scale the image resource file proportionally according to its size and the display ratio of the mobile terminal, including:

[0021] Obtain the display ratio of the mobile terminal and the length and width of the image resource file to be processed;

[0022] The width and length of the image resource file to be processed are updated according to the display ratio to obtain a new image resource file that is scaled proportionally.

[0023] Optionally, storing the resulting fragments in the fragment set includes:

[0024] The image segmentation function is called to convert the resource link corresponding to the new image resource file into the corresponding image source, and the number of image sources is determined based on the image source;

[0025] Define an array for each fragment based on the total number of image sources.

[0026] The image source is traversed to cut the image into fragments, and the fragments are added to the corresponding number of arrays, wherein the fragments include the source image in the display format.

[0027] Optionally, after arranging all the fragment sets in chronological order to obtain a chronologically arranged image set, the method further includes:

[0028] Release new image resource files.

[0029] Optionally, the relevant playback parameters include playback parameters and preview styles, and the process of setting relevant playback parameters for the image set includes:

[0030] The image parameter initialization function is called to set the playback parameters and preview style of the image set, wherein the playback parameters include the number of playbacks and the single playback time.

[0031] Optionally, the preview style of the image set is set by calling the image parameter initialization function, including:

[0032] The display image is determined from the image fragments of the chronologically arranged image set, and the preview style of the image set is determined based on the display image, wherein the display image is used to display the image resource file after playback is completed.

[0033] Optionally, the target image resource file is played on the mobile terminal, including at least one of the following:

[0034] The image control is used in the mobile terminal to call the startup function to control the playback of the target image resource file;

[0035] The image control is used in the mobile terminal to call the stop function to control the stopping of the target image resource file;

[0036] The image control is used in the mobile terminal to call a time control function to determine the single playback duration of the target image resource file.

[0037] According to another aspect of this application, an apparatus for loading image resources is also provided, the apparatus comprising:

[0038] The control creation module is used to customize the attribute information and fragment set of the image resource in the image control used to load the image resource, so as to create the image control;

[0039] The data download module is used to download the image resource file to be processed based on the image control, and process the image resource file to be processed according to the attribute information of the image resource in the image control to obtain a new image resource file;

[0040] The data processing module is used to determine whether the new image resource file is a Graphics Exchange Format file. If so, the fragments obtained after cutting are stored in the fragment set, and all fragment sets are arranged in chronological order to obtain a chronologically arranged image set.

[0041] The image playback module is used to set relevant playback parameters for the image collection to obtain the target image resource file, and then play the target image resource file on the mobile terminal.

[0042] Optionally, the device includes:

[0043] The data processing module is also used to determine whether the new image resource file is a Graphics Interchange Format (GUI) file. If not, it calls the system's SetImage function to display the new image resource file.

[0044] According to another aspect of this application, a computer-readable medium is also provided, having stored thereon computer-readable instructions that can be executed by a processor to implement the method as described in any of the preceding claims.

[0045] According to another aspect of this application, an apparatus for loading image resources is also provided, the apparatus comprising:

[0046] One or more processors; and

[0047] A memory storing computer-readable instructions, which, when executed, cause the processor to perform operations as described in any of the preceding methods.

[0048] Compared with existing technologies, this application creates an image control by customizing the attribute information and fragment set of image resources in a preset control used for loading image resources; downloads the image resource file to be processed based on the image control; processes the image resource file to be processed according to the attribute information of the image resources in the image control to obtain a new image resource file; determines whether the new image resource file is a Graphics Interchange Format file; if so, stores the fragments obtained after cutting in the fragment set; arranges all fragment sets in chronological order to obtain a chronologically arranged image set; sets relevant playback parameters for the image set to obtain the target image resource file; and plays the target image resource file on the mobile terminal. This allows controls for displaying static PNG and GIF resources to be used without relying on third-party SDKs; it also allows for custom loop counts and playback duration of GIF images; and after playback, image resource frame fragments can be obtained, avoiding image distortion and repeated downloads. Attached Figure Description

[0049] Other features, objects, and advantages of this application will become more apparent from the following detailed description of non-limiting embodiments with reference to the accompanying drawings:

[0050] Figure 1 A schematic flowchart of a method for loading image resources according to one aspect of this application is shown.

[0051] Figure 2 The illustration shows a schematic diagram of program code for a method of loading image resources in a practical application environment according to an optional embodiment of this application;

[0052] Figure 3 The illustration shows a schematic diagram of program code for cutting and converting image resources in a practical application environment according to an optional embodiment of this application;

[0053] Figure 4 This illustration shows a schematic diagram of program code for setting playback parameters in a practical application environment according to an optional embodiment of this application;

[0054] Figure 5 This diagram illustrates a device frame structure for loading image resources according to another aspect of this application.

[0055] The same or similar reference numerals in the accompanying drawings represent the same or similar parts. Detailed Implementation

[0056] The present application will now be described in further detail with reference to the accompanying drawings.

[0057] In a typical configuration of this application, the terminal, the device of the service network, and the trusted party all include one or more processors (CPUs), input / output interfaces, network interfaces, and memory.

[0058] Memory may include non-persistent storage in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.

[0059] Computer-readable media include both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include non-transitory computer-readable media, such as modulated data signals and carrier waves.

[0060] Figure 1 This diagram illustrates a method for loading image resources according to one aspect of this application. The method includes steps S100-S400, where: in S100, image resource attribute information and fragment sets are customized in a preset control for loading image resources to create an image control; in S200, an image resource file to be processed is downloaded based on the image control, and the image resource file to be processed is processed according to the image resource attribute information in the image control to obtain a new image resource file; in S300, it is determined whether the new image resource file is a Graphics Interchange Format (GUID) file; if so, the fragments obtained after cutting are stored in the fragment set, and all fragment sets are arranged in chronological order to obtain a chronologically arranged image set; in S400, relevant playback parameter settings are applied to the image set to obtain a target image resource file, and the target image resource file is played on a mobile terminal. This allows controls for displaying static PNG and GIF resources to be used without relying on third-party SDKs; it enables customization of the loop count and playback duration of GIF images, and after playback, image resource frame fragments can be obtained, avoiding image distortion and repeated downloads.

[0061] Specifically, in S100, the image resource's attribute information and fragment set are customized in the preset control used to load the image resource to create the image control. Here, the image resource's attribute information is customized in the preset control used to load the image resource, such as adding attributes like resource address path, fragment set, loop playback count, single playback duration, actual width, and height; and a fragment set is defined in the control's properties, that is, the fragment set cache is placed in the preset control's properties and held by the created image control itself.

[0062] In step S200, the image resource file to be processed is downloaded based on the image control. The image resource file is then processed according to the attribute information of the image resources in the image control to obtain a new image resource file. Here, the image resource file to be processed, such as PNG, JPG, or GIF format images, is downloaded based on the image control. The attribute information of the image resources added during the creation of the image control is used to process the image resource file. For example, the added image resources include the resource address path, fragment set, loop playback count, single playback duration, width, and height. The width and height of the image resource file can be proportionally scaled based on the resource address path download method to obtain a new, processed image resource file.

[0063] In step S300, it is determined whether the new image resource file is a Graphics Interchange Format (GIF) file. If so, the resulting fragments are stored in the fragment set, and all fragment sets are arranged in chronological order to obtain a chronologically arranged image set. Specifically, it is determined whether the new image resource file is a GIF file. If so, the resulting fragments are obtained from the new image resource file; these fragments can be frame fragments obtained by cutting the image frame by frame. The resulting fragments are stored in the fragment set, and all fragment sets are arranged in chronological order to obtain multiple chronologically arranged image sets.

[0064] In step S400, relevant playback parameter settings are applied to the image set to obtain a target image resource file. This target image resource file is then played on the mobile terminal. Here, functions related to playback parameters can be called to set the playback parameters of the image set, such as controlling playback and stop, controlling the number of playback loops, to obtain the processed target image resource file. The processed target resource file is then played on the mobile terminal, thus completing custom playback loop control and custom playback control for GIF format files.

[0065] In an optional embodiment of this application, in S200, the attribute information of the image resource includes the address path and size of the image resource. Based on the address path of the image resource, a relevant function is called to download the image resource file to be processed from the address where the image control is located. The relevant function is then used to scale the image resource file proportionally according to its size and the display ratio of the mobile terminal. Here, the attribute information of the image resource includes its address path and size. The address path can be a network path or a local path, and the size is the actual size data of the image resource. The relevant functions are multiple functions used to process the image resource. For example, based on the address path of the image resource, a download function can be called to download the image resource file to be processed from the address where the image control is located. In the download function, the image resource file can be scaled proportionally according to the size and the display ratio of the mobile terminal, based on the length and width of the mobile terminal screen, to ensure that the image is not distorted.

[0066] In an optional embodiment of this application, it is determined whether the new image resource file is a Graphics Interchange Format (GIF) file. If not, the system's SetImage function is called to display the new image resource file. Here, when the format of the new image resource file is not GIF, the system's SetImage function is called to directly display the new image resource file on the mobile terminal. In this case, the image control can display image resources in multiple formats, improving compatibility.

[0067] In an optional embodiment of this application, in S200, the relevant functions include an image processing function and a download function. The image processing function is called based on the resource file address of the image to create a temporary variable and remove historical image fragments saved in the image control. The download function is then used to start the download process based on the image resource file address, and the temporary variable is assigned a value using the download function to obtain the image resource file to be processed. Here, the image processing function can be the `setImgUrl` function, used for data processing of the image. When the `setImgUrl` function is called, a temporary variable operable within the block is created, and previously saved fragments are removed.

[0068] In an optional embodiment of this application, in step S200, the display ratio of the mobile terminal and the length and width of the image resource file to be processed are obtained; the width and length of the image resource file to be processed are updated according to the display ratio to obtain a new image resource file scaled proportionally. Here, the length and width of the mobile terminal display screen are obtained to determine the display ratio, the length and width of the image resource file to be processed are obtained, and the length and width of the image resource file to be processed are updated according to the display ratio determined by the length and width of the mobile terminal display screen to obtain a new image resource file scaled proportionally to ensure that the image is not distorted.

[0069] Figure 2 The illustration shows a program code diagram of a method for loading image resources in a practical application environment according to an optional embodiment of this application. It inherits from the iOS system base library UIKit. The `imgUrl` property is the link address of the image, which can be either a network address or a local physical address; the `imagesArr` property stores the collection of fragments after cutting when the image is a GIF; the `frequencyCount` property is the number of times the image is played once when it is in GIF format, and the default is infinite loop when not assigned a value; the `timeCount` property is the playback duration of a single GIF image; the `width` property is the width of the resource file obtained through calculation, and the `height` property is the height of the resource file. Using the width and height can greatly ensure that the resource file is displayed without distortion.

[0070] In an optional embodiment of this application, in step S300, an image cutting function is called to convert the resource link corresponding to the new image resource file into a corresponding image source, and the number of image sources is determined based on the image sources. An array corresponding to the number of all image sources is defined in the fragment set. The image sources are traversed to cut the image into fragments, and the resulting fragments are added to the array corresponding to the number of fragments. The fragments include source images in a display format. Here, the image cutting function can be the `imagesArr` function. Then, the system function `CGImageSourceCreateWithUrl` is used to convert the resource link corresponding to the passed image resource file into a corresponding image source `CGimageSourceRef`. The function `CGimageSourceGetCount` is called to obtain the number of image sources. The cut frame fragments are obtained from the image sources `CGimageSourceRef` through traversal, the frame fragments are converted into a displayable format, and added to the array. Using the above method, after changing the interface data and reassigning the address path, the image control can be used to process new image resource data.

[0071] In an optional embodiment of this application, after arranging all fragment sets in chronological order to obtain a chronologically arranged image set, a new image resource file is released. Here, the data processing module 300 can be used to arrange all fragment sets in chronological order to obtain a chronologically arranged image set, and then release the new image resource file, that is, release the source image, reducing the system memory usage.

[0072] In an optional embodiment of this application, in step S400, the relevant playback parameters include playback parameters and preview styles. An image parameter initialization function is called to set the playback parameters and preview styles of the image set. The playback parameters include the number of playbacks and the duration of each playback. Here, the image parameter initialization function can be the system function `dataWithContentsOFURL`. The image set is assigned values ​​using this function to complete the setting of the playback parameters and preview styles.

[0073] In an optional embodiment of this application, in step S400, a display image is determined from the image fragments of the sequentially arranged image set. A preview style for the image set is then determined based on the display image. The display image is used to display the image resource file after playback is complete. Here, the first frame fragment of the sequentially arranged image set can be used as the display image by default, and the method for determining the display image can be freely set. The display image is then used as the preview style for the image set, for example, as a thumbnail or cover image of the image set, and is used to display the image resource file after playback is complete.

[0074] Figure 3This diagram illustrates program code for cutting and converting image resources in a practical application environment according to an optional embodiment of this application. The `setImgUrl` function is a custom function used for image data processing. When this function is called, a temporary variable operable within the block is created, and previously saved fragments are removed. The image address path passed during the download call is used, and the previously created temporary variable is assigned a value within the `download` function. The physical height is dynamically calculated proportionally based on the passed image width, ensuring the image is displayed without distortion. Next, the system function `componentsSeparatedByString` determines whether the image resource file is a GIF resource file. If it is a GIF resource file, the system function `dataWithContentsOFURL` is called for initial assignment, and the set of fragments for the display view is set, such as setting the number of playbacks and setting the first fragment resource as the default display style after playback. If it is a non-GIF resource (e.g., PNG, JPG, or SVG format), the system function `setImage` is called to display the resource file. Here, the image resource segmentation and frame fragment caching are placed in the control properties and held by the control itself. The memory is released synchronously when the control is released.

[0075] Figure 4This diagram illustrates program code for setting playback parameters in a practical application environment according to an optional embodiment of this application. In step S400, at least one of the following is included: using the image control to call a start function in the mobile terminal to control the playback of the target image resource file; using the image control to call a stop function in the mobile terminal to control the stopping of the target image resource file; and using the image control to call a time control function in the mobile terminal to determine the single playback duration of the target image resource file. Here, the image control is used to call different functions in the mobile terminal to control the playback, stopping, and single playback duration of the target image resource file. For example, calling the setTimeCount function can set the playback duration when the resource file is a GIF resource; calling the start function can set the playback duration when the resource file is a GIF resource; and calling the stop function can pause the playback when the resource file is a GIF resource. This control can also be used to display when the obtained local or network resource path is a regular image resource path. The default number of loop playbacks is the maximum value; not setting a single playback duration may cause the GIF to play too quickly. This application creates a subclass of the image display control in Objective-C, adding attributes such as resource address path, fragment collection, loop playback count, single playback duration, actual width, and height. It also adds play and stop methods when the address path is a GIF resource. After the control is created, it is assigned a local or network address. After the image is downloaded, the height is calculated proportionally based on the width to ensure that the image is not distorted. It checks whether the image is in GIF format, segments the image source into frame fragments, and adds the frame fragments to the collection to prevent duplicate downloads.

[0076] This application also provides a computer-readable medium storing computer-readable instructions that can be executed by a processor to implement the aforementioned method for loading image resources.

[0077] Corresponding to the methods described above, this application also provides a terminal, which includes components capable of performing the above-described... Figure 1 or Figure 2 or Figure 3 or Figure 4 The modules or units described in the various embodiments may be implemented in hardware, software, or a combination of both, and this application is not limited thereto. For example, in one embodiment of this application, a device for loading image resources is also provided, wherein the device includes:

[0078] One or more processors; and

[0079] A memory storing computer-readable instructions, which, when executed, cause the processor to perform the operations of the aforementioned method for loading image resources.

[0080] For example, computer-readable instructions, when executed, cause the one or more processors to:

[0081] In a preset control used for loading image resources, the attribute information and fragment set of the image resources are customized to create an image control; the image resource file to be processed is downloaded based on the image control, and the image resource file to be processed is processed according to the attribute information of the image resources in the image control to obtain a new image resource file; it is determined whether the new image resource file is a Graphics Interchange Format file. If so, the fragments obtained after cutting are stored in the fragment set, and all fragment sets are arranged in chronological order to obtain a chronologically arranged image set; relevant playback parameter settings are applied to the image set to obtain the target image resource file, and the target image resource file is played on the mobile terminal.

[0082] Figure 5 This diagram illustrates a device framework structure for loading image resources according to another aspect of this application. The device includes: a control creation module 100, used to customize the attribute information and fragment set of the image resources in an image control for loading image resources to create the image control; a data download module 200, used to download the image resource file to be processed based on the image control, and process the image resource file to be processed according to the attribute information of the image resources in the image control to obtain a new image resource file; a data processing module 300, used to determine whether the new image resource file is a Graphics Interchange Format (GUID) file, and if so, to store the fragments obtained after cutting in the fragment set, and to arrange all the fragment sets in chronological order to obtain a chronologically arranged image set; and an image playback module 400, used to perform relevant playback parameter setting processing on the image set to obtain a target image resource file, and to play the target image resource file on a mobile terminal. This allows controls displaying static PNG and GIF resources to be used without relying on third-party SDKs; it enables customization of the loop count and playback duration of GIF images; and after playback, image resource frame fragments can be obtained, avoiding image distortion and repeated downloads.

[0083] It should be noted that the content executed by the control creation module 100, data download module 200, data processing module 300 and image playback module 400 is the same as or correspondingly the same as the content in the above steps S100, S200, S300 and S400, respectively. For the sake of brevity, it will not be described again here.

[0084] In an optional embodiment of this application, the data processing module 300 is further configured to determine whether the new image resource file is a Graphics Interchange Format (GIF) file. If not, the system's SetImage function is called to display the new image resource file. Here, when the format of the new image resource file is not GIF, the data processing module 300 can also call the system's SetImage function to directly display the new image resource file on the mobile terminal. In this case, the image control can display image resources in multiple formats, improving compatibility.

[0085] Obviously, those skilled in the art can make various modifications and variations to this application without departing from the spirit and scope of this application. Therefore, if such modifications and variations fall within the scope of the claims of this application and their equivalents, this application also intends to include such modifications and variations.

[0086] It should be noted that this application can be implemented in software and / or a combination of software and hardware, for example, using an application-specific integrated circuit (ASIC), a general-purpose computer, or any other similar hardware device. In one embodiment, the software program of this application can be executed by a processor to implement the steps or functions described above. Similarly, the software program of this application (including related data structures) can be stored in a computer-readable recording medium, such as RAM memory, magnetic or optical drives, floppy disks, and similar devices. Furthermore, some steps or functions of this application can be implemented in hardware, for example, as circuitry that cooperates with a processor to perform the various steps or functions.

[0087] Furthermore, a portion of this application can be applied as a computer program product, such as computer program instructions, which, when executed by a computer, can invoke or provide the methods and / or technical solutions according to this application through the operation of the computer. The program instructions invoking the methods of this application may be stored in a fixed or removable recording medium, and / or transmitted via data streams in broadcast or other signal carrying media, and / or stored in the working memory of a computer device operating according to the program instructions.

[0088] It will be apparent to those skilled in the art that this application is not limited to the details of the exemplary embodiments described above, and that it can be implemented in other specific forms without departing from the spirit or essential characteristics of this application. Therefore, the embodiments should be considered exemplary and non-limiting in all respects, and the scope of this application is defined by the appended claims rather than the foregoing description. Thus, all variations falling within the meaning and scope of equivalents of the claims are intended to be embraced within this application. No reference numerals in the claims should be construed as limiting the scope of the claims. Furthermore, it is clear that the word "comprising" does not exclude other elements or steps, and the singular does not exclude the plural. Terms such as "first," "second," etc., are used to denote names and do not indicate any particular order.

Claims

1. A method of loading picture resources, wherein, The method includes: Customize the image resource's attribute information and fragment set in the preset control used to load image resources to create an image control; Download the image resource file to be processed based on the image control, and process the image resource file to be processed according to the attribute information of the image resource in the image control to obtain a new image resource file; Determine whether the new image resource file is a Graphics Interchange Format file. If so, store the fragments obtained after cutting in the fragment set, and arrange all the fragment sets in chronological order to obtain the image set arranged in chronological order. The image set is processed by setting relevant playback parameters to obtain the target image resource file, and the target image resource file is played on the mobile terminal. The method further includes: Determine whether the new image resource file is a Graphics Interchange Format (GUI) file. If not, call the system's SetImage function to display the new image resource file.

2. The method according to claim 1, wherein, The attribute information of the image resource includes the address path and size of the image resource. The image resource file to be processed is downloaded based on the image control, and the image resource file to be processed is processed according to the attribute information of the image resource in the image control, including: Based on the address path of the image resource, the relevant function is called to download the image resource file to be processed from the address where the image control is located; The relevant function is used to scale the image resource file proportionally according to its size and the display ratio of the mobile terminal.

3. The method according to claim 2, wherein, The relevant functions include image processing functions and download functions. The step of calling the relevant functions based on the address path of the image resource to download the image resource file to be processed from the address where the image control is located includes: Based on the resource file address of the image, the image processing function is called to create a temporary variable and remove the historical image fragments saved in the image control; The download process is initiated using a download function based on the image resource file address. The download function is then used to assign values ​​to the temporary variables to obtain the image resource file to be processed.

4. The method according to claim 2, wherein, The relevant function is used to scale the image resource file proportionally according to its size and the display ratio of the mobile terminal, including: Obtain the display ratio of the mobile terminal and the length and width of the image resource file to be processed; The width and length of the image resource file to be processed are updated according to the display ratio to obtain a new image resource file that is scaled proportionally.

5. The method according to claim 1, wherein, The fragments obtained after cutting are stored in the fragment set, including: The image segmentation function is called to convert the resource link corresponding to the new image resource file into the corresponding image source, and the number of image sources is determined based on the image source; Define an array for each fragment based on the total number of image sources. The image source is traversed to cut the image into fragments, and the fragments are added to the corresponding number of arrays, wherein the fragments include the source image in the display format.

6. The method according to claim 1, wherein, After arranging all the fragment sets in chronological order to obtain a chronologically arranged image set, the process also includes: Release new image resource files.

7. The method according to claim 1, wherein, The relevant playback parameters include playback parameters and preview styles. The process of setting relevant playback parameters for the image set includes: The image parameter initialization function is called to set the playback parameters and preview style of the image set, wherein the playback parameters include the number of playbacks and the single playback time.

8. The method according to claim 7, wherein, Calling the image parameter initialization function sets the preview style of the image collection, including: The display image is determined from the image fragments of the chronologically arranged image set, and the preview style of the image set is determined based on the display image, wherein the display image is used to display the image resource file after playback is completed.

9. The method according to claim 1, wherein, Playing a target image resource file on a mobile terminal includes at least one of the following: The image control is used in the mobile terminal to call the startup function to control the playback of the target image resource file; The image control is used in the mobile terminal to call the stop function to control the stopping of the target image resource file; The image control is used in the mobile terminal to call a time control function to determine the single playback duration of the target image resource file.

10. A device for loading image resources, wherein, The device includes: The control creation module is used to customize the attribute information and fragment set of the image resource in the image control used to load the image resource, so as to create the image control; The data download module is used to download the image resource file to be processed based on the image control, and process the image resource file to be processed according to the attribute information of the image resource in the image control to obtain a new image resource file; The data processing module is used to determine whether the new image resource file is a Graphics Exchange Format file. If so, the fragments obtained after cutting are stored in the fragment set, and all fragment sets are arranged in chronological order to obtain a chronologically arranged image set. The image playback module is used to set relevant playback parameters for the image collection to obtain the target image resource file, and then play the target image resource file on the mobile terminal. The device includes: The data processing module is also used to determine whether the new image resource file is a Graphics Interchange Format (GUI) file. If not, it calls the system's SetImage function to display the new image resource file.

11. A computer-readable medium having stored thereon computer-readable instructions that can be executed by a processor to implement the method as described in any one of claims 1 to 9.

12. A device for loading image resources, wherein, The device includes: One or more processors; and A memory storing computer-readable instructions, which, when executed, cause the processor to perform the operations of the method as described in any one of claims 1 to 9.