Multi-image intelligent compression splicing method and splicing system capable of configuring column number
Through iterative quality attenuation and dynamic layout algorithms, combined with dynamic canvas synthesis technology, the problems of inflexible image adaptation and insufficient compatibility in image stitching on mobile devices are solved, efficient and flexible image stitching effects are achieved, and the user experience is improved.
Patent Information
- Application Number
- CN202510844236.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-23
- Publication Date
- 2025-10-17
AI Technical Summary
Existing image stitching technology has problems such as inflexible image size adaptation, single layout, inability to customize, degraded image quality, large storage space occupation, low processing performance, and insufficient compatibility, and cannot meet the diverse needs of mobile device users.
It adopts an intelligent compression method with iterative quality attenuation, combined with dynamic calculation of image layout and cell centering strategy, and realizes flexible stitching of multiple images through dynamic canvas synthesis technology. It supports image processing of different column numbers and sizes and is compatible with different Android versions and screen sizes.
It achieves a balance between image quality and storage space, supports flexible image layout adjustment, maintains the original aspect ratio, and improves the user experience and efficiency of image processing on mobile devices.
Smart Images

Figure CN120807276A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computer image processing, and in particular to a multi-image intelligent compression and splicing method with configurable column number and a splicing system. BACKGROUND
[0002] With the rapid development of mobile device photography technology, users' demands for image processing and display are becoming diversified and personalized. Traditional image splicing methods often have many limitations, such as inflexible image size adaptation, single layout, and inability to customize, etc. When users splice, print, or share multiple images, they often face challenges such as image quality degradation, excessive storage space occupation, and low processing performance.
[0003] Mobile device users have increasingly high requirements for image splicing, hoping to be able to:
[0004] 1. quickly and conveniently splice multiple images into a complete image;
[0005] 2. maintain the clarity and aspect ratio of the original images;
[0006] 3. freely adjust the image layout and arrangement;
[0007] 4. intelligently compress images to balance image quality and storage space;
[0008] 5. support splicing of different numbers and sizes of images.
[0009] The existing image splicing technology mainly has the following key limitations:
[0010] 1. single image splicing method, lack of flexibility;
[0011] 2. image scaling algorithm is not intelligent enough, often leading to image distortion or distortion;
[0012] 3. unable to dynamically adjust splicing parameters according to user needs;
[0013] 4. poor image quality and visual effect;
[0014] 5. poor performance when processing a large number of images;
[0015] 6. does not consider the impact of image compression on the final splicing effect;
[0016] 7. insufficient compatibility and adaptability.
[0017] These technical limitations have severely restricted the user experience of mobile device image processing, and there is an urgent need for a more intelligent and flexible image splicing solution. SUMMARY
[0018] The present application is to solve the above problems and proposes a multi-image intelligent compression splicing method and system with configurable column number, which is suitable for mobile device image processing and display, especially for image splicing scenarios of mobile terminals such as smartphones and tablet computers.
[0019] The technical solution of the present application is as follows:
[0020] A multi-image intelligent compression splicing method with configurable column number comprises the following steps:
[0021] Step one: image intelligent compression is realized by iterative quality attenuation, balancing image quality and storage space;
[0022] Step two: image layout size is dynamically calculated based on user-configured column number;
[0023] Step three: unit cell centering strategy is adopted to maintain image aspect ratio;
[0024] Step four: dynamic canvas synthesis technology is used to realize multi-image splicing.
[0025] Further, the iterative compression in step one comprises the following steps:
[0026] A. Set the initial compression quality to 100% and compress the image in JPEG format;
[0027] B. Decrease the quality by 10% each time;
[0028] C. Terminate when the compressed file size is less than or equal to the target threshold or the quality is 0;
[0029] D. Re-decode the compressed byte array into a bitmap object.
[0030] Further, the image layout size in step two comprises total width, reference size and position coordinates.
[0031] Further, the image layout calculation in step two comprises:
[0032] ①. Dynamically determine the total pixel width according to the column number, with a default width of 1200px for single-column mode, 2000px for double-column mode, and 2400px for multi-column (≥3) mode;
[0033] ②. Calculate the reference size based on the aspect ratio of the first image to ensure equal scaling of the images;
[0034] ③. Use row-first layout strategy to automatically handle line breaks and spacing.
[0035] Further, the multi-image splicing in step four includes: creating a Canvas canvas matching the total size of the layout; drawing the cell background and the image according to the layout information, ensuring accurate positioning and scaling of the image, and outputting an image containing all the images combined according to the specified layout.
[0036] A multi-image intelligent compression splicing system with configurable column number, comprising:
[0037] The compression module receives the user-selected images and the compression target size, iteratively compresses each image to the target size, and outputs the compressed images for the adaptation module to use.
[0038] The adaptation module receives the image array processed by the image compression module, the expected number of columns, the spacing, and the margin configuration, first determines the total width according to the number of columns, then calculates the reference size based on the aspect ratio of the first image, and finally allocates specific display positions and sizes for each image, outputs a layout scheme containing the position and size information of each image, and provides it to the splicing module.
[0039] The splicing module creates a target canvas with appropriate size, draws the cell background and the image according to the layout information, completes the image splicing, and outputs an image containing all the images combined according to the specified layout.
[0040] Further, it also includes a compatibility design module to adapt to different Android versions, screen sizes, and image formats, and to handle images with different aspect ratios and sizes.
[0041] Further, it also includes a user interaction module to realize image selection, parameter configuration, and result display.
[0042] By adopting the above technical scheme, the present application has the following advantages over the traditional image splicing method: intelligent image compression, balancing quality and storage space; dynamic adjustment of compression strategy according to the number of images; maintaining the original aspect ratio of the image; supporting flexible multi-column image arrangement; dynamic configuration of splicing parameters; excellent device compatibility. Through intelligent image compression preprocessing, size adaptation, flexible layout strategy, and high-performance asynchronous processing, the present application provides a new solution for mobile device image processing. This technology not only meets the growing demand of users for personalized image processing, but also has broad market prospects in practical applications, significantly improving the user experience and efficiency of mobile device image processing. BRIEF DESCRIPTION OF DRAWINGS
[0043] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings needed to be used in the embodiments or prior art description. Obviously, the drawings in the following description only constitute some embodiments of the present application, and for those skilled in the art, other drawings can also be obtained without creative labor.
[0044] Figure 1 is the image splicing flowchart of the present application;
[0045] Figure 2 is the image splicing flowchart of the present application;
[0046] Figure 3 is the dynamic canvas synthesis technical principle diagram of the present application;
[0047] Figure 4 is the system block diagram of the present application;
[0048] Figure 5 is the picture compression result schematic diagram output by the present application. DETAILED DESCRIPTION
[0049] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments only constitute some embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor fall within the scope of protection of the present application.
[0050] As shown in Figure 1 , a multi-image intelligent compression splicing method with configurable column number comprises the following steps:
[0051] Step one, realize image intelligent compression through iterative quality attenuation, balance image quality and storage space, solve the performance, efficiency and storage problem when splicing a large number of images, and avoid excessive compression distortion by iterative approximation of target size;
[0052] Step two, dynamically calculate the total pixel width required by image layout according to the column number set by the user; adaptively calculate the reference size of a single image to ensure proportional scaling; accurately calculate the position coordinates and display size of each picture; support flexible configuration of image spacing and margin parameters;
[0053] Step three, adopt cell centering strategy to maintain the aspect ratio of the image;
[0054] Step 4. Use dynamic canvas synthesis technology to create a target canvas of appropriate size, draw the cell background and image according to the layout information, generate a complete bitmap after stitching, support dynamic calculation of total height, achieve precise positioning and scaling of the image, and display the stitching results in the system, allowing users to save or share the image.
[0055] In this embodiment, step 1 adopts an iterative compression method to achieve precise control of image size by dynamically adjusting the compression quality parameter, which is specifically implemented as follows:
[0056] A. Set the initial compression quality to 100% (highest quality) and compress the image in JPEG format;
[0057] B. Reduce the compression quality by 10% each time through a loop iteration until the target file size requirement is met;
[0058] C. When the compressed image data is less than the specified threshold, or the compression quality drops to 0, the iteration process ends;
[0059] D. Decode the compressed byte array back into a bitmap object.
[0060] The above method can effectively control file size while ensuring image quality and ensure visual quality when stitching images. This iterative compression method has the characteristics of strong adaptability and high computational efficiency, and is suitable for mobile image processing scenarios.
[0061] In this embodiment, the image layout size in step 2 includes a total width, a reference size, and a position coordinate.
[0062] In this embodiment, step 2 adaptively calculates the image size based on the number of display columns to ensure that the image is scaled proportionally and has a beautiful layout, specifically including:
[0063] ①. The total pixel width is dynamically determined based on the number of columns. The default width for single-column mode is 1200px; the default width for double-column mode is 2000px; the default width for multi-column (≥3) mode is 2400px.
[0064] ②Calculate the base width: subtract margins and spacing from the total width and divide evenly;
[0065] ③. Maintain the original image aspect ratio to calculate the base height: scale proportionally based on the aspect ratio of the first image;
[0066] IV. Adopting differentiated size calculation strategy according to column mode: keep reference width in single column mode, and adapt height according to original proportion; keep original proportion in multi-column mode and display in the center of fixed cell; adopt row-first layout strategy and automatically handle line breaks; calculate display area (imageRect) and cell area (cellRect) of each picture; ensure layout specification by accumulating spacing and margin.
[0067] Reference size calculation:
[0068] Reference width = (total width - column spacing - margin * 2) / number of columns;
[0069] Reference height = first picture height * reference width / first picture width;
[0070] Through the above algorithm, single column and multi-column layout can be uniformly processed, and seamless switching of layout mode can be realized. While maintaining the original aspect ratio of the picture, adaptive layout is achieved, and through the cell mechanism, accurate control of picture alignment and spacing is ensured, flexible configuration of margin and spacing parameters is supported, and layout flexibility is improved.
[0071] The algorithm uses the Canvas drawing mechanism to realize image splicing, and through accurate position calculation and drawing control, the professionalism of the splicing effect is ensured. The algorithm first creates a target canvas with appropriate size according to the layout information, sets a uniform white background, and then decides whether to enable the cell background drawing function according to the number of columns. In the image drawing stage, the algorithm traverses all input pictures, combines the pre-calculated layout information (DrawInfo), and scales each picture to the target size and accurately draws it to the specified position.
[0072] As shown in Figure 2 , the multi-picture splicing in step four includes: creating a Canvas canvas matching the total size of the layout; drawing the cell background and image according to the layout information, ensuring accurate positioning and scaling of the image, supporting cell background color configuration and drawing, ensuring the clarity and visual coherence of the spliced image, and outputting an image containing all pictures combined according to the specified layout.
[0073] As shown in Figure 3 , the dynamic canvas synthesis technology is based on the Canvas drawing system of the Android platform, and realizes accurate splicing of multiple images through intelligent canvas management and efficient rendering mechanism. This technology contains two core processing stages:
[0074] 1. Intelligent canvas initialization:
[0075] 1.1. Dynamic size calculation: the system calculates the total height of the canvas in real time according to the cell position data provided by the layout module. By traversing the bottom coordinates of all cells, the maximum value is taken and the bottom margin is added to ensure that the canvas size accurately fits the image content.
[0076] 1.2, Bitmap configuration optimization: intelligently select bitmap storage format according to whether the final composite image requires a transparent channel. When no transparency support is required, use RGB_565 format to reduce memory usage by 50%.
[0077] 1.3, Canvas binding mechanism: immediately bind to the Canvas drawing surface after creating the target bitmap, establishing the basic environment for drawing operations.
[0078] 2, Layered drawing engine:
[0079] 2.1, Background layer processing: first fill the entire canvas with a single color as the base background layer, defaulting to white but supporting custom color configuration.
[0080] 2.2, Cell layer drawing: in multi-column layout mode, draw a rectangular background for each image cell. Through precise calculation of position coordinates and size parameters, achieve visual separation effect.
[0081] 2.3, Image layer synthesis: the core processing stage, draw the compressed and size-adapted images according to the predetermined position. Use rectangular area precise positioning technology to ensure that the image is displayed completely in the target area.
[0082] 2.4, Decoration layer superposition: optional extension layer, supports adding text watermark, vector graphics and other additional elements, through independent drawing commands to realize without affecting the main image synthesis.
[0083] As shown in Figure 4 A configurable number of columns of multi-image intelligent compression splicing system, comprising:
[0084] Compression module: receives user-selected images (Bitmap objects) and compression target size (maxSize), iteratively compresses each image to the target size, and outputs the compressed image (Bitmap object) for the adaptation module to use;
[0085] Adaptation module: receives the image array processed by the image compression module, the expected number of columns, the spacing and margin configuration, first determines the overall width based on the number of columns, then calculates the reference size based on the aspect ratio of the first picture, and finally allocates specific display positions and sizes for each picture, outputs the layout scheme containing the position and size information of each picture, for the splicing module to use;
[0086] Splicing module: original picture array, layout information (DrawInfo list), total width, margin, spacing configuration, cell background color, create a target canvas of appropriate size, set the background and brush, draw the cell background according to the layout information, draw the images one by one, complete the picture splicing, and output the image containing all the pictures combined according to the specified layout (a single Bitmap object after splicing is completed).
[0087] As another preferred embodiment of the present application, it further includes a compatibility design module for adapting different Android versions, adapting different screen sizes and resolutions, being compatible with various image formats, realizing the processing of images with different aspect ratios and sizes, intelligent compression to improve performance, and good performance on low-end models.
[0088] As another preferred embodiment of the present application, it further includes a user interaction module for realizing image selection, parameter configuration and result display. The user interaction process includes the following steps:
[0089] 1. Select images: the user selects multiple images from the album or camera through the "image selection button";
[0090] 2. Configure parameters: the user configures the splicing parameters such as the number of columns, spacing, margin and background color through the interface elements;
[0091] 3. Start splicing: the user clicks the "start splicing" button, and the system starts the image compression, adaptation and splicing process.
[0092] 4. Show results: after splicing is completed, the system displays the spliced image, and the user can save or share it.
[0093] The splicing effect of 9 images is shown in Figure 5 .
[0094] The above splicing system provides a good experience for users, is suitable for social sharing, electronic album, product display and other scenarios, and can meet the growing personalized image processing needs of mobile device users.
[0095] The above only describes the preferred embodiments of the present application and is not intended to limit the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principles of the present application shall be included in the protection scope of the present application.
Claims
1. A multi-image intelligent compression and splicing method with configurable column numbers, characterized by: The following steps are involved: Step 1: Intelligent image compression is achieved through iterative quality attenuation to balance image quality and storage space; Step 2: Dynamically calculate the image layout size based on the number of columns configured by the user; Step 3: Use cell centering strategy to maintain the image aspect ratio; Step 4: Use dynamic canvas synthesis technology to achieve multi-image stitching.
2. The method for intelligent compression and splicing of multiple images with configurable column numbers according to claim 1, characterized in that: The iterative compression in step 1 includes the following steps: A. Set the initial compression quality to 100% and compress the image in JPEG format; B. The mass decreases by 10% each cycle; C. Terminate when the compressed file size is less than or equal to the target threshold or the quality is equal to 0; D. Decode the compressed byte array back into a bitmap object.
3. The method for intelligent compression and splicing of multiple images with configurable column numbers according to claim 1, characterized in that: The image layout size in step 2 includes total width, reference size and position coordinates.
4. The method for intelligent compression and splicing of multiple images with configurable column numbers according to claim 1, characterized in that: The image layout calculation in step 2 includes: ①. The total pixel width is dynamically determined according to the number of columns. The default width of single-column mode is 1200px; the default width of double-column mode is 2000px; the default width of multi-column mode is 2400px; ② Calculate the base size based on the aspect ratio of the first image to ensure that the images are scaled proportionally; ③. Use row-first layout strategy to automatically handle line breaks and spacing.
5. The method for intelligent compression and splicing of multiple images with configurable column numbers according to claim 1, characterized in that: The multi-image stitching in step 4 includes: creating a Canvas canvas that matches the total size of the layout; drawing the cell background and image according to the layout information, ensuring accurate positioning and scaling of the image, and outputting an image containing all the images combined according to the specified layout.
6. A multi-image intelligent compression and splicing system with configurable column numbers, characterized by: include: Compression module: receives the image and compression target size selected by the user, iteratively compresses the images one by one to the target size, and outputs the compressed images for use by the adaptation module; Adaptation module: Receives the image array processed by the image compression module, the desired number of columns, spacing, and margin configuration, first determines the overall width based on the number of columns, then calculates the reference size based on the aspect ratio of the first image, and finally assigns a specific display position and size to each image. Outputs a layout plan containing the position and size information of each image for use by the stitching module; Stitching module: Creates a target canvas of appropriate size, draws cell backgrounds and images according to layout information, completes image stitching, and outputs an image containing all images combined according to the specified layout.
7. The method for intelligent compression and splicing of multiple images with configurable column numbers according to claim 6, characterized in that: It also includes a compatibility design module for adapting to different Android versions, screen sizes, and image formats, and for processing images of different aspect ratios and sizes.
8. The method for intelligent compression and splicing of multiple images with configurable column numbers according to claim 6, characterized in that: It also includes a user interaction module for image selection, parameter configuration and result display.
Citation Information
Cited By
A method and related apparatus for displaying an image list
CN122547257A