An intelligent image processing method and device, computer equipment and storage medium

By processing the boundaries and attributes of the Canvas object, image data conforming to the AI ​​service format is generated, and the AI ​​service is asynchronously called for processing. This solves the integration problem between AI functions and the Canvas editor, achieving seamless image processing and visual consistency, and improving operational efficiency and automation.

CN121095394BActive Publication Date: 2026-06-19深圳市维卓数字营销有限公司

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
深圳市维卓数字营销有限公司
Filing Date
2025-11-07
Publication Date
2026-06-19

AI Technical Summary

Technical Problem

The existing AI functionality is not well integrated with the Canvas editor, resulting in low operational efficiency and the inability to maintain the position, scaling, rotation, and other transformation attributes of image objects, thus disrupting the continuity and accuracy of editing.

Method used

By performing boundary calculations, dynamic margin calculations, and attribute cloning on the Canvas object, image data conforming to the input format of the AI ​​service is generated, and the AI ​​service is asynchronously called for processing. The resulting image and the Canvas object have their attributes replaced, while maintaining the position, scaling, rotation attributes, and canvas hierarchy.

Benefits of technology

It achieves deep integration of AI functions with the Canvas editor, eliminating the need for users to operate across different tools, maintaining visual consistency in design drafts, improving operational smoothness and automation, and supporting multi-task parallel processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121095394B_ABST
    Figure CN121095394B_ABST
Patent Text Reader

Abstract

This invention discloses an intelligent image processing method, apparatus, computer device, and storage medium. The method includes: detecting and processing a user selection area in a Canvas editor to obtain the currently selected Canvas object; performing boundary calculation, dynamic margin calculation, and attribute cloning on the Canvas object to obtain image data that meets the input format requirements of an AI service; registering the image data for an AI task and asynchronously calling an AI service for image processing to obtain the processed result image; inputting the result image into the Canvas editor and performing attribute replacement processing with the selected Canvas object, while maintaining the position, scaling, rotation attributes, and canvas hierarchy of the selected Canvas object; and updating the Canvas display in the Canvas editor. This invention achieves deep integration of AI functionality with the Canvas editor, allowing users to complete intelligent image processing without manual cross-tool operations.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image processing technology, and in particular to an intelligent image processing method, apparatus, computer device, and storage medium. Background Technology

[0002] With the rapid development of artificial intelligence technology, deep learning-based image processing tools (such as AI background removal, image enhancement, and text-to-image editing) have been widely used in the field of image editing. However, existing AI functions and Canvas image editors are usually independent of each other, requiring users to manually switch between multiple tools to export, process, and re-import images. This fragmented workflow not only leads to low operational efficiency, but more importantly, when re-importing AI-processed images into the Canvas editor, the original image objects' position, scaling, rotation, and other transformation attributes cannot be preserved, disrupting the continuity and accuracy of the editing process.

[0003] To address these issues, existing technologies offer several integration solutions, such as calling cloud AI services via simple APIs or deploying AI models locally as plugins. However, none of these solutions achieve deep integration between AI functionality and the Canvas editor. They lack the ability to accurately perceive and maintain the state of Canvas objects, cannot maintain the hierarchical relationships and transformed attributes of objects before and after AI processing, and also struggle to support efficient batch processing and real-time state synchronization. Summary of the Invention

[0004] The purpose of this invention is to provide an intelligent image processing method, apparatus, computer device, and storage medium, aiming to solve the problem of achieving deep integration of AI functions with a Canvas editor, so that the AI ​​processing results can be seamlessly applied to the Canvas canvas.

[0005] In a first aspect, embodiments of the present invention provide an intelligent image processing method, comprising:

[0006] The user selection area in the Canvas editor is detected and processed to obtain the currently selected Canvas object;

[0007] The Canvas object is subjected to boundary calculation, dynamic margin calculation and attribute cloning to obtain image data that meets the input format requirements of AI services;

