Search

CN-121985078-A - Picture data processing method based on Bluetooth printing and related equipment

CN121985078ACN 121985078 ACN121985078 ACN 121985078ACN-121985078-A

Abstract

A picture data processing method and related equipment based on Bluetooth printing relate to the field of thermal printing. The processing equipment filters the Alpha channel by utilizing the transparency threshold value in the process of converting the picture into the printing instruction, eliminates black block interference generated by binarization misjudgment of the transparent background, ensures the purity of the background, further combines the equipment identification of the Bluetooth printer to determine the maximum physical width of the Bluetooth printer, and dynamically calculates the center offset to intelligently center and intercept the two-dimensional matrix. Under the condition that manual intervention is not needed, the specifications from the image sources with different sizes and transparencies to the target printer are automatically adapted, cutting loss or offset of image core content (such as Logo or two-dimensional code) is avoided, and image compatibility and output definition of Bluetooth printing of a mobile terminal are improved.

Inventors

  • LI JIANGUO
  • LIU ZIQI

Assignees

  • 北京硕方信息技术有限公司

Dates

Publication Date
20260505
Application Date
20260408

Claims (10)

  1. 1. A picture data processing method based on bluetooth printing, characterized by being applied to a picture data processing apparatus, the method comprising: Traversing a pixel matrix of a picture to be printed, and marking the current pixel point as non-printing point data if the transparency channel value of the current pixel point in the picture to be printed is not higher than a preset transparency threshold value, wherein the pixel matrix comprises RGB channel values and transparency channel values of all the pixel points; if the transparency channel value is higher than the preset transparency threshold value, calculating the gray value of the current pixel point according to the RGB channel value; Marking the current pixel point as printing point data under the condition that the gray value is smaller than a preset gray threshold value, and obtaining a two-dimensional matrix containing the printing point data and the non-printing point data; determining a center offset based on a difference between a width parameter of the two-dimensional matrix and a maximum effective printing width, the maximum effective printing width being determined based on device identification information of an associated bluetooth printer, the width parameter being determined from the printing dot data, if it is determined that the width parameter exceeds the maximum effective printing width; intercepting the two-dimensional matrix according to the center offset and the maximum effective printing width to generate target bitmap data; And generating a printing instruction stream based on the DPI resolution of the Bluetooth printer and the target bitmap data, and sending the printing instruction stream to the Bluetooth printer.
  2. 2. The method according to claim 1, wherein the step of generating a print instruction stream based on the DPI resolution of the bluetooth printer and the target bitmap data and transmitting the print instruction stream to the bluetooth printer specifically comprises: converting the target bitmap data into byte stream data through bit operation; Traversing the byte stream data, and determining target printing content and corresponding effective content height according to the distribution of byte values; Determining the height of a printing area according to the DPI resolution of the Bluetooth printer, and determining a margin parameter for enabling the target printing content to be vertically and centrally displayed on the printing area of the Bluetooth printer in combination with the effective content height; And responding to the printing request of the user, and sending a printing instruction stream containing the target printing content and the margin parameter to the Bluetooth printer.
  3. 3. The method of claim 1, wherein after the step of intercepting the two-dimensional matrix based on the center offset and the maximum effective print width to generate target bitmap data, the method further comprises: Counting the black point duty ratio of each row of pixel data in the target bitmap data; Traversing the black point duty ratio of each row of pixel data based on a sliding window, and marking a pixel data segment corresponding to a continuous preset row number as a high heat accumulation area under the condition that the black point duty ratio of the continuous preset row number is determined to exceed a preset power consumption threshold value; and executing a sparsification algorithm on the printing point data in the high heat accumulation area to obtain updated target bitmap data.
  4. 4. A method according to claim 3, wherein the step of performing a thinning algorithm on the print dot data in the high heat accumulation region comprises: Alternately selecting a first binary mask sequence and a second binary mask sequence based on row index parity of each row in the high heat accumulation region, wherein bit distribution of the first binary mask sequence and bit distribution of the second binary mask sequence are in an interleaved complementary state; And performing bitwise and operation on the byte data of the current line and the selected binary mask sequence.
  5. 5. The method according to claim 1, wherein the step of performing an interception operation on the two-dimensional matrix according to the center offset and the maximum effective printing width, and generating target bitmap data, specifically comprises: Determining a row of pixel data segments starting from the center offset corresponding index and having a length equal to the maximum effective print width in the two-dimensional matrix; Traversing the row pixel data segments, and performing byte stream conversion on the row pixel data segments to generate the target bitmap data.
  6. 6. The method of claim 1, wherein after the step of obtaining a two-dimensional matrix comprising the print dot data and the non-print dot data, the method further comprises: According to processing parameters preset by a user, under the condition that the rotation angle is not equal to zero, performing rotation transformation on the two-dimensional matrix based on the rotation angle, and updating width parameters and height parameters of the two-dimensional matrix to obtain a first middle two-dimensional array, wherein the processing parameters comprise the rotation angle, the turnover type and the offset; Under the condition that the turnover type is determined to be greater than zero, performing turnover transformation on the first middle two-dimensional array based on the turnover type to obtain a second middle two-dimensional array; and under the condition that the offset is not equal to zero, calculating the offset coordinate of each pixel point in the second middle two-dimensional array based on the offset to obtain an updated two-dimensional matrix.
  7. 7. The method of claim 1, wherein in the event that the width parameter of the two-dimensional matrix is determined to exceed a maximum effective print width, determining a center offset based on a difference between the width parameter and the maximum effective print width, the maximum effective print width being determined based on device identification information of an associated bluetooth printer, the method further comprising: determining the maximum printable point number of a row of a printing head of the Bluetooth printer according to the equipment identification information of the associated Bluetooth printer, and taking the maximum printable point number of the row as the maximum effective printing width; judging whether the width parameter of the two-dimensional matrix is larger than the maximum effective printing width; And setting the center offset to zero under the condition that the width parameter of the two-dimensional matrix is not beyond the maximum effective printing width, and taking the difference value between the maximum effective printing width and the width parameter as a complementary white parameter, wherein the complementary white parameter is used for carrying out centering complementary white processing on each line of data of the target bitmap data.
  8. 8. A picture data processing device comprising one or more processors and memory coupled to the one or more processors, the memory to store computer program code comprising computer instructions that the one or more processors invoke to cause the picture data processing device to perform the method of any of claims 1-7.
  9. 9. A computer program product containing instructions which, when run on a picture data processing device, cause the picture data processing device to perform the method of any of claims 1-7.
  10. 10. A computer readable storage medium comprising instructions which, when run on a picture data processing device, cause the picture data processing device to perform the method of any of claims 1-7.

