IMAGE PROCESSING PROGRAM, IMAGE PROCESSING APPARATUS, AND IMAGE PROCESSING METHOD
By performing a series of calculations and updates in the barcode processing, we ensure that the reduced barcode meets the minimum module width requirements of the barcode standard, solving the problem of degradation in barcode quality and improving the quality of barcodes.
Patent Information
- Application Number
- JP2020202685
- Authority / Receiving Office
- JP · JP
- Patent Type
- Patents
- Current Assignee / Owner
- Filing Date
- 2020-12-07
- Publication Date
- 2025-03-18
- Estimated Expiration
- 2040-12-07
AI Technical Summary
When reducing barcodes, the prior art fails to effectively ensure that the reduced minimum width is an integer multiple specified by the barcode standard, resulting in a decrease in barcode quality.
By executing run length calculation, minimum module calculation, ratio calculation, magnification setting, run length update and barcode generation, the reduced barcode meets the minimum module width requirements of the barcode standard.
The quality of the barcode is improved to ensure that the reduced barcode meets the barcode standards and avoid the problem of degradation in barcode quality.
Smart Images

Figure 0007647076000001 
Figure 0007647076000002 
Figure 0007647076000003
Abstract
Description
[Technical field]
[0001] The present disclosure relates to techniques for processing image data representing barcodes. [Background technology]
[0002] Patent Document 1 describes an image processing device that reduces an image including a barcode configured by arranging a plurality of bars and a plurality of spaces alternately, and generates reduced image data representing the reduced image. [Prior art documents] [Patent documents]
[0003] [Patent Document 1] JP 2019-180046 A Summary of the Invention [Problem to be solved by the invention]
[0004] In order to minimize the deterioration of the quality of the barcode after reduction by reducing the barcode, the reduction ratio of the barcode is set so that the minimum width of the bars and spaces after reduction is an integer fraction of the minimum width before reduction. However, since the reduction ratio is calculated without checking whether the minimum width of the bars and spaces after reduction is appropriate for the specifications defined by the barcode standard, the calculated reduction ratio may not be appropriate. In this case, the quality of the barcode after reduction is degraded.
[0005] The present disclosure aims to improve the quality of barcodes. [Means for solving the problem]
[0006] One aspect of the present disclosure is an image processing program executable by the control unit in an image processing device having a printing unit and a control unit, and configured to cause the control unit to execute a run length calculation process, a minimum module calculation process, a ratio calculation process, a magnification setting process, a run length update process, and a barcode generation process.
[0007] The printing unit is configured to print an image on a print medium. The control unit is configured to control the printing unit. The run length calculation process calculates multiple run length values indicating the lengths along the arrangement direction of each of the multiple bars and multiple spaces in the barcode, based on image data including a barcode image showing a barcode represented by multiple bars and multiple spaces arranged alternately along a predetermined arrangement direction.
[0008] The minimum module calculation process calculates the minimum run length value whose ratio to the maximum run length value satisfies the bar code specification preset for the bar code as the minimum module width. A module is each of the bars and spaces that make up the bar code. The maximum run length value is the largest run length value among the run length values in the modules other than the modules that make up the quiet zone.
[0009] The ratio calculation process calculates, for each of the multiple run length values calculated by the run length calculation process, a ratio to the minimum module width calculated by the minimum module calculation process as a minimum run length ratio.
[0010] The magnification setting process sets, as an update magnification, the largest candidate magnification among multiple candidate magnifications, which is the maximum candidate magnification that results in a candidate barcode size obtained by multiplying the minimum barcode size by the candidate magnification being equal to or smaller than the length along the arrangement direction of the arrangement possible area in which the barcode is to be placed.The minimum barcode is a barcode whose multiple run length values are the multiple minimum run length ratios calculated in the ratio calculation process.The minimum barcode size is the length along the arrangement direction of the minimum barcode.The candidate magnification is a magnification having a positive integer value.
[0011] The run-length update process multiplies each of the minimum run-length ratios calculated in the ratio calculation process by an update magnification to obtain a plurality of updated run-length values. The barcode generation process generates a barcode based on the plurality of updated runlength values.
[0012] The image processing program of the present disclosure thus configured calculates the minimum run-length value whose ratio to the maximum run-length value satisfies the barcode specifications as the minimum module width.The image processing program of the present disclosure then generates a barcode by multiplying a minimum barcode having multiple run-length values that are the multiple minimum run-length ratios calculated based on the minimum module width by the maximum magnification that fits within the arrangement possible area.
[0013] This allows the image processing program of the present disclosure to reconstruct the barcode so that it meets the barcode specifications, thereby improving the quality of the generated barcode. Another aspect of the present disclosure is an image processing device having a printing unit and a control unit, wherein the control unit is configured to execute a run length calculation process, a minimum module calculation process, a ratio calculation process, a magnification setting process, a run length update process, and a barcode generation process.
[0014] The image processing device of the present disclosure configured in this manner is a device controlled by the image processing program of the present disclosure, and can obtain the same effects as the image processing program of the present disclosure. The image processing method disclosed herein is an image processing method executed by an image processing device equipped with a printing unit and a control unit, and includes a run length calculation step, a minimum module calculation step, a ratio calculation step, a magnification setting step, a run length update step, and a barcode generation step.
[0015] The image processing method of the present disclosure is a method executed by the image processing program of the present disclosure, and by executing the method, it is possible to obtain the same effect as the image processing program of the present disclosure. [Brief description of the drawings]
[0016] [Figure 1] FIG. 2 is a block diagram showing the configuration of a printer. [Diagram 2] FIG. 2 is a diagram showing the structure of a barcode. [Diagram 3] FIG. 13 is a diagram showing a shipping label. [Figure 4] 13 is a flowchart showing a shipping label reduction process. [Diagram 5] 13 is a flowchart showing a reconstruction process. [Figure 6] A diagram showing barcode run length information, symbol structure and data. [Figure 7] FIG. 13 is a diagram showing minimum run length information of a barcode. [Figure 8] 13 is a diagram showing run length information when the post-reduction minimum module candidate value is 2. FIG. [Figure 9] 13 is a diagram showing run length information when the post-reduction minimum module candidate value is 3. FIG. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS
[0017] Hereinafter, embodiments of the present disclosure will be described with reference to the drawings. (1) Printer 1 Configuration The printer 1 of this embodiment is a label printer that prints images on labels, and includes a control unit 11, a display unit 12, an input unit 13, a communication unit 14, and a printing unit 15, as shown in FIG.
[0018] The control unit 11 includes a CPU 21 and a memory 22. The CPU 21 executes programs stored in the memory 22, thereby implementing various functions of the printer 1. Note that the various functions implemented by the control unit 11 are not limited to being implemented by executing programs, and may be implemented partially or entirely using one or more pieces of hardware. The memory 22 includes a semiconductor memory (e.g., ROM, RAM, and flash memory) that is a non-transient tangible recording medium, and stores programs and data.
[0019] The display unit 12 includes a display device (not shown) and displays various images on the display device. The input unit 13 includes switches arranged around the periphery of the display screen of the display unit 12. The input unit 13 outputs input operation information for identifying an input operation performed by a user via the switch.
[0020] The communication unit 14 performs data communication by wired communication using a LAN, wireless communication using a LAN, wired communication using a USB, or short-range wireless communication in accordance with the Bluetooth standard. LAN is an abbreviation for Local Area Network. USB is an abbreviation for Universal Serial Bus. Bluetooth is a registered trademark.
[0021] Printing unit 15 has a thermal printing mechanism and can print images on thermal roll paper of a predetermined width (e.g., 4 inches). Note that printing unit 15 may be configured to be capable of printing on cut paper, or may be configured to be capable of printing using a well-known recording method other than the thermal method (e.g., inkjet method).
[0022] (2) Barcode structure The barcode used in this embodiment is a barcode created according to the specifications defined in Code 128, one of the barcode standards. The barcode is configured by arranging, from the left, a quiet zone QZ1, a start character STC, first, second, third, fourth and fifth data characters DC1, DC2, DC3, DC4 and DC5, a symbol check character SC, a stop character SPC and a quiet zone QZ2 along the barcode arrangement direction BD, for example, as shown in Fig. 2.
[0023] The start character STC, the first to fifth data characters DC1 to DC5, and the symbol check character SC are composed of three bars and three spaces arranged alternately. The stop character SPC is composed of four bars and three spaces arranged alternately. A bar is a module with low reflectivity. A space is a module with high reflectivity. A module is a single bar or space. A symbol character is a representation of numbers, letters, and symbols using bars and spaces, etc.
[0024] In Code128, there are four widths of bars and spaces: 1 module width, 2 module width, 3 module width, and 4 module width. 1 module width is the narrowest width of the bars and spaces that make up the barcode. 2 module width is twice as wide as 1 module width. 3 module width is three times as wide as 1 module width. 4 module width is four times as wide as 1 module width.
[0025] The symbol character is represented by alternating three bars and three spaces. Note that the widths of the three bars and three spaces are set so that the total width of the three bars and three spaces is 11 modules wide.
[0026] Quiet zones QZ1 and QZ2 are blank spaces with a width of either 10 times the minimum module width or 2.54 mm, whichever is larger. The minimum module width is 0.191 mm. If the output resolution of printer 1 is 200 dpi, the minimum module width corresponds to 2 pixels, and if the output resolution of printer 1 is 300 dpi, the minimum module width corresponds to 3 pixels.
[0027] The start character STC is a character placed immediately before the data characters and indicates the beginning of the data. The start character STC is set to one of three code sets, "CODE A," "CODE B," or "CODE C," which indicates the character set used in the barcode.
[0028] The first to fifth data characters DC1 to DC5 are symbol characters that represent data. The symbol check character SC contains data for checking whether the bar code data is correct.
[0029] The stop character SPC is a character that is placed immediately after the symbol check character SC and indicates the end of the data. The stop character SPC is represented by alternating four bars and three spaces. Note that the width of the four bars and three spaces in the stop character SPC is set so that the total width of the four bars and three spaces is 13 modules wide.
[0030] (3) Processing Executed on Printer 1 The printer 1 executes a shipping label reduction process in order to reduce and print the shipping label.
[0031] The shipping label is affixed to a delivery box containing a product when the delivery box is delivered to a sales agent. The shipping label is a sheet of a specified size (e.g., A4 size) on which certain information necessary for delivery to the sales agent is written. The seller can obtain the shipping label data file by downloading it from the sales agent's website, etc. The seller creates a shipping label by printing the shipping label data file on printer 1, and affixes the created shipping label to the delivery box.
[0032] The width of the print medium used in the printer 1 is, for example, 4 inches, so when printing a data file for an A4-sized shipping label, for example, the shipping label must be reduced in size so that it fits on the print medium.
[0033] As shown in Fig. 3, the shipping label includes a rectangular first barcode arrangement area R1 in which the first barcode BC1 is arranged, a rectangular second barcode arrangement area R2 in which the second barcode BC2 is arranged, and an information writing area R3 in which letters and numbers indicating the delivery destination of the delivery box are written. In other words, the information writing area R3 is the area excluding the first barcode arrangement area R1 and the second barcode arrangement area R2 from the entire area constituting the shipping label. The first barcode BC1 is arranged approximately in the center of the first barcode arrangement area R1. The second barcode BC2 is arranged approximately in the center of the second barcode arrangement area R2.
[0034] Next, there will be described the procedure of the shipping label reduction process executed by the CPU 21 of the printer 1. The shipping label reduction process is a process that is started after an input operation for printing a data file of a shipping label is performed on the input unit 13.
[0035] When the shipping label reduction process is executed, the CPU 21 first executes a process of rotating the input image based on the barcode in S10, as shown in Fig. 4. The input image is an image of the shipping label represented by the data file specified as the print target in the input operation that caused the shipping label reduction process to be started. Specifically, the CPU 21 rotates the input image in S10 so that the barcode arrangement direction BD of the barcode included in the input image is perpendicular to the transport direction in which the printer 1 transports the print medium when printing.
[0036] Furthermore, the CPU 21 performs a binarization process on the image data of the shipping label in S20. Specifically, the CPU 21 converts the image data of the shipping label into binary data of black (i.e., dots are formed) and white (i.e., dots are not formed).
[0037] Then, in S30, the CPU 21 searches for a barcode placement area in the image data of the shipping label. The barcode placement area is a rectangular area set for each barcode included in the shipping label, and the largest area that does not contain black binary data other than the corresponding barcode is set. For example, the area R11 shown by the dashed line in Fig. 3 is the barcode placement area for the first barcode BC1, and the area R12 shown by the dashed line in Fig. 3 is the barcode placement area for the second barcode BC2.
[0038] Next, as shown in Fig. 4, CPU21 resizes the barcode placement area and sets the barcode placement area in S40. Specifically, when there are multiple barcode placement areas, CPU21 adjusts the sizes of the multiple barcode placement areas so that the multiple barcode placement areas do not overlap each other, and sets the adjusted barcode placement area as the barcode placement area. The first barcode placement area R1 in Fig. 3 is the area after adjusting the barcode placement area R11, and the second barcode placement area R2 in Fig. 3 is the area after adjusting the barcode placement area R12.
[0039] Furthermore, as shown in FIG. 4, in S50, the CPU 21 calculates a reduction ratio of the shipping label based on the width of the shipping label and the width of the print medium so that the shipping label will fit within the print medium.
[0040] Then, in S60, CPU 21 determines whether or not reduction is necessary based on the reduction ratio calculated in S50. Specifically, CPU 21 determines that reduction is necessary when the reduction ratio calculated in S50 is less than 100%, and determines that reduction is not necessary when the reduction ratio is 100% or more.
[0041] Here, if reduction is not required, CPU 21 sets the input image after the processing of S10 as the output image in S70, and ends the shipping label reduction processing. Note that "the input image after the processing of S10" refers to the input image after rotation if the input image was rotated in S10, and refers to the unrotated input image if the input image was not rotated in S10.
[0042] On the other hand, if reduction is necessary, CPU 21 separates the barcode from the background in the input image in S80. The background is the part of the input image other than the barcode. Then, in S90, the CPU 21 determines whether or not there is a barcode (hereinafter, an unprocessed barcode) that has not been subjected to the processes in S100 to S140 described later, among the barcodes separated in S80.
[0043] Here, if there is no unprocessed barcode, the CPU 21 proceeds to S150. On the other hand, if there is an unprocessed barcode, the CPU 21 selects one unprocessed barcode in S100.
[0044] Then, in S110, CPU 21 determines whether the area of the barcode selected in S100 is larger than the corresponding reduced barcode arrangement area. Specifically, CPU 21 first generates a reduced barcode arrangement area by reducing the barcode arrangement area corresponding to the barcode selected in S100 by the reduction ratio calculated in S50. CPU 21 then determines whether the area of the barcode selected in S100 is larger than the reduced barcode arrangement area generated.
[0045] If the barcode area is larger than the reduced barcode arrangement area, the CPU 21 executes a reconstruction process in S120 to reduce and reconstruct the barcode selected in S100. The detailed procedure of the reconstruction process will be described later.
[0046] Furthermore, in S130, the CPU 21 adjusts the position of the barcode reconstructed in S120 within the reduced barcode arrangement area so that the arrangement of the barcode reconstructed in S120 does not look different before and after reduction, and then proceeds to S90.
[0047] Also, in S110, if the barcode area is not larger than the reduced barcode placement area, the CPU 21 adjusts, in S140, the position of the barcode selected in S100 within the reduced barcode placement area so that the placement of the barcode selected in S100 does not look different before and after reduction, and then proceeds to S90.
[0048] Then, in S150, the CPU 21 reduces the background image showing the background separated in S80 at the reduction ratio calculated in S50 to generate a reduced background image. Furthermore, in S160, the CPU 21 executes a merge process for merging the barcode separated in S80 with the reduced background image generated in S150.
[0049] In the merge process, specifically, the CPU 21 first determines whether or not the reconstruction process has been performed for each barcode separated in S80. If the reconstruction process has been performed, the CPU 21 places the barcode after the reconstruction process in the corresponding reduced barcode arrangement area in the reduced background image at the position adjusted in S130. On the other hand, if the reconstruction process has not been performed, the CPU 21 places the barcode separated in S80 as it is in the corresponding reduced barcode arrangement area in the reduced background image at the position adjusted in S140. Then, when the arrangement of all barcodes in the reduced background image is completed, the CPU 21 sets the reduced background image in which all barcodes are arranged as the output image, and ends the merge process.
[0050] When the merging process is completed, the CPU 21 ends the shipping label reduction process. Next, the procedure of the reconstruction process executed in S120 will be described. When the reconstruction process is executed, the CPU 21 first creates run-length information of the barcode image selected in S100 in S210, as shown in FIG.
[0051] As shown in Fig. 6, the run length information is formed by arranging a plurality of run length values indicating the lengths of the bars and spaces constituting the barcode along the barcode arrangement direction BD in order from the left along the barcode arrangement direction BD. That is, the run length values are arranged in the order of quiet zone QZ1, start character STC, first to fifth data characters DC1 to DC5, symbol check character SC, stop character SPC, and quiet zone QZ2. However, the first value in the run length information is 0. The run length information in Fig. 6 is "0, 70, 15, 8, 7, 15, 8, 30, . . . . , 15, 22, 23, 7, 8, 7, 15, 71". Note that the run length value in this embodiment is expressed in terms of the number of pixels.
[0052] Next, in S220, the CPU 21 acquires the maximum and minimum values from among the multiple run-length values constituting the run-length information created in S210, as shown in Fig. 5. However, the CPU 21 acquires the maximum and minimum values from among the run-length values other than the run-length values of the quiet zones QZ1 and QZ2. In the run-length information shown in Fig. 6, the maximum value is 30 and the minimum value is 6. Furthermore, in S220, the CPU 21 sets the acquired minimum value as the minimum module candidate value.
[0053] Then, in S230, the CPU 21 determines whether the quotient obtained by dividing the maximum value by the minimum module candidate value is equal to or less than 4. If the quotient is greater than 4, in S240, the CPU 21 adds 1 to the minimum module candidate value to set the new minimum module candidate value, and proceeds to S230.
[0054] On the other hand, if the quotient is 4 or less, the CPU 21 sets the minimum module candidate value as the minimum module width in S250. For example, in the run-length information shown in FIG. 6, the maximum value is 30 and the minimum value (i.e., the minimum module candidate value) is 6. In this case, the above quotient is 5. Therefore, if the minimum module candidate value is 6, this minimum module candidate value is inappropriate as the minimum module width.
[0055] Then, the new minimum module candidate value obtained by adding 1 to the minimum module candidate value is 7. In this case, the above quotient is 4. Therefore, this minimum module candidate value (i.e., 7) is appropriate as the minimum module width.
[0056] Next, in S260, the CPU 21 converts the run-length information into minimum run-length information. Specifically, for each of the multiple run-length values constituting the run-length information, the CPU 21 divides the run-length value by the minimum module value, rounds off the resulting quotient to the first decimal place, and sets the result as the minimum run-length ratio. The CPU 21 creates the minimum run-length information by arranging the multiple minimum run-length ratios in the same array as the run-length information.
[0057] For example, the run-length values constituting the run-length information in Fig. 6 are "0, 70, 15, 8, 7, 15, 8, 30, . . . , 15, 22, 23, 7, 8, 7, 15, 71". By dividing these run-length values by 7, which is the minimum module width, "0, 10.0, 2.1, 1.1, 1.0, 2.1, 1.1, 4.2, . . . , 2.1, 3.1, 3.2, 1.0, 1, 1.1.0, 2.1, 10.1" is obtained. Then, by rounding these values to the first decimal place, minimum run-length information composed of a plurality of minimum run-length ratios, "0, 10, 2, 1, 1, 2, 1, 4, . . . , 2, 3, 3, 1, 1.1, 2, 10", is created as shown in Fig. 7.
[0058] Next, the CPU 21 determines whether the output resolution of the printer 1 is 300 dpi or not in S270, as shown in Fig. 5. If the output resolution is 300 dpi, the CPU 21 sets the post-reduction minimum module candidate value to 3 [pixels] in S280, and proceeds to S300. On the other hand, if the output resolution is not 300 dpi, the CPU 21 determines that the output resolution is 200 dpi, and sets the post-reduction minimum module candidate value to 2 [pixels] in S290, and proceeds to S300.
[0059] When the process proceeds to S300, the CPU 21 calculates the reduced barcode size based on the minimum runlength information and the reduced minimum module candidate value, and proceeds to S310. Specifically, the CPU 21 calculates the reduced barcode size by multiplying the sum of the multiple minimum runlength ratios constituting the minimum runlength information by the reduced minimum module candidate value.
[0060] For example, the sum of the minimum run length information shown in Fig. 7 is "110", as shown by "SUM" in Fig. 7. The reduced barcode size calculated by multiplying this sum (i.e., "110") by "2" as the reduced minimum module candidate value is "220". The reduced barcode size calculated by multiplying this sum (i.e., "110") by "3" as the reduced minimum module candidate value is "330".
[0061] In S310, the CPU 21 determines whether the reduced barcode size calculated in S300 is equal to or smaller than the width of the area in which the barcode selected in S100 can be arranged (hereinafter, the arrangement area width).
[0062] For example, assume that the width of the area where a barcode can be placed is 269 pixels, and the height of the area where a barcode can be placed is 114 pixels. In this case, the reduced barcode size calculated from the minimum run length information shown in Fig. 7 and the reduced minimum module candidate value of "2" is "220" as shown by "SUM" in Fig. 8. Therefore, this reduced barcode size (i.e., "220") is shorter than the arrangement possible area width (i.e., "269").
[0063] On the other hand, the reduced barcode size calculated from the minimum run length information shown in Fig. 7 and the reduced minimum module candidate value of "3" is "330" as shown by "SUM" in Fig. 9. Therefore, this reduced barcode size (i.e., "330") is longer than the arrangement possible area width (i.e., "269").
[0064] Here, if the reduced barcode size is equal to or smaller than the arrangement possible area width, the CPU 21 sets the current reduced minimum module candidate value as the reduced minimum module determination value in S320 as shown in FIG.
[0065] Furthermore, in S330, the CPU 21 adds 1 to the current post-reduction minimum module candidate value to set the new post-reduction minimum module candidate value, and proceeds to S300. On the other hand, if the reduced barcode size is longer than the arrangement possible area width, the CPU 21 creates updated run-length information in S340. Specifically, the CPU 21 multiplies each of the plurality of run-length values constituting the minimum run-length information by the reduced minimum module determination value to obtain a multiplied value as an updated run-length value, and creates the updated run-length information by arranging the plurality of updated run-length values in the same array as the run-length information.
[0066] FIG. 8 shows updated run-length information created by multiplying the minimum run-length information shown in FIG. 7 by the reduced minimum module candidate value, which is "2." FIG. 9 shows updated run-length information created by multiplying the minimum run-length information shown in FIG. 7 by the reduced minimum module candidate value, which is "3."
[0067] Next, in S350, the CPU 21 creates a binary image of a barcode corresponding to the updated run-length information based on the updated run-length information created in S340, as shown in FIG. 5, and ends the reconstruction process.
[0068] (4) Effects The printer 1 thus configured includes a printing unit 15 and a control unit 11. The printing unit 15 prints an image on a print medium. The control unit 11 controls the printing unit 15.
[0069] Then, the control unit 11 calculates multiple run length values indicating the length along the barcode arrangement direction BD of each of the multiple bars and multiple spaces in the barcode, based on image data including a barcode image showing a barcode represented by multiple bars and multiple spaces arranged alternately along the barcode arrangement direction BD.
[0070] The control unit 11 calculates the minimum run length value whose ratio to the maximum run length value satisfies the specifications defined in Code128, one of the barcode standards, as the minimum module width. The maximum run length value is the largest run length value among the multiple run length values in the multiple modules other than the modules that make up the quiet zones QZ1 and QZ2. Therefore, the maximum run length value is selected from the multiple modules that make up the start character STC, the first to fifth data characters DC1 to DC5, the symbol check character SC, and the stop character SPC.
[0071] The control unit 11 calculates, for each of the calculated run length values, a ratio to the calculated minimum module width as a minimum run length ratio. The control unit 11 sets the largest reduced minimum module candidate value among the multiple reduced minimum module candidate values, which is the reduced barcode size obtained by multiplying the minimum barcode size by the reduced minimum module candidate value, to be equal to or smaller than the length along the barcode arrangement direction BD of the arrangement possible area in which the barcode is arranged, as the reduced minimum module determination value. The minimum barcode is a barcode with the calculated multiple minimum run length ratios as multiple run length values. The minimum barcode size is the length along the barcode arrangement direction BD of the minimum barcode. The reduced minimum module candidate value is a magnification having a positive integer value.
[0072] The control unit 11 multiplies each of the calculated minimum run length ratios by the reduced minimum module determination value to obtain a plurality of updated run length values. The control unit 11 generates a barcode based on the multiple updated run-length values.
[0073] In this way, the printer 1 calculates the minimum run length value whose ratio to the maximum run length value satisfies the barcode specifications as the minimum module width.The printer 1 then generates a barcode by multiplying the minimum barcode, which has multiple run length values that are the multiple minimum run length ratios calculated based on the minimum module width, by the maximum magnification that fits within the layout possible area (i.e., the minimum module determination value after reduction).
[0074] This allows the printer 1 to reconstruct the barcode so that it meets the barcode specifications, thereby improving the quality of the generated barcode. Furthermore, the control unit 11 increases the minimum value of the reduced-size minimum module determination value as the output resolution increases according to the output resolution of the printing unit 15. This allows the printer 1 to determine the reduced-size minimum module determination value by excluding in advance reduced-size minimum module candidate values that cannot be used as candidates according to the output resolution, thereby reducing the processing load of the control unit 11.
[0075] (5) Application to GS1-128 GS1-128 is a standard that uses Code 128. That is, in GS1-128, a symbol character is expressed by alternating three bars and three spaces, similar to Code 128, and the widths of the bars and spaces are of four types: 1 module width, 2 module width, 3 module width, and 4 module width. Therefore, the present disclosure is also applicable to GS1-128.
[0076] (6) Application to ITF, CODE39, and CODABAR (NW-7) (6-1) About ITF ITF is a standard that represents two characters with five bars and five spaces. Of the five bars, two are thick bars and three are thin bars. Of the five spaces, two are thick spaces and three are thin spaces. Hereinafter, thick bars and thick spaces are collectively referred to as thick modules, and thin bars and thin spaces are collectively referred to as thin modules.
[0077] The basic module width is 1.016 mm. The basic module width corresponds to 8 pixels when the output resolution of the printer 1 is 200 dpi, and corresponds to 12 pixels when the output resolution of the printer 1 is 300 dpi. The module width is permitted to be 0.25 to 1.2 times the basic module width. In other words, the minimum module width is 2 pixels at 200 dpi and 3 pixels at 300 dpi, just like Code128.
[0078] The ratio of thin modules to thick modules is "1:2.0 to 3.0." The quiet zone is "minimum module width x 10". (6-2) About CODE39 CODE39 is a standard that uses nine bars and spaces to represent one character. CODE39 has two types of bars with different thicknesses (i.e., thick bars and thin bars) and two types of spaces with different thicknesses (i.e., thick spaces and thin spaces). The thin module width is 0.191 mm or more.
[0079] The ratio of thin modules to thick modules is "1:2.0 to 3.0." The gap width between characters is equal to or greater than the width of a thin module. The quiet zone is "thin module width x 10".
[0080] (6-3) About CODABAR (NW-7) CODABAR (NW-7) is a standard that uses four bars and three spaces to represent one character. CODABAR (NW-7) has two types of bars with different thicknesses (i.e., thick bars and thin bars) and two types of spaces with different thicknesses (i.e., thick spaces and thin spaces). The thin module width is 0.191 mm or more.
[0081] The ratio of thin modules to thick modules is "1:2.0 to 3.0." The gap width between characters is equal to or greater than the width of a thin module. The quiet zone is "thin module width x 10".
[0082] (6-4) Application method In order to apply the present disclosure to ITF, CODE39, and CODABAR (NW-7), first, in calculating the minimum module width (ie, the processes of S220 to S250), the ratio of the maximum module width to the minimum module width must be set to 2.0 to 3.0.
[0083] Furthermore, in the conversion to minimum run length information (ie, the process of S260), it is necessary to calculate the minimum run length ratio by assuming that the thick module is 2.5 times the thin module. (7) Application to CODE93 CODE93 is a standard that uses three bars and three spaces to represent one character. However, in CODE93, the width of the three bars and three spaces is set so that the total width of the three bars and three spaces is nine modules wide.
[0084] In CODE93, the width of the bars and spaces are available in three widths: 1 module width, 2 module width, and 3 module width. Therefore, in order to apply this disclosure to CODE93, it is necessary to create minimum run-length information so that the multiple minimum run-length ratios become either 1, 2, or 3 in the conversion to minimum run-length information (i.e., the processing of S260).
[0085] (8) Application to UPC, JAN, and EAN In UPC, JAN, and EAN, the basic dimension of the narrow module width is 0.33 mm, and the narrow module width can be enlarged or reduced by 0.8 to 2.0 times, i.e., the narrow module width is 0.26 to 0.66 mm.
[0086] In UPC, JAN, and EAN, the width of the bars and spaces is one module wide, two modules wide, three modules wide, and four modules wide, similar to Code128.
[0087] Thus, this disclosure is applicable to UPC, JAN, and EAN, as well as Code128. In the embodiment described above, the printer 1 corresponds to an image processing device, S210 corresponds to a run length calculation process and a run length calculation step, and S220 to S250 correspond to a minimum module calculation process and a minimum module calculation step.
[0088] Moreover, S260 corresponds to a ratio calculation process and a ratio calculation step, S270 to S330 correspond to a magnification setting process and a magnification setting step, S340 corresponds to a run length update process and a run length update step, and S350 corresponds to a bar code generation process and a bar code generation step.
[0089] Moreover, the barcode array direction BD corresponds to the array direction, the post-reduction minimum module candidate value corresponds to the candidate magnification, and the post-reduction minimum module decision value corresponds to the update magnification. Although one embodiment of the present disclosure has been described above, the present disclosure is not limited to the above embodiment and can be implemented in various modified forms.
[0090] In the above embodiments, multiple functions of one component may be realized by multiple components, or one function of one component may be realized by multiple components. Also, multiple functions of multiple components may be realized by one component, or one function realized by multiple components may be realized by one component. Also, part of the configuration of the above embodiments may be omitted. Also, at least part of the configuration of the above embodiments may be added to or substituted for the configuration of another of the above embodiments.
[0091] In addition to the printer 1 described above, the present disclosure can also be realized in various forms, such as a system that includes the printer 1 as a component, a program for causing a computer to function as the printer 1, a non-transient physical recording medium such as a semiconductor memory on which this program is recorded, and an image processing method. [Explanation of symbols]
[0092] 1... printer, 11... control unit, 15... printing unit
Claims
1. A printing unit that prints an image on a print medium; A control unit that controls the printing unit; In an image processing apparatus comprising: The control unit, a run length calculation process for calculating a plurality of run length values indicating lengths of the plurality of bars and the plurality of spaces in the barcode along a preset arrangement direction, based on image data including a barcode image showing a barcode represented by the plurality of bars and the plurality of spaces alternately arranged along the preset arrangement direction; a minimum module calculation process for obtaining a maximum value and a minimum value from among the run length values other than the run length values of a quiet zone, dividing the maximum value by the minimum module candidate value as a minimum module candidate value, increasing the minimum module candidate value until a quotient obtained by dividing the maximum value by the minimum module candidate value satisfies a barcode specification preset for the barcode, and calculating the smallest minimum module candidate value that satisfies the barcode specification as a minimum module width value; a ratio calculation process for calculating a ratio of each of the plurality of run length values calculated by the run length calculation process to the minimum module width value calculated by the minimum module calculation process as a minimum run length ratio; a magnification setting process for setting the barcode having the plurality of minimum run length ratios calculated in the ratio calculation process as the plurality of run length values as a minimum barcode, setting the length of the minimum barcode along the arrangement direction as a minimum barcode size, and setting magnifications having positive integer values as candidate magnifications, and setting as an updated magnification the maximum candidate magnification among the plurality of candidate magnifications such that the candidate barcode size obtained by multiplying the minimum barcode size by the candidate magnification is equal to or smaller than the length along the arrangement direction of an arrangement area in which the barcode is to be arranged; a run-length update process for multiplying each of the minimum run-length ratios calculated in the ratio calculation process by the update magnification to obtain a plurality of updated run-length values; a barcode generating process for generating the barcode based on a plurality of the updated runlength values; An image processing program that executes the above.
2. 2. The image processing program according to claim 1, The magnification setting process is an image processing program in which the minimum value of the update magnification is increased as the output resolution of the printing unit increases.
3. 3. The image processing program according to claim 1, The barcode specification is an image processing program that is a specification defined by any one of CODE128, GS1-128, ITF, CODE39, CODABAR (NW-7), CODE93, UPC, JAN, and EAN.
4. A printing unit that prints an image on a print medium; A control unit that controls the printing unit; An image processing device comprising: The control unit is a run length calculation process for calculating a plurality of run length values indicating lengths of the plurality of bars and the plurality of spaces in the barcode along a preset arrangement direction, based on image data including a barcode image showing a barcode represented by the plurality of bars and the plurality of spaces alternately arranged along the preset arrangement direction; a minimum module calculation process for obtaining a maximum value and a minimum value from among the run length values other than the run length values of a quiet zone, dividing the maximum value by the minimum module candidate value as a minimum module candidate value, increasing the minimum module candidate value until a quotient obtained by dividing the maximum value by the minimum module candidate value satisfies a barcode specification preset for the barcode, and calculating the smallest minimum module candidate value that satisfies the barcode specification as a minimum module width value; a ratio calculation process for calculating a ratio of each of the plurality of run length values calculated by the run length calculation process to the minimum module width value calculated by the minimum module calculation process as a minimum run length ratio; a magnification setting process for setting the barcode having the plurality of minimum run length ratios calculated in the ratio calculation process as the plurality of run length values as a minimum barcode, setting the length of the minimum barcode along the arrangement direction as a minimum barcode size, and setting magnifications having positive integer values as candidate magnifications, and setting as an updated magnification the maximum candidate magnification among the plurality of candidate magnifications such that the candidate barcode size obtained by multiplying the minimum barcode size by the candidate magnification is equal to or smaller than the length along the arrangement direction of an arrangement area in which the barcode is to be arranged; a run-length update process for multiplying each of the minimum run-length ratios calculated in the ratio calculation process by the update magnification to obtain a plurality of updated run-length values; a barcode generating process for generating the barcode based on a plurality of the updated runlength values; An image processing device that executes the above.
5. A printing unit that prints an image on a print medium; A control unit that controls the printing unit; An image processing method executed by an image processing device comprising: a run length calculation step of calculating a plurality of run length values indicating lengths of each of a plurality of bars and a plurality of spaces in a barcode, the plurality of bars and spaces being alternately arranged along a preset arrangement direction, based on image data including a barcode image showing the barcode; a minimum module calculation step of obtaining a maximum value and a minimum value from among the run length values other than the run length values of a quiet zone, dividing the maximum value by the minimum module candidate value as a minimum module candidate value, increasing the minimum module candidate value until a quotient obtained by dividing the maximum value by the minimum module candidate value satisfies a barcode specification preset for the barcode, and calculating the smallest minimum module candidate value that satisfies the barcode specification as a minimum module width value; a ratio calculation step of calculating a ratio of each of the plurality of run length values calculated in the run length calculation step to the minimum module width value calculated in the minimum module calculation step as a minimum run length ratio; a magnification setting step of setting the barcode having the plurality of minimum run length ratios calculated in the ratio calculation step as the plurality of run length values as a minimum barcode, setting the length of the minimum barcode along the arrangement direction as a minimum barcode size, and setting magnifications having positive integer values as candidate magnifications, and setting as an updated magnification the maximum candidate magnification among the plurality of candidate magnifications such that the candidate barcode size obtained by multiplying the minimum barcode size by the candidate magnification is equal to or smaller than the length along the arrangement direction of an arrangement area in which the barcode is to be arranged; a run-length updating step of multiplying each of the plurality of minimum run-length ratios calculated in the ratio calculation step by the update magnification to obtain a plurality of updated run-length values; generating the barcode based on a plurality of the updated run-length values; An image processing method comprising:
Citation Information
Patent Citations
Bar code generation system and computer program
JP2010046921A
Print control device, page data correction method, raster data generation method, page data correction program, and raster data generation program
JP2018116442A
Bar-code design device and design method
JP2018195163A
Image processing device and image processing program
JP2019180046A