[0008] The image data is registered for AI tasks, and the AI ​​service is asynchronously invoked to perform image processing to obtain the AI-processed result image;

[0009] The resulting image is input into the Canvas editor and its attributes are replaced with those of the selected corresponding Canvas object, while maintaining the position, scaling, rotation attributes, and canvas hierarchy of the selected corresponding Canvas object.

[0010] Update the Canvas display in the Canvas editor.

[0011] In a second aspect, embodiments of the present invention provide an intelligent image processing device, comprising:

[0012] The selection detection unit is used to detect and process the user's selection in the Canvas editor to obtain the currently selected Canvas object;

[0013] The object processing unit is used to perform boundary calculation, dynamic margin calculation and attribute cloning processing on the Canvas object to obtain image data that meets the input format requirements of AI services.

[0014] An image processing unit is used to register the image data for AI tasks and asynchronously call AI services to perform image processing to obtain the AI-processed result image.

[0015] The replacement unit is used to input the result image into the Canvas editor and perform attribute replacement processing with the selected corresponding Canvas object, while maintaining the position, scaling, rotation attributes and canvas hierarchy of the selected corresponding Canvas object.

[0016] The update unit is used to update the Canvas display in the Canvas editor.

[0017] Thirdly, embodiments of the present invention provide a computer device including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the intelligent image processing method described in the first aspect.

[0018] Fourthly, embodiments of the present invention provide a computer-readable storage medium storing a computer program that, when executed by a processor, causes the processor to perform the intelligent image processing method described in the first aspect.

[0019] The beneficial effects of this invention are as follows: it achieves deep integration of AI functions with the Canvas editor, enabling seamless application of AI processing results to the Canvas canvas, allowing users to complete intelligent image processing without manual cross-tool operations. Specifically, this invention maintains the original layout information of the selected Canvas object through an attribute preservation mechanism and the AI-processed image, ensuring visual consistency of the design draft. The asynchronous processing architecture effectively avoids interface lag, allowing users to continue other editing operations during the processing. The overall solution improves the automation and smoothness of image processing, making it suitable for design workflows that frequently use AI functions. Attached Figure Description

[0020] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the following description of the embodiments will be briefly introduced. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0021] Figure 1 This is a flowchart illustrating the intelligent image processing method provided in an embodiment of the present invention.

[0022] Figure 2 This is a schematic diagram of a sub-process of step S202 provided in an embodiment of the present invention;

[0023] Figure 3 This is a schematic diagram of a sub-process of step S203 provided in an embodiment of the present invention;

[0024] Figure 4 This is a schematic diagram of a sub-process of step S204 provided in an embodiment of the present invention;

[0025] Figure 5 A schematic block diagram of an intelligent image processing device provided in an embodiment of the present invention;

[0026] Figure 6 A schematic block diagram of a computer device provided for an embodiment of the present invention. Detailed Implementation

[0027] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0028] It should be understood that, when used in this specification and the appended claims, the terms "comprising" and "including" indicate the presence of the described features, integrals, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or collections thereof.

[0029] It should also be understood that the terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the invention. As used in this specification and the appended claims, the singular forms “a,” “an,” and “the” are intended to include the plural forms unless the context clearly indicates otherwise.

[0030] It should also be further understood that the term "and / or" as used in this specification and the appended claims refers to any combination of one or more of the associated listed items and all possible combinations, and includes such combinations.

[0031] Please see Figure 1 , Figure 1 This is a flowchart illustrating the intelligent image processing method provided in an embodiment of the present invention.

[0032] like Figure 1 As shown, the method includes steps S101-S105.

[0033] S101. Detect and process the user selection area in the Canvas editor to obtain the currently selected Canvas object;

[0034] Step S101 aims to capture the currently manipulated Canvas object (usually a graphics object) by listening to user interaction events of the Canvas editor, providing target input for subsequent processing.

[0035] S102. Perform boundary calculation, dynamic margin calculation and attribute cloning on the Canvas object to obtain image data that meets the input format requirements of AI services.