Description

Picture data processing method based on Bluetooth printing and related equipment Technical Field The application relates to the field of thermal printing, in particular to a picture data processing method based on Bluetooth printing and related equipment. Background Along with the rapid development of the mobile internet and the internet of things technology, the portable Bluetooth thermal printer is widely applied to the scenes of logistics distribution, retail cashing, mobile law enforcement and the like due to the characteristics of small size, no limitation of cables and the like. Under these scenes, the mobile terminal device often needs to send the picture data including the Logo (Logo), the two-dimensional code or the merchandise display diagram to the printer for outputting, so as to meet the printing requirements of the electronic face sheets, shopping tickets and other vouchers. In the related art, when the mobile terminal application sends a picture print job to the bluetooth printer, the whole source picture to be printed is usually scaled to the preset size by using an image scaling algorithm (such as bilinear interpolation or nearest neighbor interpolation) based on a target print size preset by a developer when the developer writes a print program. The scaled picture is converted into dot matrix data through general graying and binarization processing, and the dot matrix data is packaged into a printing instruction and sent to a printer. However, in a scenario where a merchant uses non-standardized multi-source material for cross-device printing, different brands of bluetooth printers (there may be different widths of print paper differences) may be connected, an unmodified directly downloaded picture from a web page may be used, or a different scale of source pictures, such as Logo or activity pictures uploaded by the merchant are typically PNG pictures, which may contain transparent whites. The related art forced scaling may cause pixel loss or aliasing, and in some scenarios (e.g., printing a long bar Logo), scaling may cause the image to be highly compressed and illegible. The invalid background data is printed erroneously, and the effective content is excessively reduced (blurred) due to the inclusion of the invalid background, so that the output accuracy of printing is reduced. Disclosure of Invention The application provides a picture data processing method based on Bluetooth printing and related equipment, wherein the related equipment comprises equipment, media and program products, and is used for improving printing definition and suitability under the scenes of different specifications of printing equipment and complex source pictures. The application provides a picture data processing method based on Bluetooth printing, which is applied to picture data processing equipment and comprises the steps of traversing a pixel matrix of a picture to be printed, marking the current pixel point as non-printing point data if a transparency channel value of the current pixel point in the picture to be printed is not higher than a preset transparency threshold value, determining the current pixel point as non-printing point data based on a difference value between the width parameter and the maximum effective printing width, determining the width parameter by the Bluetooth printer based on equipment identification information of an associated Bluetooth printer if the transparency channel value is higher than the preset transparency threshold value, calculating a gray value of the current pixel point according to the RGB channel value, marking the current pixel point as printing point data to obtain a two-dimensional matrix containing the printing point data and the non-printing point data if the gray value is smaller than the preset gray threshold value, determining the width parameter of the two-dimensional matrix to exceed the maximum effective printing width, transmitting a command stream to the DPI to the Bluetooth printer based on the maximum effective printing width, and generating a bitmap, and capturing the target bit map. By adopting the technical scheme, the processing equipment filters the Alpha channel by utilizing the transparency threshold value in the process of converting the picture into the printing instruction, eliminates black block interference of the transparent background caused by binarization misjudgment, ensures the purity of the background, further combines the equipment identification of the Bluetooth printer to determine the maximum physical width of the Bluetooth printer, and dynamically calculates the center offset to intelligently center and intercept the two-dimensional matrix. Under the condition that manual intervention is not needed, the specifications from the image sources with different sizes and transparencies to the target printer are automatically adapted, cutting loss or offset of image core content (such as Logo or two-dimensional code) is avoided, an