Image size processing method and system
By using image recognition technology to identify key areas and blank areas in text and image data, and calculating and redistributing blank areas, the technology solves the problems of low efficiency in text and image processing and poor display effect in existing technologies. It achieves intelligent positioning and scaling, and improves the consistency of multi-template adaptation and blank space filling.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SHENZHEN LENGFENG TECH CO LTD
- Filing Date
- 2026-05-09
- Publication Date
- 2026-06-23
AI Technical Summary
Existing image processing technologies are ill-suited to the demands of large-scale, automated processing. They are unable to intelligently identify the main subject area of an image, adjust the white space ratio inconsistently, and lack an efficient mechanism for filling new white space areas, resulting in low image processing efficiency and poor display effects.
Image recognition technology is used to determine the original key area and blank area, calculate position and scale parameters, redistribute the blank area to generate target image and text data, realize the intelligent positioning and scaling of the subject in the target canvas, and optimize the blank filling according to the composition rule library.
It achieves automated processing without manual image editing, improves the adaptability of multiple templates and the consistency of newly added white space filling, and enhances image processing efficiency and display effect.
Smart Images

Figure CN122265020A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of Internet technology, and in particular to a method and system for processing image and text dimensions. Background Technology
[0002] With the rapid development of the e-commerce industry, product images and text have become one of the core factors influencing consumers' purchasing decisions. To meet the standardized display requirements of platforms, a large number of product images need to undergo uniform size adjustments and layout optimizations to ensure consistency and aesthetics in terms of subject placement and white space ratio. However, existing image and text processing technologies still have many shortcomings in practical applications and are difficult to adapt to the needs of large-scale, automated processing.
[0003] Current mainstream image processing methods mainly rely on manual operation or simple batch scaling tools, which have obvious limitations: On the one hand, manual processing is inefficient, and it is difficult to guarantee processing speed when faced with massive amounts of order images. Moreover, the consistency of manual adjustments is poor, and problems such as subject offset and uneven white space are easy to occur. On the other hand, traditional batch scaling tools can only achieve proportional scaling or fixed cropping, and cannot intelligently adjust the proportional relationship of white space in different directions according to the position and size of the main object in the image. This often results in the processed image having the main object cropped, unbalanced white space, or a large number of meaningless blank areas due to canvas expansion, which seriously affects the product display effect.
[0004] Furthermore, some existing intelligent processing solutions only support adaptation to images with fixed proportions, lacking the ability to dynamically identify the position of the subject and adapt to multiple templates. They cannot automatically adjust the white space ratio according to different layouts preset by the user (such as centering, top, bottom, etc.). At the same time, for the new white space areas caused by canvas expansion, existing technologies also lack efficient intelligent filling mechanisms, making it difficult to generate background content consistent with the style of the original image. This often requires additional manual image retouching, and cannot achieve fully automated closed-loop processing from subject recognition to layout optimization.
[0005] Therefore, how to automatically identify the main area of an image, intelligently adjust the white space ratio, and improve the consistency between multiple templates and newly added white space filling has become an urgent technical problem to be solved. Summary of the Invention
[0006] This application provides a method and system for processing graphic dimensions to improve the consistency between multiple templates and newly added white space fill.
[0007] In a first aspect, this application provides a method for processing image and text dimensions, the method comprising: The original key regions are determined in the image and text data to be processed using image recognition technology; Based on the original key area, at least one original white space area is determined in the text and image data to be processed, wherein the original white space area includes an upper white space area, a lower white space area, a left white space area, and / or a right white space area; The position parameters and scale parameters are determined based on the original key areas and each of the original blank areas; The target position coordinates and target scaling ratio of the original key region in the target canvas are determined based on the position parameters and scaling parameters. Based on the target location coordinates and the target scaling ratio, the original blank areas are redistributed to generate target graphic data.
[0008] Secondly, this application also provides a graphic size processing system, the system comprising: The user authentication and configuration module is used for user login and basic system configuration. The basic system configuration includes browser path, job output path, image processing parameters and printing device settings. The order data acquisition and processing module is used to access and log in to the management platform backend to obtain the graphic and text data to be processed. The image resource management module includes an image library management unit and an image matching and retrieval unit, which are used to bind to a centrally managed image resource library and search for and copy the corresponding image from the image resource library according to the image and text data to be processed; The core batch processing engine module includes an integrated image classification unit, image size adjustment unit, automated printing unit, order fulfillment unit, and intelligent review unit, which are used to classify and organize the image and text data to be processed, perform batch size adjustment, batch printing, and order processing. The workflow orchestration and fully automated execution module is used to execute order acquisition, image processing, and order processing according to a preset workflow. The job monitoring and results display module records the running status, operation steps and result information, and provides a unified interface to view the summary information after the batch processing task is completed.
[0009] This application discloses a method and system for processing image and text sizes. The method includes determining original key regions in the image and text data to be processed using image recognition technology; determining at least one original white space region in the image and text data to be processed based on the original key regions, wherein the original white space region includes an upper white space region, a lower white space region, a left white space region, and / or a right white space region; determining position parameters and scale parameters based on the original key regions and each of the original white space regions; determining the target position coordinates and target scaling ratio of the original key regions in the target canvas based on the position parameters and scale parameters; and redistributing each of the original white space regions based on the target position coordinates and the target scaling ratio to generate target image and text data. Through the above method, this application achieves intelligent positioning and scaling of the subject in the target canvas by identifying key regions and white space regions and calculating parameters, while redistributing white space regions to ensure aesthetic composition and background harmony. It eliminates the need for manual image retouching, automatically adapts to multiple size requirements, significantly improves image processing efficiency, and enhances the consistency of multiple templates and newly added white space filling. Attached Figure Description
[0010] To more clearly illustrate the technical solutions of the embodiments of this application, the drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0011] Figure 1 This is a schematic flowchart illustrating a graphic size processing method provided in an embodiment of this application; Figure 2 A schematic block diagram of a graphic size processing system provided for embodiments of this application; Figure 3 This is a schematic diagram of the application interface of a graphic size processing system provided in the embodiments of this application. Detailed Implementation
[0012] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0013] The flowchart shown in the attached diagram is for illustrative purposes only and does not necessarily include all content and operations / steps, nor does it necessarily have to be performed in the order described. For example, some operations / steps can be broken down, combined, or partially merged, so the actual execution order may change depending on the actual situation.
[0014] It should 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 scope of the application. 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.
[0015] It should also be understood that the term “and / or” as used in this application specification and the appended claims means any combination of one or more of the associated listed items and all possible combinations, and includes such combinations.
[0016] This application provides a method and system for processing image and text dimensions. The method can be applied to an image and text dimension processing system. By identifying key areas and blank areas and calculating parameters, it achieves intelligent positioning and scaling of the main subject in the target canvas, while redistributing blank areas to ensure aesthetically pleasing composition and harmonious background. No manual image retouching is required; it can automatically adapt to multiple size requirements, significantly improving image processing efficiency and enhancing consistency between multiple templates and newly added blank space filling.
[0017] The following detailed description of some embodiments of this application is provided in conjunction with the accompanying drawings. Unless otherwise specified, the following embodiments and features can be combined with each other.
[0018] Please see Figure 1 , Figure 1 This is a schematic flowchart illustrating a text and image size processing method provided in an embodiment of this application. This method can be applied to a text and image size processing system to improve the consistency between multiple templates and newly added white space fill.
[0019] like Figure 1 As shown, the graphic size processing method specifically includes steps S10 to S50.
[0020] Step S10: Determine the original key regions in the image and text data to be processed using image recognition technology; Specifically, the system receives the main image of the product to be processed and uses a pre-trained deep learning object detection model (such as YOLO or Faster R-CNN) to identify the main product region in the image, determining it as the original key region. If the confidence score of the automatic identification result is lower than 0.85, an interactive interface will pop up to prompt the user to manually select and correct the region.
[0021] Step S20: Determine at least one original white space area in the text and image data to be processed based on the original key area, wherein the original white space area includes an upper white space area, a lower white space area, a left white space area and / or a right white space area; Specifically, using the bounding rectangle of the original key area as the boundary, the original canvas is divided into upper, lower, left, and right blank areas. Specifically, the coordinates of the four vertices of the bounding rectangle of the original key area are calculated, and the area between the top edge of the canvas and the top edge of the bounding rectangle is designated as the upper blank area. This process is repeated to determine the blank areas in the other three directions.
[0022] Step S30: Determine the position parameters and scale parameters based on the original key areas and each of the original blank areas; Specifically, the positional parameters include the horizontal and vertical offsets of the center point of the original key area relative to the center point of the original canvas; the ratio of the distance between the top edge of the original key area and the top edge of the original canvas to the height of the original canvas (i.e., the top margin ratio), and the same applies to the other three sides.
[0023] The scaling parameters include the ratio of the original key area width to the original canvas width, the ratio of the original key area height to the original canvas height, and the ratio of the original key area area to the original canvas area.
[0024] Step S40: Determine the target position coordinates and target scaling ratio of the original key area in the target canvas based on the position parameters and scaling parameters; Specifically, taking a target canvas size of 800×800 pixels and an original canvas size of 600×400 pixels as an example.
[0025] Based on the top margin ratio (which can be preset to 0.2) and bottom margin ratio (which can be preset to 0.3) in the position parameters, calculate the vertical position features of the original key area in the original canvas. Since the target canvas is square, the visual center position of the original key area needs to be maintained. Therefore, the vertical coordinate of the target position is calculated as: target canvas height × top margin ratio / (top margin ratio + bottom margin ratio) = 800 × 0.2 / 0.5 = 320 pixels.
[0026] Step S50: Based on the target location coordinates and the target scaling ratio, the original blank areas are redistributed to generate target graphic data.
[0027] Specifically, based on the corrected target position coordinates (preset to be slightly above the center of the target canvas) and the target scaling ratio, the actual area occupied by the key area of the target in the target canvas is determined.
[0028] Calculate the original area proportion of the original blank area in each direction. The area proportion of the upper blank area is 0.2×600×400 / (600×400)=0.2. Similarly, the lower blank area is 0.3, and the left and right blank areas are 0.25 each (in the case of symmetry).
[0029] The target key area is 600 × 400 = 240,000 square pixels (this is the corrected size). The total area of the target canvas is 640,000 square pixels. The remaining 400,000 square pixels are allocated according to the original area proportions: the target area of the upper white space = 400,000 × 0.2 / (0.2 + 0.3 + 0.25 + 0.25) = 80,000 square pixels, corresponding to a height of 80,000 / 800 = 100 pixels; the target area of the lower white space = 120,000 square pixels, with a height of 150 pixels; the white space on the left and right each = 100,000 square pixels, with a width of 125 pixels.
[0030] The total height was verified to be 100 + 400 + 150 = 650 pixels ≠ 800 pixels, indicating a 50-pixel size change compensation. Based on the non-proportional allocation strategy, since the top and bottom margins have a stronger semantic connection to the main product (e.g., creating a sense of space for hanging or displaying the product), the relative proportion of the top and bottom margins was maintained first. The 50-pixel compensation was allocated to the left and right margins, resulting in a final left and right margin width of (100000 + 50 × 400) / 400 = 137.5 pixels.
[0031] Place the key target area at the calculated target location, and allocate blank areas around it according to the above calculation results to generate the final target graphic data.
[0032] In some embodiments, this embodiment can be applied to batch processing and template applications.
[0033] To address the bulk product image processing needs of e-commerce platforms, a template library is first established. Taking clothing as an example, the positional characteristics of the human model or clothing subject in the main image of this type of product are usually located slightly above the center of the canvas. A "Clothing - Slightly Above Center" template is created, and typical positional and proportional parameters for this category are saved.
[0034] During batch processing, the category label of each image is identified, and the corresponding template is called to initialize the position and scale parameters. For images with a high match with the template (confidence > 0.9), the corresponding target image and text data is directly generated; for images with a medium match (confidence 0.7-0.9), a preview image is output for users to quickly confirm; for images with a low match (confidence < 0.7), they are marked as abnormal data and transferred to the manual review queue.
[0035] After the review is completed, the corrected parameters will be fed back to the template library. The template parameters will be updated through incremental learning to achieve continuous optimization of the template library.
[0036] In some embodiments, this embodiment can be applied to intelligent filling of an expanded canvas scene.
[0037] When the target canvas size is larger than the original canvas size, for example, adjusting a 600×400 pixel image to 1200×800 pixels, the key areas of the target are enlarged by a scaling factor of 2.0, while maintaining the visual center of gravity of the target's position coordinates. At this point, in addition to the key areas of the target and the redistributed white space, there are also incremental white space areas in the target canvas caused by the change in aspect ratio.
[0038] The boundary features of the incremental white space region are detected, and the color histogram and texture features of the adjacent original white space regions are extracted. For background regions with uniform color, adjacent pixels are mirrored and then blurred and filled. For background regions with texture details, a texture synthesis algorithm is used to search for the best matching block from the original white space region for filling, ensuring that the filled content is seamlessly connected with the surrounding area.
[0039] This embodiment discloses a method and system for processing image and text sizes. The method includes determining original key regions in the image and text data to be processed using image recognition technology; determining at least one original white space region in the image and text data to be processed based on the original key regions, wherein the original white space region includes an upper white space region, a lower white space region, a left white space region, and / or a right white space region; determining position parameters and scale parameters based on the original key regions and each of the original white space regions; determining the target position coordinates and target scaling ratio of the original key regions in the target canvas based on the position parameters and scale parameters; and redistributing each of the original white space regions based on the target position coordinates and the target scaling ratio to generate target image and text data. Through the above method, this application achieves intelligent positioning and scaling of the subject in the target canvas by identifying key regions and white space regions and calculating parameters, while redistributing white space regions to ensure aesthetic composition and background harmony. No manual image retouching is required; it can automatically adapt to multiple size requirements, significantly improving image processing efficiency and enhancing the consistency of multiple templates and newly added white space filling.
[0040] based on Figure 1 In the illustrated embodiment, step S10 includes: The image and text data to be processed are classified at the pixel level using a preset deep learning semantic segmentation model to identify the foreground subject object. The preset deep learning semantic segmentation model includes the image recognition technology. Calculate the minimum bounding rectangle of the foreground subject object, and determine the minimum bounding rectangle region as the original key region.
[0041] Specifically, after acquiring the raw image and text data to be processed, it is first input into a pre-trained deep learning semantic segmentation model. As a concrete implementation of image recognition technology, the core task of the deep learning semantic segmentation model is to understand the content of the image. The model's weight file is loaded into a server or computing device, and the input image is fed into the model for inference. The model analyzes the image pixel by pixel, determining whether each pixel belongs to the "foreground subject" or the "background." Finally, the model outputs a labeled image of the same size as the original image, in which all pixel positions occupied by the foreground subject are marked, forming a complete, pixel-level foreground outline.
[0042] Based on the labeled image output by the model, a binary mask image is generated. In this mask, the pixel regions corresponding to the foreground subject are assigned white (or highlight values), while the background regions are assigned black (or low values). To ensure the purity of the mask, morphological optimization is performed, such as filling small black holes in the foreground region through "closing operations" or removing scattered white noise at the foreground edges through "opening operations." This step aims to obtain a smooth, continuous, and undisturbed foreground subject shape, providing clear boundaries for subsequent geometric calculations.
[0043] Contour analysis is performed on the processed binary mask. By scanning the mask image, the boundary between white and black areas is automatically found, thereby extracting the outer contour of the foreground subject. This process obtains a set of all edge points that constitute the contour. If multiple independent foreground subjects are identified in the image, the system records the independent contour of each subject separately. These contour points accurately depict the actual shape of the subject in the image, serving as a bridge between pixel-level recognition and geometric calculation.
[0044] For the extracted foreground contour, its minimum bounding rectangle is calculated; specifically, the smallest rectangular region that completely encloses the contour is found. The system automatically analyzes the distribution of the contour point set to determine the coordinates of the four vertices of the rectangle (or equivalent center point coordinates, width, height, and rotation angle). By default, the edges of this rectangle are usually parallel to the horizontal and vertical directions of the image to ensure layout regularity; in specific embodiments, a rotated rectangle that fits the tilted subject can also be calculated. Finally, the area covered by this rectangle is formally defined as the "original key region".
[0045] based on Figure 1 In the illustrated embodiment, step S20 includes: Subtract the pixel area occupied by the original key area from the overall canvas area of the image and text data to be processed to determine the remaining area; A connected component analysis is performed on the remaining region, and the largest connected components located above, below, to the left, and to the right of the original key region are respectively determined as the upper blank region, the lower blank region, the left blank region, and the right blank region.
[0046] Specifically, the boundary range of the entire image to be processed (i.e., the "canvas") is obtained. From the set of pixels representing the entire canvas range, all pixels occupied by the "original key region" (i.e., the smallest bounding rectangle of the foreground subject) are subtracted or excluded. What is obtained is all the background and gap parts in the image except for the key region, i.e., the "remaining area".
[0047] The purpose of performing connected component analysis on the "remaining region" is to find all interconnected pixel blocks within that region. Specifically, the system scans the remaining region and groups adjacent pixels that are not occupied by key regions into a single independent set of pixels. Each such independent set is called a "connected component".
[0048] Using the outer rectangular boundary of the original key area as a reference, establish the direction determination baseline: the horizontal line where the top edge of the original key area is located is the upper boundary baseline, the horizontal line where the bottom edge is located is the lower boundary baseline, the vertical line where the left side is located is the left boundary baseline, and the vertical line where the right side is located is the right boundary baseline.
[0049] Iterate through the list of connected components and perform a direction attribution determination for each component: If the vertical coordinate of the lowest end of the connected region is above the upper boundary baseline, and the connected region overlaps or is adjacent to the original key region in the horizontal direction, then it is included in the upper candidate set. If the vertical coordinate of the uppermost part of the connected region is below the lower boundary baseline, and the connected region overlaps or is adjacent to the original key region in the horizontal direction, then it is included in the next candidate set. If the rightmost horizontal coordinate of a connected region is located to the left of the left boundary baseline, and the connected region overlaps or is adjacent to the original key region in the vertical direction, then it is included in the left candidate set. If the leftmost horizontal coordinate of a connected region is located to the right of the right boundary baseline, and the connected region overlaps or is adjacent to the original key region in the vertical direction, then it is included in the right candidate set.
[0050] The connected components with the largest number of pixels are selected from the upper candidate set, lower candidate set, left candidate set, and right candidate set, respectively, and are then determined as the upper blank area, lower blank area, left blank area, and right blank area.
[0051] When the original key area touches a boundary of the canvas in a certain direction, for example, if the top edge of the original key area coincides with the top edge of the canvas, the upper candidate set will necessarily be empty, and the upper blank area will not exist. The system records the boundary contact state and, during subsequent size adjustments, prioritizes spatial expansion or compression in the direction where there is a valid blank area to avoid invalid calculations.
[0052] When there are multiple connected regions with similar areas in a certain direction, analyze the length of the adjacent edges between each connected region and the original key region, and select the connected region with the longest adjacent edge length as the blank area in that direction to ensure that the blank area has direct spatial continuity with the original key region.
[0053] In a specific embodiment, after performing connected component analysis on the remaining region and determining the largest connected components located above, below, to the left, and to the right of the original key region as the upper blank region, the lower blank region, the left blank region, and the right blank region, respectively, the following steps are taken: If there are no connected regions above, below, to the left, or to the right of the original key area, then it is determined that the original blank area does not exist.
[0054] Specifically, if the candidate set for a certain direction is empty, it is determined that there is no valid blank area in that direction, and the blank area in that direction will be treated as zero in subsequent processing.
[0055] based on Figure 1 In the illustrated embodiment, step S30 includes: Calculate the distances between the geometric center point of the original key region and the geometric center points of the upper blank area, the lower blank area, the left blank area, and the right blank area, and use the ratio of each distance to the feature size of the original key region as the position parameter; The ratios between the areas of the upper blank area, the lower blank area, the left blank area, and the right blank area and the area of the original key area are calculated respectively, and are used as the ratio parameters.
[0056] Specifically, the geometric center points of the original key area, the upper blank area, the lower blank area, the left blank area, and the right blank area are calculated separately. For each rectangular area, its geometric center point is located at the intersection of the two diagonals of the rectangle, which is the exact center of the rectangle. By obtaining the boundary coordinates of each area, the precise horizontal and vertical positions of the center point are calculated.
[0057] Calculate the straight-line distances from the geometric center point of the original key area to the geometric center points of the other four blank areas in sequence. Specifically, the following will be calculated: The distance from the center point of the original key area to the center point of the upper blank area; The distance from the center point of the original critical area to the center point of the lower blank area; The distance from the center point of the original critical area to the center point of the left blank area; The distance from the center point of the original key area to the center point of the right blank area.
[0058] Extract a feature dimension representing the size of the original key area itself. This is typically chosen as the width or height of the area, or the average of its width and height, or the length of its diagonal. For each center point distance, compare the center point distance with the feature dimension of the original key area; specifically, divide each distance value by the feature dimension value in turn. This division operation converts the absolute distance value into a proportional value relative to the size of the key area itself. These four proportional values (corresponding to the top, bottom, left, and right directions, respectively) together constitute the positional parameters describing the key area's positional relationship within the image. These positional parameters quantify the degree of offset of the key area's center relative to the centers of the various whitespace areas.
[0059] Simultaneously, the areas of the original key area, upper blank area, lower blank area, left blank area, and right blank area are calculated in parallel. The area of each blank area is compared to the area of the original key area. Specifically, the area of the upper blank area is divided by the area of the key area to obtain a ratio; similarly, the ratios of the areas of the lower, left, and right blank areas to the area of the key area are calculated. These four ratios together constitute the proportional parameters describing the size relationship between the blank space and the main subject. They quantify the size proportion of the blank space relative to the main subject area in each direction.
[0060] based on Figure 1 In the illustrated embodiment, step S40 includes: Obtain a graph composition rule base corresponding to the target application scenario, wherein the graph composition rule base includes at least one standard graph. Calculate the positional matching degree between the positional parameter and the standard rule parameter in the composition rule library, and the proportional matching degree between the scale parameter and the standard scale parameter in the composition rule library; Based on the principle of maximum matching degree, the positional matching degree, and the proportional matching degree, the target template is determined; The target position coordinates and target scaling ratio of the original key region in the target canvas are determined based on the target template.
[0061] Specifically, the composition rule library defines a variety of standardized composition styles (such as "central composition", "rule of thirds composition", "golden ratio composition", "left-aligned composition", etc.). Each composition rule clearly specifies the standardized position of the key area in the target canvas (e.g., in the exact center of the canvas, or on the right third line) and the standardized size proportion it should have (e.g., occupying 60% of the canvas area).
[0062] The position and scale parameters obtained from the analysis of the current image are compared one by one with the "standard position" and "standard scale" specified by each composition rule in the rule base.
[0063] Calculate the position matching degree by comparing the similarity between the current position parameters (i.e., the relative distance between the key area and the center of each blank area) and the "standard position" defined by a certain composition rule. The more consistent the directional trend and the closer the distance ratio, the higher the evaluation value of the position matching degree.
[0064] Calculate the proportion matching degree by comparing the current proportion parameters (i.e., the area ratio of each blank area to the key area) with the "standard proportion" defined by the same composition rule. The more the blank area proportions in each direction match, the higher the proportion matching degree evaluation value.
[0065] After calculating the matching degree with all rules, the most suitable composition rule is selected for the current image according to the principle of maximum matching degree. Specifically, the positional matching degree and proportional matching degree of each rule are combined (for example, the two are combined to obtain an overall matching score), and the composition rule with the highest overall matching score is selected and determined as the target template to be applied to the current image.
[0066] Based on the specific rules of the target template, the precise position and size of the key area within the target canvas are calculated. According to the standardized position specified by the target template (e.g., "located in the lower right corner of the canvas"), and combined with the inherent directional characteristics implied in the position parameters of the original image (e.g., the key area is originally slightly to the lower right), the specific and unique target position coordinates of the key area within the target canvas are calculated (e.g., the position at specific pixel values from the right and bottom edges of the canvas). Based on the standardized size ratio specified by the target template (e.g., "the key area height occupies 70% of the canvas height"), and combined with the proportion parameters of the original image and the absolute pixel size of the original key area, the factor by which the original key area should be enlarged or reduced to achieve the size required by the template within the target canvas is calculated; this factor is the target scaling ratio.
[0067] based on Figure 1 In the illustrated embodiment, step S40 includes: The original key region is scaled according to the target scaling ratio to obtain a scaled key region, and the scaled key region is set at the target position coordinates on the target canvas. Determine the remaining zoomable area after the key zoom region occupies the target canvas; Identify whether there are preset decorative elements and / or preset text information in each of the original blank areas; If the original blank area contains the preset decorative elements and / or the preset text information, then the relative position of the preset decorative elements and / or the preset text information with respect to the original key area remains unchanged, and they are mapped to the scaled remaining area to generate the target graphic data; If the original blank area does not contain the preset decorative elements and / or the preset text information, then the scaled remaining area is filled with the target graphic data by using a preset image generation algorithm based on the color or texture characteristics of the original blank area.
[0068] Specifically, the image content within the original key area is scaled up or down proportionally according to the target scaling ratio to generate a scaled key area with adjusted size. This scaled image content is then placed on the target canvas at the position specified by the target position coordinates.
[0069] After locating the scaling key area, calculate all the space on the target canvas that is not occupied by the scaling key area, i.e., the scaling remaining area.
[0070] Content analysis of the original blank areas (i.e., the areas above, below, left, and right of the key area in the original image) can be performed to identify whether these areas contain predefined decorative elements (e.g., logos, icons, watermarks, border patterns) and / or predefined text information (e.g., titles, slogans, explanatory text). This can be accomplished by combining optical character recognition (OCR) technology and feature-based image matching technology.
[0071] If a pre-defined decorative element or text information is identified within one or more of the original blank areas, then for each identified element, its relative position in the original image relative to the boundary of the original key area is calculated (e.g., a logo is located at a specific distance outside the upper right corner of the key area). This relative positional relationship is then applied to the target canvas while remaining absolutely unchanged. In other words, based on the new boundary of the scaled key area, these elements are redrawn into the corresponding scaled remaining area according to the same relative position.
[0072] In a specific embodiment, based on the color or texture features of the original blank area, a preset image generation algorithm is used to fill the scaled remaining area to generate the target image and text data, including: The target white space is generated by performing a gradient fusion based on the color or texture features of the original white space adjacent to the scaled remaining area using the preset image generation algorithm. The target graphic data is generated based on the target blank area and the scaling key area.
[0073] Specifically, if the detection confirms that there are no preset decorative elements or preset text information in all the original blank areas, the main visual features of the original blank areas are extracted, such as their dominant color, color gradient trend, and texture mode (e.g., solid color, blurred background, simple texture). Based on the color or texture features obtained from the analysis, preset image generation algorithms (e.g., color filling, texture synthesis, edge-based image completion algorithms) are called to generate visually coordinated and coherent background filling content in the scaled remaining area.
[0074] In a specific embodiment, scaling the original key region according to the target scaling ratio to obtain a scaled key region, and setting the scaled key region after the target position coordinates on the target canvas, includes: If the scaling key area exceeds the boundary of the target canvas, the target position coordinates and the target scaling ratio are adaptively corrected so that the scaling key area is within the range of the target canvas.
[0075] Specifically, determining the target scaling ratio requires considering the size adaptation between the original key area and the target canvas. We can preset the original key area width to 300 pixels and the original canvas width to 600 pixels, with a width ratio of 0.5 in the scaling parameters. If the target canvas width is 800 pixels, the target key area width should be 400 pixels if scaled proportionally. However, it's necessary to check if it exceeds the boundary. If the original key area height is 200 pixels, after scaling proportionally, the height becomes 400 / 300×200=267 pixels. Combining this with the vertical position parameter, the total occupied height is 320+267+800×0.3 / 0.5×0.3=320+267+480=1067 pixels, exceeding the target canvas height.
[0076] At this point, adaptive correction is triggered, prioritizing the complete display of the target's key area. The target scaling ratio is adjusted so that the height of the key area does not exceed the maximum available height of the target canvas. The available height is 800 × (1 - 0.2 - 0.3) = 400 pixels, therefore the target scaling ratio is adjusted to 400 / 200 = 2.0 (relative to the original key area height), corresponding to a width of 300 × 2.0 = 600 pixels. The target position coordinates are recalculated to vertically center the key area of the target canvas at its original visual center position.
[0077] Please see Figure 2, Figure 2 This is a schematic block diagram of a graphic size processing system provided in an embodiment of this application. This graphic size processing system is used to execute the aforementioned graphic size processing method. The graphic size processing system can be configured on a server.
[0078] like Figure 2 As shown, the graphic size processing system includes: The user authentication and configuration module is used for user login and basic system configuration. The basic system configuration includes browser path, job output path, image processing parameters and printing device settings. The order data acquisition and processing module is used to access and log in to the management platform backend to obtain the graphic and text data to be processed. The image resource management module includes an image library management unit and an image matching and retrieval unit, which are used to bind to a centrally managed image resource library and search for and copy the corresponding image from the image resource library according to the image and text data to be processed; The core batch processing engine module includes an integrated image classification unit, image size adjustment unit, automated printing unit, order fulfillment unit, and intelligent review unit, which are used to classify and organize the image and text data to be processed, perform batch size adjustment, batch printing, and order processing. The workflow orchestration and fully automated execution module is used to execute order acquisition, image processing, and order processing according to a preset workflow. The job monitoring and results display module records the running status, operation steps and result information, and provides a unified interface to view the summary information after the batch processing task is completed.
[0079] Specifically, such as Figure 3 As shown, Figure 3 This is a schematic diagram of the application interface of a graphic size processing system provided in the embodiments of this application.
[0080] Figure 3 The graphic and text size processing system shown has the following functions, which will be introduced below in conjunction with an e-commerce platform.
[0081] I. Account and Basic Operation Module The account-related module includes three main functions: login, registration / recharge, and password reset, serving as the system's entry point. Users can log in with their account and password. New users can register and recharge using a card key, account, password, and security code. The security code is used for subsequent password retrieval, ensuring account security. This module provides authentication and access control for the entire system and is a prerequisite for enabling all automated functions.
[0082] II. Core Image and Text Batch Processing Module The core processing module is the main functional area of the system, which includes six major functions: image classification, size adjustment, image adjustment, image printing, automatic printing, and full automation, which can meet the processing needs of different scenarios.
[0083] Image categorization: Automatically retrieves orders awaiting shipment, pulls corresponding images from the product image library, and categorizes them according to rules; Resize: Supports dragging and dropping folders to batch resize images uniformly, adapting to display and printing requirements; Image Pull and Adjust: Integrates image pull and adjustment functions, allowing you to complete image acquisition and size adjustment with one click; Image Printing: Based on image processing, automatically print express waybills and complete the backend shipment. Automatic printing: Batch printing of images within a folder, suitable for printing production scenarios; Fully automated: Connects all the above processes to achieve an unattended closed loop of order acquisition, image processing, order processing and delivery, and printing.
[0084] III. Auxiliary Management and Monitoring Module The auxiliary module is used for task monitoring, intelligent review, and image library maintenance to ensure that the processing flow is standardized and efficient.
[0085] Complete the task: The results of all batch processing tasks are summarized and displayed in a unified manner for easy viewing and archiving; Intelligent approval: Automatically identifies order remarks and completes batch modification and marking of remarks; Organize the image library: Extract information from product links and generate standardized image libraries named after product codes in batches; Product Image Library: Supports drag-and-drop binding of image resource libraries, providing a unified source of materials for various image pulling and adjustment functions.
[0086] IV. System Settings Module The system settings module is responsible for global parameter configuration and is the foundation for ensuring stable operation. Users can set browser paths, job save paths, image sizes, print flipping, approval keywords, order processing and printing system parameters, etc. Here, they can add and delete configuration items, and also clear the cache and save configurations with one click, adapting to the usage environment of different e-commerce platforms and hardware devices.
[0087] It should be noted that those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the above-described apparatus and modules can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0088] The above description is merely a specific embodiment of this application, but the scope of protection of this application 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 this application, and these modifications or substitutions should all be covered within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A method for processing image and text dimensions, characterized in that, include: The original key regions are determined in the image and text data to be processed using image recognition technology; Based on the original key area, at least one original white space area is determined in the text and image data to be processed, wherein the original white space area includes an upper white space area, a lower white space area, a left white space area, and / or a right white space area; The position parameters and scale parameters are determined based on the original key areas and each of the original blank areas; The target position coordinates and target scaling ratio of the original key region in the target canvas are determined based on the position parameters and scaling parameters. Based on the target location coordinates and the target scaling ratio, the original blank areas are redistributed to generate target graphic data.
2. The graphic size processing method according to claim 1, characterized in that, The process of determining the original key regions in the image and text data to be processed using image recognition technology includes: The image and text data to be processed are classified at the pixel level using a preset deep learning semantic segmentation model to identify the foreground subject object. The preset deep learning semantic segmentation model includes the image recognition technology. Calculate the minimum bounding rectangle of the foreground subject object, and determine the minimum bounding rectangle region as the original key region.
3. The graphic size processing method according to claim 1, characterized in that, The step of determining at least one original white space area in the image and text data to be processed based on the original key area, wherein the original white space area includes an upper white space area, a lower white space area, a left white space area, and / or a right white space area, including: Subtract the pixel area occupied by the original key area from the overall canvas area of the image and text data to be processed to determine the remaining area; A connected component analysis is performed on the remaining region, and the largest connected components located above, below, to the left, and to the right of the original key region are respectively determined as the upper blank region, the lower blank region, the left blank region, and the right blank region.
4. The graphic size processing method according to claim 3, characterized in that, The step of performing connected component analysis on the remaining region, and determining the largest connected components located above, below, to the left, and to the right of the original key region as the upper blank region, the lower blank region, the left blank region, and the right blank region, respectively, includes: If there are no connected regions above, below, to the left, or to the right of the original key area, then it is determined that the original blank area does not exist.
5. The graphic size processing method according to claim 1, characterized in that, The step of determining the position parameters and scale parameters based on the original key areas and each of the original blank areas includes: Calculate the distances between the geometric center point of the original key region and the geometric center points of the upper blank area, the lower blank area, the left blank area, and the right blank area, and use the ratio of each distance to the feature size of the original key region as the position parameter; The ratios between the areas of the upper blank area, the lower blank area, the left blank area, and the right blank area and the area of the original key area are calculated respectively, and are used as the ratio parameters.
6. The graphic size processing method according to claim 1, characterized in that, Determining the target position coordinates and target scaling ratio of the original key region in the target canvas based on the position parameters and scaling parameters includes: Obtain a graph composition rule base corresponding to the target application scenario, wherein the graph composition rule base includes at least one standard graph. Calculate the positional matching degree between the positional parameter and the standard rule parameter in the composition rule library, and the proportional matching degree between the scale parameter and the standard scale parameter in the composition rule library; Based on the principle of maximum matching degree, the positional matching degree, and the proportional matching degree, the target template is determined; The target position coordinates and target scaling ratio of the original key region in the target canvas are determined based on the target template.
7. The graphic size processing method according to claim 1, characterized in that, The step of redistributing the original blank areas according to the target location coordinates and the target scaling ratio to generate target graphic data includes: The original key region is scaled according to the target scaling ratio to obtain a scaled key region, and the scaled key region is set at the target position coordinates on the target canvas. Determine the remaining zoomable area after the key zoom region occupies the target canvas; Identify whether there are preset decorative elements and / or preset text information in each of the original blank areas; If the original blank area contains the preset decorative elements and / or the preset text information, then the relative position of the preset decorative elements and / or the preset text information with respect to the original key area remains unchanged, and they are mapped to the scaled remaining area to generate the target graphic data; If the original blank area does not contain the preset decorative elements and / or the preset text information, then the scaled remaining area is filled with the target graphic data by using a preset image generation algorithm based on the color or texture characteristics of the original blank area.
8. The graphic size processing method according to claim 7, characterized in that, The step of filling the scaled remaining area with the target image and text data based on the color or texture features of the original blank area using a preset image generation algorithm includes: The target white space is generated by performing a gradient fusion based on the color or texture features of the original white space adjacent to the scaled remaining area using the preset image generation algorithm. The target graphic data is generated based on the target blank area and the scaling key area.
9. The graphic size processing method according to claim 7, characterized in that, The step of scaling the original key region according to the target scaling ratio to obtain a scaled key region, and setting the scaled key region after the target position coordinates on the target canvas, includes: If the scaling key area exceeds the boundary of the target canvas, the target position coordinates and the target scaling ratio are adaptively corrected so that the scaling key area is within the range of the target canvas.
10. A graphic size processing system, characterized in that, include: The user authentication and configuration module is used for user login and basic system configuration. The basic system configuration includes browser path, job output path, image processing parameters and printing device settings. The order data acquisition and processing module is used to access and log in to the management platform backend to obtain the graphic and text data to be processed. The image resource management module includes an image library management unit and an image matching and retrieval unit, which are used to bind to a centrally managed image resource library and search for and copy the corresponding image from the image resource library according to the image and text data to be processed; The core batch processing engine module includes an integrated image classification unit, image size adjustment unit, automated printing unit, order fulfillment unit, and intelligent review unit, which are used to classify and organize the image and text data to be processed, perform batch size adjustment, batch printing, and order processing. The workflow orchestration and fully automated execution module is used to execute order acquisition, image processing, and order processing according to a preset workflow. The job monitoring and results display module records the running status, operation steps and result information, and provides a unified interface to view the summary information after the batch processing task is completed.