[0036] Step S102 aims to perform geometric analysis and data extraction on the selected Canvas object. Boundary calculation is used to determine the actual area occupied by the Canvas object in the canvas. Dynamic margin calculation adaptively expands the sampling area according to the image content to avoid edge clipping. Attribute cloning completely preserves the transformation state and style configuration of the Canvas object through object serialization technology.

[0037] S103. Register the image data for AI tasks and asynchronously call the AI ​​service to process the image, and obtain the processed image.

[0038] Step S103 aims to introduce a task registration mechanism to incorporate processing requests into unified management and to use an asynchronous communication mode to call backend AI services, thereby achieving non-blocking image processing.

[0039] S104. Input the resulting image into the Canvas editor and perform attribute replacement processing with the selected corresponding Canvas object, while maintaining the position, scaling, rotation attributes and canvas hierarchy of the selected corresponding Canvas object.

[0040] Step S104 aims to enable the AI ​​processing results to accurately match the spatial attributes of the original object through coordinate mapping and hierarchical index reconstruction.

[0041] S105. Update the Canvas display in the Canvas editor.

[0042] In this embodiment, based on the solutions in steps S101-S104, deep integration of AI functionality and the Canvas editor is achieved, allowing users to complete intelligent image processing without manual cross-tool operations. Specifically, this embodiment maintains the original layout information of the selected Canvas object through an attribute preservation mechanism and the AI-processed image, ensuring visual consistency of the design draft. The asynchronous processing architecture effectively avoids interface lag, allowing users to continue other editing operations during the processing. The overall solution improves the automation and smoothness of image processing, making it suitable for design workflows that frequently utilize AI functions.

[0043] In one embodiment, such as Figure 2 As shown, step S102 includes:

[0044] S201. Perform boundary calculation on the Canvas object to obtain its bounding box coordinates in the world coordinate system.

[0045] S202. Based on the bounding box coordinates and the size of the Canvas object, perform dynamic margin calculation to obtain the pixel margin value;

[0046] S203. Calculate and expand the original bounding box based on the bounding box coordinates and pixel margin values ​​to obtain the final image extraction region;

[0047] S204. Create a temporary Canvas that matches the size of the image extraction area;

[0048] S205. In the temporary Canvas, perform attribute cloning and drawing processing on the Canvas object to obtain an image copy containing the complete object content.

[0049] S206. Perform format conversion and encoding processing on the image copy to obtain image data that meets the input format requirements of AI services.

[0050] In steps S201-S203, firstly, the `getBoundingRect()` method provided by Fabric.js is used to calculate the bounding box (i.e., the bounding frame) of the Canvas object in the world coordinate system, combined with the transformation matrix of the Canvas object, and the coordinates of the bounding box are obtained based on this bounding box. Then, dynamic margins are calculated according to the size and type of the Canvas object (such as text, path, or image), and pixel margin values ​​are obtained. Text objects typically require larger margins to retain shadow effects, while image objects use the minimum necessary margins. Finally, the margin values ​​are applied to the four boundaries of the bounding box through coordinate transformation to generate a complete sampling region, which is then used as the image extraction region.

[0051] In steps S204-S206, an off-screen Canvas element matching the image extraction area is created as a temporary Canvas (i.e., a temporary processing buffer). Then, the Fabric.js object cloning interface is used to copy all properties of the original selected Canvas object, and coordinate offsets are used within the temporary Canvas to ensure the image copy is rendered in the center. Finally, the Canvas's toBlob() method is used to convert the image copy into binary data of a specified format, and encoding optimization is performed according to the AI ​​service's input requirements, thus obtaining image data that conforms to the AI ​​service's input format requirements.

[0052] In this embodiment, based on the scheme in steps S201-S206, through precise geometric calculations and attribute preservation techniques, this embodiment ensures that the image data extracted from the Canvas not only fully preserves the visual features of the original selected Canvas object but also meets the input specifications of various AI services. The dynamic margin mechanism effectively prevents content clipping issues, and the temporary Canvas strategy isolates the processing process from the main canvas. The standardized extraction process in steps S201-S206 of this embodiment provides high-quality input for subsequent AI processing, laying the foundation for deep integration.

[0053] In one embodiment, such as Figure 3 As shown, step S103 includes:

[0054] S301. The image data is processed by a unified status management module to obtain an AI task instance with the status of "processing".

[0055] S302. Based on the AI ​​task instance, add the image data to the asynchronous processing queue and call the API interface of the AI ​​service to perform asynchronous image processing;

[0056] S303. Listen to and receive the processing results returned by the AI ​​service, perform data format verification and parsing on the processing results, and obtain the result image;

[0057] S304. In the status management module, update the status of the corresponding AI task instance to complete and trigger the result ready event.

[0058] In this embodiment, steps S301-S304 achieve full lifecycle management of AI processing tasks through the collaborative work of a unified state management module (such as Vuex or Pinia) and an asynchronous processing mechanism. Specifically, firstly, the image data to be processed is registered through the state management module, creating an AI task instance containing a task identifier, timestamp, and status marker, and setting the initial task status to "processing" to trigger corresponding feedback from the user interface. Subsequently, the AI ​​task instance is included in the asynchronous processing queue for scheduling, and the image data is sent to the AI ​​server via a non-blocking API call, maintaining the user's responsiveness to the Canvas editor throughout the process. Next, the response stream from the AI ​​server is continuously monitored, and the returned processing results are verified for data integrity and format parsing to ensure that the received data conforms to the expected specifications. Finally, once the data is confirmed to be valid, the status of the corresponding task instance is immediately updated to "completed" in the state management module, and a result ready event is triggered to notify subsequent processing flows.

[0059] In this embodiment, based on the solutions in steps S301-S304, the AI ​​processing process is visualized and interactive. Users can clearly perceive the processing progress while maintaining full control over the Canvas editor. This design improves the user experience and avoids the interface freezing problem caused by processing delays in traditional solutions.

[0060] In one embodiment, step S302 includes:

[0061] AI task instances are routed to the corresponding AI service function modules for asynchronous image processing; among them, the AI ​​service function modules include an AI matting module for subject recognition and background separation, an image sharpening module for quality enhancement and super-resolution processing, an AI text generation module for semantic understanding and text generation, and a text-to-image module for semantic parsing and visual content generation.

[0062] This embodiment defines a routing and processing mechanism for AI services. Requests can be distributed to the AI ​​background removal module, image sharpening module, AI text generation module, and / or text-to-image module within the AI ​​service functional modules based on the task type identifier of the AI ​​task instance. Based on this, through a modular service architecture, this embodiment achieves unified scheduling and flexible expansion of various AI capabilities. Users can seamlessly use different types of intelligent processing functions within the same interface without switching operating environments. This integrated solution significantly reduces the operational complexity caused by multi-tool collaboration, providing comprehensive AI-assisted support for creative work.

[0063] In some embodiments, the AI ​​image matting function can employ a U²-Net-based deep learning model to achieve high-precision foreground segmentation. This model, through a multi-layered nested U-shaped structure, can accurately capture the outline of the main subject in the image, achieving high-quality matting results. The image sharpening function can utilize super-resolution reconstruction technology, using deep learning algorithms to restore details and enhance textures in low-resolution images, resulting in clear and detailed high-resolution images. The AI ​​text generation function can employ natural language processing technology to semantically understand image content and generate text descriptions that match the image content, adding more informational value to the image. The text-to-image function can employ semantic parsing technology to transform user-input text descriptions into visual content, enabling creative generation from text to image and providing users with richer image creation methods.

[0064] In one embodiment, step S303 includes:

[0065] Perform integrity verification on the processing results returned by the AI ​​service and parse the data format of the processing results;

[0066] If the data format is an image format, the processing result is decoded to convert it into bitmap data that can be rendered by the Canvas editor; if the data format is a text format, the processing result is parsed and normalized to convert it into a text object that can be inserted into the canvas or text image data to be rendered.

[0067] The results of verification and parsing are encapsulated to generate a result image.

[0068] In this embodiment, the processing results (i.e., data packets) returned by the AI ​​service are structurally verified. The integrity of the data packets can be verified using the MD5 checksum algorithm. Simultaneously, feature detection is used to identify the data format type of the processing results (i.e., image format or text format), laying the foundation for subsequent differentiated processing. For processing results identified as image format, the image processing channel of the Canvas editor can be enabled for processing. Specifically, the decodeImage() method of the Canvas editor is used for progressive decoding, converting it into a bitmap format that the Canvas editor can directly render. During this process, key details such as color space conversion and transparency channel preservation can be automatically handled. For processing results identified as text format, the text processing channel of the Canvas editor is enabled. The original text is converted into structured data through UTF-8 decoding and JSON parsing. Then, regular expressions are used for text cleaning and normalization. The output format is intelligently selected according to the context requirements: either generating a Fabric text object that can be directly inserted into the canvas, or converting it into text image data to be rendered using the Canvas text rendering API. Finally, all processing results are uniformly encapsulated, and metadata identifiers such as MIME type and size specifications are added to form standardized result image objects, ensuring that subsequent processes can be seamlessly continued.

[0069] Based on this, this embodiment effectively solves the compatibility problem between the two types of AI return results and the Canvas editor by establishing an intelligent data recognition and diversion processing mechanism. It can automatically adapt to different data input formats, ensuring that image and text content can be accurately converted into resource formats usable by the editor through corresponding decoding and parsing tools. This effectively improves the system's adaptability and processing reliability when facing diverse AI services, providing a solid data processing foundation for deep integration.

[0070] In one embodiment, such as Figure 4 As shown, step S104 includes:

[0071] S401. Call the image object creation method provided by the graphics library on which the Canvas editor depends, encapsulate the resulting image, and obtain a new image object;

[0072] S402. Extract the transformation matrix and the layer index in the canvas object list from the selected Canvas object to obtain the transformation attributes and layer information to be preserved.

[0073] S403. Assign the obtained transformation attributes and hierarchical information to the new image object to preserve all attributes;

[0074] S404. Insert the image object with preserved attributes into the canvas layer where the originally selected Canvas object is located, and remove the originally selected Canvas object to complete the replacement operation.

[0075] In this embodiment, firstly, the image object creation method in step S401 can be the `fabric.Image` constructor of `Fabric.js`, which can create a new image object based on the resulting image and initialize its basic properties. Secondly, step S402 can extract key state information from the selected Canvas object. Specifically, the transformation properties (i.e., the transformation matrix) of the Canvas object can be obtained through the `getTransformMatrix()` method, and then the layer information (i.e., the position index in the rendering queue) of the Canvas object can be determined through `canvas.getObjects().indexOf()`. Next, step S403 applies the transformation properties to the new image object completely through the `setTransformMatrix()` method and updates the control point coordinates of the new image object through `setCoords()`. Finally, the new image object is inserted into the layer of the originally selected Canvas object using the `insertAt()` method of the canvas, and then the originally selected Canvas object is cleaned up using the `remove()` method, thus completing the visual transition.

[0076] In this embodiment, based on the solution in steps S401-S404, through refined attribute migration and hierarchical management, this embodiment achieves seamless replacement of the AI ​​processing result with the originally selected Canvas object. Users do not need to manually adjust the object position or hierarchical relationship before and after processing, greatly simplifying the operation process.

[0077] In one embodiment, the intelligent image processing method further includes:

[0078] When there are multiple selected Canvas objects, a corresponding sub-processing task is generated for each selected Canvas object, forming a task set;

[0079] The task set is concurrently scheduled and processed, and image data extraction, AI task registration and asynchronous processing, attribute replacement of the result image and Canvas display update operations are performed on each Canvas object in parallel. Multiple AI processing requests call the AI ​​service simultaneously through the asynchronous processing queue.

[0080] The progress of all sub-processing tasks in the task set is monitored and summarized through a unified status management module, and the overall progress of batch processing is obtained and displayed.

[0081] In this embodiment, a parallel processing scheme is designed for scenarios with multiple Canvas objects. When the user selects multiple Canvas objects, an independent task instance is created for each Canvas object, and the concurrency is controlled by a task scheduler. Each task executes in parallel, from image extraction to result display (i.e., the process described in S102-105 above), where AI requests achieve efficient concurrency through connection pooling technology. The state management module continuously collects the progress of each task, calculates the overall completion rate through weighted average, and displays it in real time on the progress bar component. The system also sets up an error isolation mechanism, so the failure of a single task will not affect the normal execution of other tasks.

[0082] Based on this, this embodiment achieves performance optimization for large-scale image processing, reducing the time consumption of batch operations to a lower level through concurrent processing. Furthermore, it provides real-time progress feedback so users can clearly understand the processing status, and the error isolation mechanism ensures the robustness of the system.

[0083] This invention also provides an intelligent image processing apparatus for executing any of the aforementioned intelligent image processing methods. Specifically, please refer to... Figure 5 , Figure 5 This is a schematic block diagram of the intelligent image processing device provided in the embodiments of the present invention.

[0084] like Figure 5 As shown, the intelligent image processing device 500 includes: a selection area detection unit 501, an object processing unit 502, an image processing unit 503, a replacement unit 504, and an update unit 505.

[0085] The selection detection unit 501 is used to detect and process the user selection in the Canvas editor to obtain the currently selected Canvas object;

[0086] The object processing unit 502 is used to perform boundary calculation, dynamic margin calculation and attribute cloning on the Canvas object to obtain image data that meets the input format requirements of AI services.

[0087] The image processing unit 503 is used to register AI tasks for image data and asynchronously call AI services to perform image processing to obtain the AI-processed result image.

[0088] Replacement unit 504 is used to input the result image into the Canvas editor and perform attribute replacement processing with the selected corresponding Canvas object, while maintaining the position, scaling, rotation attributes and canvas hierarchy of the selected corresponding Canvas object.

[0089] Update unit 505 is used to update the Canvas display in the Canvas editor.

[0090] This device achieves deep integration of AI functionality with the Canvas editor, enabling seamless application of AI processing results to the Canvas canvas. Users can complete intelligent image processing without manual cross-tool operations. Specifically, this invention preserves the original layout information of the selected Canvas object through an attribute preservation mechanism and the AI-processed image, ensuring visual consistency of the design draft. The asynchronous processing architecture effectively avoids interface lag, allowing users to continue other editing operations during the processing. The overall solution improves the automation and smoothness of image processing, making it suitable for design workflows that frequently utilize AI functions.

[0091] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the above-described apparatus and unit can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0092] The aforementioned intelligent image processing device can be implemented as a computer program, which can, for example, Figure 6 It runs on the computer device shown.

[0093] Please see Figure 6 , Figure 6 This is a schematic block diagram of a computer device provided in an embodiment of the present invention. The computer device 600 is a server, which can be a standalone server or a server cluster composed of multiple servers.

[0094] See Figure 6 The computer device 600 includes a processor 602, a memory, and a network interface 605 connected via a system bus 601. The memory may include a non-volatile storage medium 603 and internal memory 604.

[0095] The non-volatile storage medium 603 can store an operating system 6031 and a computer program 6032. When the computer program 6032 is executed, it causes the processor 602 to perform an intelligent image processing method.

[0096] The processor 602 provides computing and control capabilities to support the operation of the entire computer device 600.

[0097] The internal memory 604 provides an environment for the operation of the computer program 6032 in the non-volatile storage medium 603. When the computer program 6032 is executed by the processor 602, the processor 602 can perform intelligent image processing methods.

[0098] This network interface 605 is used for network communication, such as providing data transmission. Those skilled in the art will understand that... Figure 6The structure shown is merely a block diagram of a portion of the structure related to the present invention and does not constitute a limitation on the computer device 600 to which the present invention is applied. The specific computer device 600 may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0099] Those skilled in the art will understand that Figure 6 The embodiments of the computer device shown do not constitute a limitation on the specific configuration of the computer device. In other embodiments, the computer device may include more or fewer components than illustrated, or combine certain components, or have different component arrangements. For example, in some embodiments, the computer device may include only memory and a processor. In such embodiments, the structure and function of the memory and processor are different from those shown. Figure 6 The embodiments shown are consistent and will not be described again here.

[0100] It should be understood that, in this embodiment of the invention, the processor 602 may be a Central Processing Unit (CPU), or it may be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor.

[0101] In another embodiment of the invention, a computer-readable storage medium is provided. This computer-readable storage medium may be a non-volatile computer-readable storage medium. The computer-readable storage medium stores a computer program, wherein the computer program, when executed by a processor, implements the intelligent image processing method of the embodiments of the present invention.

[0102] The storage medium is a physical, non-transient storage medium, such as a USB flash drive, portable hard drive, read-only memory (ROM), magnetic disk, or optical disk, or any other physical storage medium capable of storing program code.

[0103] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the devices, apparatuses, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0104] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in the present invention, and these modifications or substitutions should all be covered within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.

Claims

1. A smart image processing method, characterized in that, include: The user selection area in the Canvas editor is detected and processed to obtain the currently selected Canvas object; The Canvas object undergoes boundary calculation, dynamic margin calculation, and attribute cloning to obtain image data that meets the input format requirements of the AI ​​service. Specifically, this includes: performing boundary calculation on the Canvas object to obtain its bounding box coordinates in the world coordinate system; performing dynamic margin calculation based on the bounding box coordinates and the size of the Canvas object to obtain pixel margin values; wherein, during dynamic margin calculation, a large margin is used for text objects to preserve shadow effects, and a minimum necessary margin is used for image objects; calculating to expand the original bounding box based on the bounding box coordinates and the pixel margin values ​​to obtain the final image extraction area; creating a temporary Canvas canvas matching the size of the image extraction area; performing attribute cloning and drawing processing on the Canvas object within the temporary Canvas canvas to obtain an image copy containing the complete object content; and performing format conversion and encoding processing on the image copy to obtain image data that meets the input format requirements of the AI ​​service. The image data is registered for AI tasks, and the AI ​​service is asynchronously invoked to perform image processing to obtain the AI-processed result image; The resulting image is input into the Canvas editor and its attributes are replaced with those of the selected corresponding Canvas object, while preserving the position, scaling, rotation attributes, and canvas hierarchy of the selected corresponding Canvas object. Specifically, this includes: calling the image object creation method provided by the graphics library upon which the Canvas editor depends to encapsulate the resulting image to obtain a new image object; extracting the transformation matrix and hierarchy index in the canvas object list from the selected Canvas object to obtain the transformation attributes and hierarchy information to be preserved; assigning the obtained transformation attributes and hierarchy information to the new image object to preserve all attributes; inserting the image object with preserved attributes into the canvas hierarchy of the original selected Canvas object and removing the original selected Canvas object to complete the replacement operation. Update the Canvas display in the Canvas editor.

2. The intelligent image processing method of claim 1, wherein, The process of registering the image data for an AI task and asynchronously calling an AI service to process the image and obtain the processed image includes: The image data is processed by a unified status management module to register tasks, resulting in AI task instances with a status of "processing". Based on the AI ​​task instance, the image data is added to the asynchronous processing queue, and the API interface of the AI ​​service is called to perform asynchronous image processing; Listen to and receive the processing results returned by the AI ​​service, perform data format verification and parsing on the processing results, and obtain the result image; In the state management module, the status of the corresponding AI task instance is updated to complete, and a result ready event is triggered.

3. The intelligent image processing method according to claim 2, characterized in that, The asynchronous image processing via the API interface of the AI ​​service includes: The AI ​​task instance is routed to the corresponding AI service function module for asynchronous image processing; wherein, the AI ​​service function module includes an AI matting module for subject recognition and background separation, an image sharpening module for quality enhancement and super-resolution processing, an AI text generation module for semantic understanding and text generation, and a text-to-image module for semantic parsing and visual content generation.

4. The intelligent image processing method according to claim 2, characterized in that, The process of listening to and receiving the processing results returned by the AI ​​service, performing data format verification and parsing on the processing results, and obtaining the result image includes: Perform integrity verification on the processing results returned by the AI ​​service, and parse the data format of the processing results; If the data format is an image format, the processing result is decoded to convert it into bitmap data that can be rendered by the Canvas editor; if the data format is a text format, the processing result is parsed and normalized to convert it into a text object that can be inserted into the canvas or text image data to be rendered. The processing results after verification and parsing are encapsulated to generate a result image.

5. The intelligent image processing method according to claim 1, characterized in that, Also includes: When there are multiple selected Canvas objects, a corresponding sub-processing task is generated for each selected Canvas object, forming a task set; The task set is concurrently scheduled and processed, and image data extraction, AI task registration and asynchronous processing, attribute replacement of the result image and Canvas display update operations are performed on each Canvas object in parallel. Multiple AI processing requests call the AI ​​service simultaneously through an asynchronous processing queue. The progress of all sub-processing tasks in the task set is monitored and summarized through a unified status management module, and the overall progress of batch processing is obtained and displayed.

6. An intelligent image processing device, characterized in that, include: The selection detection unit is used to detect and process the user's selection in the Canvas editor to obtain the currently selected Canvas object; An object processing unit is used to perform boundary calculation, dynamic margin calculation, and attribute cloning on the Canvas object to obtain image data that meets the input format requirements of the AI ​​service. Specifically, this includes: performing boundary calculation on the Canvas object to obtain its bounding box coordinates in the world coordinate system; performing dynamic margin calculation based on the bounding box coordinates and the size of the Canvas object to obtain pixel margin values; wherein, during dynamic margin calculation, a large margin is used for text objects to preserve shadow effects, and a minimum necessary margin is used for image objects; calculating to expand the original bounding box based on the bounding box coordinates and the pixel margin values ​​to obtain the final image extraction area; creating a temporary Canvas canvas that matches the size of the image extraction area; performing attribute cloning and drawing on the Canvas object in the temporary Canvas canvas to obtain an image copy containing the complete object content; and performing format conversion and encoding on the image copy to obtain image data that meets the input format requirements of the AI ​​service. An image processing unit is used to register the image data for AI tasks and asynchronously call AI services to perform image processing to obtain the AI-processed result image. The replacement unit is used to input the resulting image into the Canvas editor and perform attribute replacement processing with the selected corresponding Canvas object, while preserving the position, scaling, rotation attributes, and canvas layer relationships of the selected corresponding Canvas object. Specifically, it includes: calling the image object creation method provided by the graphics library on which the Canvas editor depends to encapsulate the resulting image to obtain a new image object; extracting the transformation matrix and layer index in the canvas object list from the selected Canvas object to obtain the transformation attributes and layer information to be preserved; assigning the obtained transformation attributes and layer information to the new image object to complete the preservation of all attributes; inserting the image object with preserved attributes into the canvas layer where the original selected Canvas object is located, and removing the original selected Canvas object to complete the replacement operation. The update unit is used to update the Canvas display in the Canvas editor.

7. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the intelligent image processing method as described in any one of claims 1 to 5.

8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, causes the processor to perform the intelligent image processing method as described in any one of claims 1 to 5.