CN106681673A - Grayscale printing method of thermosensitive printer - Google Patents

Grayscale printing method of thermosensitive printer Download PDF

Info

Publication number
CN106681673A
CN106681673A CN201611191020.7A CN201611191020A CN106681673A CN 106681673 A CN106681673 A CN 106681673A CN 201611191020 A CN201611191020 A CN 201611191020A CN 106681673 A CN106681673 A CN 106681673A
Authority
CN
China
Prior art keywords
data
buffer
gray
image
grayscale
Prior art date
Application number
CN201611191020.7A
Other languages
Chinese (zh)
Inventor
卓春春
庄毅民
王鹏
张登峰
Original Assignee
福建升腾资讯有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 福建升腾资讯有限公司 filed Critical 福建升腾资讯有限公司
Priority to CN201611191020.7A priority Critical patent/CN106681673A/en
Publication of CN106681673A publication Critical patent/CN106681673A/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/12Digital output to print unit, e.g. line printer, chain printer
    • G06F3/1201Dedicated interfaces to print systems
    • G06F3/1202Dedicated interfaces to print systems specifically adapted to achieve a particular effect
    • G06F3/1203Improving or facilitating administration, e.g. print management
    • G06F3/1205Improving or facilitating administration, e.g. print management resulting in increased flexibility in print job configuration, e.g. job settings, print requirements, job tickets
    • GPHYSICS
    • G06COMPUTING; CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/12Digital output to print unit, e.g. line printer, chain printer
    • G06F3/1201Dedicated interfaces to print systems
    • G06F3/1202Dedicated interfaces to print systems specifically adapted to achieve a particular effect
    • G06F3/1211Improving printing performance

Abstract

The invention provides a grayscale printing method of thermosensitive printer. The grayscale printing method includes: preprocessing an image through an upper computer, converting the image into grayscale data required by the thermosensitive printer, converting the one-line grayscale data of the upper computer into a multi-line binary image by the aid of the thermosensitive printer, and printing the multi-line binary image into a one-line grayscale image by means of controlling a heating level ad a tissue feeding speed of the thermosensitive printer. The grayscale printing method of the thermosensitive printer has the advantages that sensitivity of the thermosensitive printer is increased, and the problem that a grayscale image is difficult to analyze is solved by the aids of a reasonable data processing compression algorithm and a double-buffer mechanism of the printer.

Description

一种热敏打印机灰度打印方法 A thermal printer gradation printing method

技术领域 FIELD

[0001] 本发明涉及打印机技术领域,尤其涉及一种热敏打印机灰度打印方法。 [0001] The present invention relates to the field of printer technology, particularly to a thermal printer gray printing method.

背景技术 Background technique

[0002] 打印机无非就是将人们的心中的想法通过一定的表现形式(包含文字、图像、形状等)用特定的介质呈现出来的机器。 [0002] The printer is nothing more than the hearts of the people think through some form of expression (including text, images, shapes, etc.) tend to come out with a specific medium machine. 举个例子,热敏打印机就是将人们所想表达的图形和文字,通过热敏纸呈现出现。 For example, thermal printer that people will want to express graphics and text, presented by the emergence of thermal paper.

[0003] 票据打印机,按照打印方式可分为热敏、热转印、针式打印机。 [0003] The receipt printer according to the print mode can be divided into thermal, thermal transfer, dot matrix printer.

[0004] 热敏打印机工作原理是打印头上安装有半导体加热元件,打印头加热并接触热敏打印纸后就可以打印出需要的图案,其原理与热敏式传真机类似。 [0004] The thermal printer works printhead mounted semiconductor heating element, the heating and contacting the thermal print head after the printing paper can be printed in the desired pattern, which is similar to the principle of the thermal facsimile. 图象是通过加热,在热敏纸的膜中产生化学反应而生成的。 Image is formed by heating, chemical reaction in the thermal paper in the film generated. 这种热敏打印机化学反应是在一定的温度下进行的。 This thermal printer chemical reaction is carried out at a constant temperature. 高温会加速这种化学反应。 Such temperatures will accelerate the chemical reaction. 当温度低于60°c时,纸需要经过相当长,甚至长达几年的时间才能变成深色;而当温度为200°C时,这种反映会在几微秒内完成。 When the temperature is below 60 ° c, the paper needs a rather long even for up to several years to become dark; when the temperature is 200 ° C, this reflection will be completed within a few microseconds. 所以要想使热敏打印机打印出图形和文字,就必须满足两个条件,热敏纸和高温。 So in order to make the thermal printer to print out graphics and text, it must meet two conditions, thermal paper and high temperature. 当前市面上的热敏打印机只能打印二值图,也就是说要么最黑要么白,打印图片效果差,不灵活。 The current market thermal printer can only print binary image that is either black or white most print photo quality is poor, do not flexible.

[0005] 现有技术中公开了一种"热敏打印机的灰度控制器",见公开号为:CN201619297U, 公开日为:2010-11-03的中国专利,公开了一种热敏打印机的灰度控制器,其与热敏打印头片相连,所述灰度控制器用以实现对热敏打印头片的灰度控制;所述灰度控制器包括微处理单元,和FPGA/CPLD单元;所述微处理单元用以控制打印数据的加热时间;所述FPGA/CPLD 单元与微处理单元相连,用以精确地进行打印时间控制与时序控制。 [0005] The prior art discloses a "thermal printer gradation Controller", see Publication No.: CN201619297U, Publication date: 2010-11-03 Chinese patent, there is disclosed a thermal printer gradation control, which is connected to the thermal print head chip, the gradation control of the thermal print head to achieve gradation control of the sheet; the gradation processing means includes a micro controller, and FPGA / CPLD unit; the micro processing unit for controlling the heating time of the print data; connected to the FPGA / CPLD unit and a micro processing unit for accurate print timing control and timing control. 该实用新型同时结合了微处理单元的运算优势和FPGA/CPLD单元的快速反应及精确时间控制优势,实现多级灰度打印控制,节约硬件和软件成本。 The invention combined with a rapid response and operational advantages FPGA / CPLD microprocessing unit and precision timing control unit advantages, multi-level gray scale printing control, saving the cost of hardware and software. 该实用新型采用的技术方案与本专利申请并不相同。 The utility model employed in the embodiment of the present patent application is not the same.

发明内容 SUMMARY

[0006] 本发明要解决的技术问题,在于提供一种热敏打印机灰度打印方法,提高了热敏打印机灵活性,通过合理的数据处理压缩算法以及打印机双缓冲机制解决了灰度图片解析困难。 [0006] The present invention is to solve the technical problem, is to provide a thermal printer gray printing method, a thermal printer improved flexibility, reasonable data processing and compression algorithms to solve the double buffered printer gradation image analytical difficulties .

[0007] 本发明是这样实现的:一种热敏打印机灰度打印方法,所述方法为:通过上位机对图像进行预处理,将图像转为热敏打印机需要灰度等级图像数据,热敏打印机端将上位机一行的灰度数据进行转换成多行二值图,然后通过控制加热等级和热敏打印机马达进纸速度将多行二值图打印成一行灰度图像。 [0007] The present invention is implemented as follows: A thermal printer gradation printing, the method is: preprocessing of the image through the PC, thermal printer image into gray scale image data required, the thermosensitive the PC printer side line gradation data is converted to multi-line binary image, and by controlling the heating level of the thermal printer and the paper feed motor speed multi-line printing binary image into a grayscale image line.

[0008] 进一步的,所述方法进一步具体为:上位机负责读取256级灰度图像进行数据压缩,将256级灰度图像分为热敏打印机需要的灰度等级图像数据;所述打印机端提供指令解析任务和打印任务;指令解析任务实现接收上位机下发的指令数据,并进行数据解析放入缓冲区;热敏打印机端将上位机一行的灰度数据进行转换成多行二值图;所述打印任务将存入缓冲区的数据进行打印,根据缓冲数据控制马达以及控制加热时间和等级将多行二值图打印成一行灰度图像。 [0008] Further, the method is further specifically is: the host computer 256 is responsible for reading the data compressed gray image, the image is divided into 256-level grayscale gradation image data required thermal printer; end of the printer providing the print job and parsing task instructions; instruction parsing task instructions that implement the data sent by the PC to receive and parse the data into the buffer; end of the thermal printer gradation data line PC converts the binary image into multiple lines ; the print job into the print data buffer, data buffer, and controls the motor according to the control level and the heating time will print multiple lines in a row binary image grayscale image.

[0009] 进一步的,所述缓冲区为双缓冲区,当第一缓冲区为空闲时,指令解析处理后的数据放入第一缓冲区,当第一缓冲区不空闲,若第二缓冲区空闲,则将放入第二缓冲区中,若两个缓冲区都不空闲,则打印机正在打印缓冲内容,并且下个缓冲数据已经准备好了,此时指令解析任务阻塞;打印任务先打印第一缓冲区内容,第一缓冲区打印结束会将第一缓冲区设置为空闲状态,然后直接继续打印第二缓冲区数据,并且第一缓冲区一旦空闲指令解析任务又重新运行,准备下个数据放入第一缓冲区中,打印任务打印完第二缓冲区,这样不用等待直接进行打印第一缓冲区内容,能一直循环无间断的打印; [0009] Further, the buffer is a double buffer, when the first buffer is empty, the instruction parsing data into the first buffer when the first buffer is not empty, if the second buffer free, will be placed in the second buffer, if the two buffers are not idle, the printer is printing the contents of the buffer and the next buffer data ready, command analysis task this time blocked; first printing of the print job a buffer contents, a first end of the print buffer will first buffer is set to an idle state, and then proceed directly to the second print data buffer, the buffer and the first instruction parsing task once again idle operation, ready for the next data into the first buffer, the second buffer after printing the print job, so do not wait for direct printing of the first buffer content, could have been circulating uninterrupted printing;

[0010] 进一步的,上位机负责读取256级灰度图像,将256级灰度图像分为热敏打印机需要的四级灰度图像数据;四级灰度图像数据以2个bit表示一个像点,上位机读取256级灰度图像图片,一个字节表示一个灰度点,值的大小表示灰度等级0x00到OxFF,由于只需要分为四级灰度,需要将256级进行四等分,只需要取这个字节的前两位,相当于除以64,将4个字节数据合并成一个字节;故一个字节数据表示4个像素点,上位机发一个字节OxlB,第一个像素点级数由第7,6bit表示,其灰度级数为0,第二个像素点由第5,4bit表示,其灰度级数为1,第二个像素点由第3,2bit表示,其灰度级数为3,第二个像素点由第l,0bit表示,其灰度级数为4; [0010] Further, the host computer 256 is responsible for reading grayscale image, the grayscale image 256 is divided into four grayscale image data required thermal printer; four grayscale image data represented by a two bit image point, the PC 256 reads the gray-scale image picture, one byte represents a gray dot size value is OxFF 0x00 to represent gradation, since only divided into four gray, 256 need to be fourth order points, to take only the first two bytes, divided by 64 is equivalent to the 4 bytes of data are combined into one byte; byte data representation so that a four pixels, the PC sends a byte OxlB, a first pixel represented by a series of 7,6bit, which gray levels of 0, the second pixels represented by the first 5,4bit, which gray levels is 1, the second pixel from the third , 2bit said its three gray levels, the second pixel, represented by the first 0bit L, which is a 4 gray levels;

[0011] 四级灰度图像数据中将数据转化的3行二值图像,即将2个字节的四级灰度图数据转成3个字节二值图数据放入缓存中; 3 line binary image [0011] data in the four grayscale image data conversion, i.e. two bytes of four grayscale data into 3-byte binary image data into the buffer;

[0012] 四级灰度图像数据中,用1表示要加热点,0表示不加热点,3个字节二值图组成一行4级灰度图,先将第一行数据加载打印头,接着选通加热信号,打印头在对应的位置加热, 到达设定时间后关闭加热选通信号,然后接着加载第二行二值数据,以此类推加载第三行二值数据,最后将3行二值数据打印完成后,这时控制马达,刚好让马达走完一个点行,这样这个点行就会有相应的灰度效果。 [0012] four gray image data, denoted by 1 for a heating point, 0 means no heating point, three-byte binary composition line in FIG. 4 grayscale level, the first line of the first print head data loading, and then heating strobe signal, the printhead is heated at corresponding locations, heat is turned off after the strobe signal reaches the set time, and then loads the binary data of the second row, third row and so loaded binary data, the last two rows 3 after printing is complete value data, whereupon the control motor, so that the motor just completed a dot row, so that this point will have a corresponding row gradation effect.

[0013] 进一步的,所述方法:上位机负责读取256级灰度图像,将256级灰度图像分为热敏打印机需要的八级灰度图像数据;八级灰度图像数据以4个bit表示一个像素点,上位机发送一个字节数据表示2个像素点,每个字节的第Obit和第4bit保留,上位机发一个字节OxOA,第1个像素点级数由第7,6,5bit表示,第4bit保留,其灰度级数为0,第2个像素点由第3,2,11^1表示,其灰度级数为1;第2个像素点由第3,2,113^表示,其灰度级数为1;第2个像素点由第3,2,lbit表示,第Obit保留,其灰度级数为5; [0013] Further, the method: the host computer 256 is responsible for reading grayscale image, the grayscale image 256 is divided into eight gray-scale image data required thermal printer; eight grayscale image data 4 bit represents a pixel, the host computer sends a two byte data represents pixels, each byte Obit 4bit and retention, the host computer sends a byte OxOA, a first series of pixels 7, 6,5bit said first 4bit reserved which gray levels of 0, the second pixels represented by the first 3,2,11 ^ 1, which gray levels is 1; second by the third pixels, 2,113 ^ represents its gray levels is 1; second pixels represented by the first 3,2, lbit, Obit retention of which gray levels is 5;

[0014] 八级灰度图像数据中将数据转化的7行二值图像,即将4个字节的八级灰度图数据转成7个字节二值图数据放入缓存中。 [0014] eight grayscale image data in the binary image 7 row data conversion, i.e. 4 bytes of eight 7 grayscale data into binary image data byte placed in the cache.

[0015] 本发明具有如下优点:本发明基于传统热敏打印机进行功能优化,提高了热敏打印机灵活性,通过合理的数据处理压缩算法以及打印机双缓冲机制解决了灰度图片解析困难,打印数据量大不好传输等问题,大大提高了打印效率,使得打印速度不会受数据量影响;灰度打印不仅可以打印人像、logo、风景等,在银行等行业类业务上还可以打印银行卡、 二代证等。 [0015] The present invention has the following advantages: the present invention is based on the traditional functions to optimize thermal printer, thermal printer improved flexibility, reasonable data processing and compression algorithms to solve the double buffered printer gradation image analytical difficulties, print data large poor transport and other issues, greatly improved printing efficiency, so that the printing speed is not affected by the amount of data; grayscale printing can not only print portrait, logo, landscapes, etc., can also print cards in other industries like banking business, second-generation card.

附图说明 BRIEF DESCRIPTION

[0016] 下面参照附图结合实施例对本发明作进一步的说明。 [0016] The following embodiments with reference to the accompanying drawings in conjunction with embodiments of the present invention will be further described.

[0017] 图1为本发明方法结构示意图。 [0017] FIG. 1 is a schematic structure of the method of the present invention.

[0018] 图2为本发明双缓冲区处理数据的流程示意图。 [0018] FIG. 2 is a schematic process flow double-buffer data of the present invention.

[0019] 图3为本发明3行二值数据加热点的示意图。 [0019] FIG. 3 is a schematic three rows of binary data heat spots invention.

[0020] 图4为本发明中打印后的多个点行灰度效果示意图。 [0020] FIG. 4 of the present invention, a plurality of dot rows printed after the gradation effect of FIG.

具体实施方式 Detailed ways

[0021] 请参阅图1至图2所示,本发明的一种热敏打印机灰度打印方法,为了实现灰度打印,可以通过控制加热时间和加热次数来控制加热头对纸张的能量,因为图片数据量较大, 而单片机资源以及数据传输速度有限,所有需要上位机对图像进行预处理,将图像转为热敏打印机需要灰度等级,这样才能提高打印质量和打印速度。 [0021] Please refer to FIGS. 2 A printing method of thermal printer according to the present invention, gray, in order to achieve gray scale printing, the thermal head can be controlled by controlling the energy of the sheet heating time and heating times, since picture a large amount of data, while limited MCU resources and data transfer speed, all the required host computer for image pre-processing, the image is converted to gray scale thermal printer needs, so as to improve print quality and print speed. 打印机端将上位机一行的灰度数据进行转换成多行二值图,然后通过控制加热等级和热敏打印机马达进纸将这多行二值图打印成一行灰度图像。 The PC printer side line gradation data is converted to multi-line binary image, and by controlling the heating level of the thermal printer and the paper feed motor binary these multi-line print a line grayscale image of FIG.

[0022] 所述方法进一步具体为:上位机负责读取256级灰度图像进行数据压缩,将256级灰度图像分为热敏打印机需要的灰度等级图像数据;所述打印机端提供指令解析任务和打印任务;指令解析任务实现接收上位机下发的指令数据,并进行数据解析放入缓冲区;热敏打印机端将上位机一行的灰度数据进行转换成多行二值图;所述打印任务将存入缓冲区的数据进行打印,根据缓冲数据控制马达以及控制加热时间和等级将多行二值图打印成一行灰度图像。 [0022] The method is further specifically is: the host computer 256 is responsible for reading the data compressed gray image, the image is divided into 256-level grayscale gradation image data required thermal printer; end providing said printer command interpreting tasks and print job; instruction parsing task instructions that implement the data sent by the PC to receive and parse the data into the buffer; end of the thermal printer PC line gradation data is converted into multi-line binary image; the the print job into the print data buffer, data buffer, and controls the motor according to the control level and the heating time will print multiple lines in a row binary image grayscale image.

[0023] 为了提高打印效率,提高mcu利用率,设计了双缓冲机制,所述缓冲区为双缓冲区, 当第一缓冲区为空闲时,指令解析处理后的数据放入第一缓冲区,当第一缓冲区不空闲,若第二缓冲区空闲,则将放入第二缓冲区中,若两个缓冲区都不空闲,则打印机正在打印缓冲内容,并且下个缓冲数据已经准备好了,此时指令解析任务阻塞;打印任务先打印第一缓冲区内容,第一缓冲区打印结束会将第一缓冲区设置为空闲状态,然后直接继续打印第二缓冲区数据,并且第一缓冲区一旦空闲指令解析任务又重新运行,准备下个数据放入第一缓冲区中,打印任务打印完第二缓冲区后,指令解析任务早已将第一缓冲区数据放入缓冲中, 这样不用等待直接进行打印第一缓冲区内容,这样可以一直循环无间断的打印。 [0023] In order to improve printing efficiency, improved utilization mcu designed double buffered, the buffer is a double buffer, when the first buffer is empty, the instruction parsing data into a first buffer, when the first buffer is not empty, if the second buffer is free, it will be placed in the second buffer, if the two buffers are not idle, the printer is printing the contents of the buffer and the next buffer data ready In this case the blocking command analysis task; a first print job to the print buffer content, a first end of the print buffer will first buffer is set to an idle state, and then proceed directly to the second print data buffer, and the first buffer Once the idle command analysis task to run again, ready for the next data into the first buffer, print after print job finished second buffer, command analysis task has long been the first buffer data into the buffer, so do not wait directly the first print buffer contents, so you can have uninterrupted printing cycles.

[0024] 如图3和图4所示,下面以四级灰度为例: [0024] As shown in FIG. 3 and FIG. 4, as an example below to four gray:

[0025]上位机负责读取256级灰度图像,将256级灰度图像分为热敏打印机需要的四级灰度图像数据;四级灰度图像数据以2个bit表示一个像点,上位机读取256级灰度图bmp图片, 一个字节表示一个灰度点,值的大小表示灰度等级0x00到OxFF,因为只需要分为4级灰度, 需要将256级4等分,所以只需要取这个字节的前两位,相当于除以64,可以将4个字节数据合并成一个字节。 [0025] The host computer 256 is responsible for reading grayscale image, the grayscale image 256 is divided into four grayscale image data required thermal printer; four grayscale image data in two bit represents a dot, upper bmp machine to read grayscale image 256, a point of which represents a gray scale, the size value is OxFF 0x00 to represent gradation, because the gradation need only be divided into four, we need to 256 4 equal portions, so only needs to take the first two bytes, divided by 64 is equivalent to 4 bytes of data can be combined into a byte. 故一个字节数据可以表示4个像素点,如上位机发一个字节OxlB (00011011),第一个像素点级数由第7,6bit表示,其灰度级数为0,第二个像素点由第5, 4bit表示,其灰度级数为1,第二个像素点由第3,2bit表示,其灰度级数为3,第二个像素点由第l,0bit表示,其灰度级数为4; Therefore, a byte of data may represent four pixels, as a hair dryer bit byte OxlB (00011011), a first pixel represented by a series of 7,6bit, which gray levels of 0, the second pixel from the first point 5, 4bit said its gray levels is 1, represented by the second pixels of 3,2bit, which three gray levels, the second pixel, represented by the first L 0bit which ash is a series of 4;

[0026] 指令解析任务负责实现接收读取上位机下发的指令数据,并进行数据解析放入缓冲区。 [0026] The instruction parsing task is responsible for implementing the received data read command issued by the host computer, and data analysis into the buffer. 首先将上位机接收的指令进行处理,以4级灰度数据为例,先将数据分级处理,假如数据为0xE4 (11100100),表示4个点,灰度等级分别为3、2、1、0; First, the host computer processes the received instructions to the gradation level 4 data, for example, the first data classification treatment, if the data is 0xE4 (11100100), represents four points, respectively, 3,2,1,0 gradation ;

[0027]四级灰度图像数据中将数据转化的3行二值图像,如表1(表1为两字节0xE4数据转换一一4级灰度)所示,将8个点(2个字节)的4级灰度图数据(0xE4 0xE4),转成了3个字节(3 行)二值图数据(OxEE OxCC 0x88)放入缓存中, [0027] 3-line image data of four gray binary image data will be transformed, the eight points (2 in Table 1. (Table 1 is a two-byte data converter 0xE4 eleven gradation 4), the byte) 4 level grayscale data (0xE4 0xE4), turned into 3 bytes (row 3) the binary image data (OxEE OxCC 0x88) placed in the cache,

[0028] 表1 [0028] TABLE 1

Figure CN106681673AD00071

[0029] [0029]

[0030] [0030]

[0031] 四级灰度图像数据中,用1表示要加热点,0表示不加热点,3个字节二值图组成一行4级灰度图,先将第一行数据加载打印头,接着选通加热信号,打印头在对应的位置加热, 到达设定时间后关闭加热选通信号,然后接着加载第二行二值数据,以此类推,加载第三行二值数据,3行二值数据加热点如图3所示(这个加热点都是黑色的,该图3并不是带有色块的图),最后将3行二值数据打印完成后,这时控制马达,刚好让马达走完一个点行,这样这个点行就会有相应的灰度效果。 [0031] The four grayscale image data, denoted by 1 for a heating point, 0 means no heating point, three-byte binary composition line in FIG. 4 grayscale level, the first line of the first print head data loading, and then heating strobe signal, the printhead is heated at corresponding locations, heat is turned off after the strobe signal reaches the set time, and then loads the binary data of the second row, and so on, the third line is loaded binary data, the binary lines 3 data shown in FIG heat spots (the heating dots are black, which is not in FIG. 3 with FIG patches) 3, after the last 3 rows binary data printing is complete, whereupon the control motor, so that the motor just completed a dot row, so that this point will have a corresponding row gradation effect. 整体放大后的多个点行效果大致如图4所示(图中黑色块为打印时的灰度图片,并不是色块图)。 A plurality of dot rows after the overall effect is substantially amplified as shown in (FIG gradation image when printing black block not color bars) 4.

[0032]另外,八级灰度图像数据也一样的原理:所述方法:上位机负责读取256级灰度图像,将256级灰度图像分为热敏打印机需要的八级灰度图像数据;八级灰度图像数据以4个bit表示一个像素点,上位机发送一个字节数据表示2个像素点,每个字节的第Obit和第4bit保留,如上位机发一个字节OxOA (00001010),,第1个像素点级数由第7,6,5bit表示,第4bit保留,其灰度级数为0,第2个像素点由第3,2,lbit表示,其灰度级数为1;第2个像素点由第3,2,lbit表示,其灰度级数为1;第2个像素点由第3,2,lbit表示,第Obit保留,其灰度级数为5; [0032] Further, eight grayscale image data is the same principle: the method: the host computer 256 is responsible for reading grayscale image, the grayscale image 256 is divided into eight gray-scale image data required thermal printer ; eight gray scale image data represented by a 4 bit pixel, the host computer sends a two byte data represents pixels, each byte Obit 4bit reserved and, as a hair dryer bit byte OxOA ( 00001010) ,, a first pixel represented by a series of 7,6,5bit, 4bit retention of which gray levels of 0, the second pixel, represented by the first lbit 3,2, a gray level number of 1; second pixels, represented by the first lbit 3,2 which gray levels is 1; second by the first pixel 3,2, lbit said first Obit retains its gray levels of 5;

[0033] 八级灰度图像数据中将数据转化的7行二值图像,即将4个字节的八级灰度图数据转成7个字节二值图数据放入缓存中。 [0033] The eight grayscale image data in the binary image 7 row data conversion, i.e. 4 bytes of eight 7 grayscale data into binary image data byte placed in the cache.

[0034] 本发明中根据打印机的性能可以是1级灰度、2级灰度、3级灰度、4级灰度、5级灰度、6级灰度、7级灰度、8级灰度、9级灰度等等,该些灰度的处理方式原理类似,在此就不进行说明。 [0034] The performance of the printer according to the present invention may be gray level 1, level 2 gray, gray level 3, gray level 4, 5 gray, gray six, seven gray, gray 8 degree, gradation, etc. 9, similar process consistent with the principles of the plurality of gray scale, this will not be described.

[0035]总之,本发明基于传统热敏打印机进行功能优化,提高了热敏打印机灵活性,通过合理的数据处理压缩算法以及打印机双缓冲机制解决了灰度图片解析困难,打印数据量大不好传输等问题,大大提高了打印效率,使得打印速度不会受数据量影响。 [0035] In summary, the present invention is based on the conventional thermal printer features optimized to improve thermal printer flexibility, reasonable data processing and compression algorithms printer double buffering mechanism to solve the gray pictures analytical difficulties, poor print large volumes of data transmission and other issues, greatly improving the printing efficiency, so that the printing speed is not affected by the amount of data. 灰度打印不仅可以打印人像、logo、风景等,在银行等行业类业务上还可以打印银行卡、二代证等。 Grayscale printing can not only print portrait, logo, landscapes, etc., can also print cards in other industries like banking business, second-generation card.

[0036]虽然以上描述了本发明的具体实施方式,但是熟悉本技术领域的技术人员应当理解,我们所描述的具体的实施例只是说明性的,而不是用于对本发明的范围的限定,熟悉本领域的技术人员在依照本发明的精神所作的等效的修饰以及变化,都应当涵盖在本发明的权利要求所保护的范围内。 [0036] While the above described specific embodiment of the present invention, but skilled in the art in the art will appreciate, our specific embodiments described are illustrative only and are not intended to limit the scope of the present invention, are familiar Those skilled in the art in equivalent modifications and variations in the spirit of the present invention is made, should be encompassed within the scope of the claims of the present invention is protected.

Claims (5)

1. 一种热敏打印机灰度打印方法,其特征在于:所述方法为:通过上位机对图像进行预处理,将图像转为热敏打印机需要灰度等级图像数据,热敏打印机端将上位机一行的灰度数据进行转换成多行二值图,然后通过控制加热等级和热敏打印机马达进纸速度将多行二值图打印成一行灰度图像。 1. A thermal printer gradation printing method, characterized in that: said method: preprocessing of the image through the PC, thermal printer image into gray scale image data needs, the upper end of the thermal printer gray line modem converts the binary image into multiple lines, and by controlling the heating level of the thermal printer and the paper feed motor speed multi-line printing binary image into a grayscale image line.
2. 根据权利要求1所述的一种热敏打印机灰度打印方法,其特征在于:所述方法进一步具体为:上位机负责读取256级灰度图像进行数据压缩,将256级灰度图像分为热敏打印机需要的灰度等级图像数据;所述打印机端提供指令解析任务和打印任务;指令解析任务实现接收上位机下发的指令数据,并进行数据解析放入缓冲区;热敏打印机端将上位机一行的灰度数据进行转换成多行二值图;所述打印任务将存入缓冲区的数据进行打印,根据缓冲数据控制马达以及控制加热时间和等级将多行二值图打印成一行灰度图像。 2. A thermal printer gradation printing method according to claim 1, characterized in that: said method further specifically is: the host computer 256 is responsible for reading the data compressed gray image, the grayscale image 256 gray-scale image data into desired thermal printer; end of the printer and provides print job command analysis tasks; instruction parsing task instructions that implement the data sent by the PC to receive and parse the data into the buffer; thermal printer the end of the PC line gradation data is converted to multi-line binary image; the print job into the print data buffer, data buffer, and controls the motor according to the heating time control and the level of multi-line printing binary image gray scale image in a row.
3. 根据权利要求2所述的一种热敏打印机灰度打印方法,其特征在于:所述缓冲区为双缓冲区,当第一缓冲区为空闲时,指令解析处理后的数据放入第一缓冲区,当第一缓冲区不空闲,若第二缓冲区空闲,则将放入第二缓冲区中,若两个缓冲区都不空闲,则打印机正在打印缓冲内容,并且下个缓冲数据已经准备好了,此时指令解析任务阻塞;打印任务先打印第一缓冲区内容,第一缓冲区打印结束会将第一缓冲区设置为空闲状态,然后直接继续打印第二缓冲区数据,并且第一缓冲区一旦空闲指令解析任务又重新运行,准备下个数据放入第一缓冲区中,打印任务打印完第二缓冲区,这样不用等待直接进行打印第一缓冲区内容,能一直循环无间断的打印。 A thermal printer according to the gray printing method according to claim 2, wherein: the buffer is a double buffer, when the first buffer is empty, the instruction data into the first analysis processing a buffer when the first buffer is not empty, if the second buffer is free, the second buffer will be placed, if the two buffers are not empty, the printer is printing the contents of the buffer, and the next data buffer ready, command analysis task this time blocked; the first print job to the print buffer contents, the first print buffer will end the first buffer is set to idle, and then proceed directly to the second print data buffer, and Once the first buffer idle command analysis task to run again, ready for the next data into the first buffer, the second buffer after printing the print job, so do not wait for direct printing of the first buffer content, it could have been no cycle intermittent printing.
4. 根据权利要求1所述的一种热敏打印机灰度打印方法,其特征在于:所述方法:上位机负责读取256级灰度图像,将256级灰度图像分为热敏打印机需要的四级灰度图像数据; 四级灰度图像数据以2个bit表示一个像点,上位机读取256级灰度图像图片,一个字节表示一个灰度点,值的大小表示灰度等级OxOO到OxFF,由于只需要分为四级灰度,需要将256级进行四等分,只需要取这个字节的前两位,相当于除以64,将4个字节数据合并成一个字节; 故一个字节数据表示4个像素点,上位机发一个字节OxlB,第一个像素点级数由第7,6bit表示,其灰度级数为〇,第二个像素点由第5,4bit表示,其灰度级数为1,第二个像素点由第3, 2bit表示,其灰度级数为3,第二个像素点由第l,0bit表示,其灰度级数为4; 四级灰度图像数据中将数据转化的3行二值图像,即将2个字节的四级灰度图数据 A thermal printer according to the gray printing method according to claim 1, characterized in that: said method: the host computer 256 is responsible for reading grayscale image, the grayscale image 256 is divided into a thermal printer required the four grayscale image data; four gray scale image data represented by a 2 bit dot, the PC 256 reads the gray-scale image picture, one byte represents a gray dot size value indicates gradation is OxFF to OxOO, since only divided into four gray, 256 need to be quartered, taking only the first two bytes, divided by 64 is equivalent to the 4 bytes of data are combined into one word section; byte data representation so that a four pixels, the PC sends a byte OxlB, a first pixel represented by a series of 7,6bit, which is a square of gray levels, the second pixel from the first 5,4bit said its gray levels of 1, the second pixel, represented by the third 2bit which three gray levels, the second pixel, represented by the first L 0bit which gray levels 4; four grayscale data lines 3 binary image data in the image data of four gradation conversion, i.e. 2 bytes 转成3个字节二值图数据放入缓存中; 四级灰度图像数据中,用1表示要加热点,〇表示不加热点,3个字节二值图组成一行4级灰度图,先将第一行数据加载打印头,接着选通加热信号,打印头在对应的位置加热,到达设定时间后关闭加热选通信号,然后接着加载第二行二值数据,以此类推加载第三行二值数据,最后将3行二值数据打印完成后,这时控制马达,刚好让马达走完一个点行,这样这个点行就会有相应的灰度效果。 3 bytes converted into binary image data in the memory cache; four gray image data, denoted by 1 for a heating point, square represents no heating point, three-byte binary composition line in FIG. 4 level grayscale , the first row of the first print head data loading, and then heating the strobe signal, the printhead is heated at corresponding locations, heat is turned off after the strobe signal reaches the set time, and then loads the binary data of the second row, and so loading after the third row of binary data, the last three lines of binary data printing is complete, whereupon the control motor, so that the motor just completed a dot row, so that this point will have a corresponding row gradation effect.
5. 根据权利要求1所述的一种热敏打印机灰度打印方法,其特征在于:所述方法:上位机负责读取256级灰度图像,将256级灰度图像分为热敏打印机需要的八级灰度图像数据; 八级灰度图像数据以4个bit表示一个像素点,上位机发送一个字节数据表示2个像素点,每个字节的第Obit和第4bit保留,上位机发一个字节OxOA,第1个像素点级数由第7,6,5bit表示,第4bit保留,其灰度级数为0,第2个像素点由第3,2,Ibit表示,其灰度级数为1;第2个像素点由第3,2, Ibit表示,其灰度级数为1;第2个像素点由第3,2, Ibit表示,第Obit保留,其灰度级数为5; 八级灰度图像数据中将数据转化的7行二值图像,即将4个字节的八级灰度图数据转成7个字节二值图数据放入缓存中。 A thermal printer according to the gray printing method according to claim 1, characterized in that: said method: the host computer 256 is responsible for reading grayscale image, the grayscale image 256 is divided into a thermal printer required the eight grayscale image data; eight grayscale image data represents a pixel in a 4 'bit, the host computer sends a two byte data represents pixels, each of the first byte and Obit 4bit reserved, PC send a byte OxOA, a first pixel represented by a series of 7,6,5bit, 4bit retention of which gray levels of 0, the second pixel, represented by the first Ibit 3,2 which ash of stages is 1; second pixels, represented by the first Ibit 3,2 which gray levels is 1; second pixels, represented by the first Ibit 3,2, retention of Obit, a gray level number 5; 7 rows eight binary image data in the gray scale image data conversion, i.e. 4 bytes of eight 7 grayscale data into binary image data byte placed in the cache.
CN201611191020.7A 2016-12-21 2016-12-21 Grayscale printing method of thermosensitive printer CN106681673A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201611191020.7A CN106681673A (en) 2016-12-21 2016-12-21 Grayscale printing method of thermosensitive printer

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201611191020.7A CN106681673A (en) 2016-12-21 2016-12-21 Grayscale printing method of thermosensitive printer

Publications (1)

Publication Number Publication Date
CN106681673A true CN106681673A (en) 2017-05-17

Family

ID=58869894

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201611191020.7A CN106681673A (en) 2016-12-21 2016-12-21 Grayscale printing method of thermosensitive printer

Country Status (1)

Country Link
CN (1) CN106681673A (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1326403A (en) * 1998-11-09 2001-12-12 西尔弗布鲁克研究有限公司 Printer and methods of operation
CN1944052A (en) * 2006-11-15 2007-04-11 深圳市润天智图像技术有限公司 Multiple grey scale printing method
CN102205706A (en) * 2010-03-15 2011-10-05 佳能株式会社 Image processor, image processing method and image printing method
CN103192609A (en) * 2012-01-10 2013-07-10 山东新北洋信息技术股份有限公司 Thermal printer and control method of thermal printer

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1326403A (en) * 1998-11-09 2001-12-12 西尔弗布鲁克研究有限公司 Printer and methods of operation
CN1944052A (en) * 2006-11-15 2007-04-11 深圳市润天智图像技术有限公司 Multiple grey scale printing method
CN102205706A (en) * 2010-03-15 2011-10-05 佳能株式会社 Image processor, image processing method and image printing method
CN103192609A (en) * 2012-01-10 2013-07-10 山东新北洋信息技术股份有限公司 Thermal printer and control method of thermal printer

Similar Documents

Publication Publication Date Title
US8508752B2 (en) Image data producing apparatus, image forming apparatus and computer readable medium
EP0772117B1 (en) Printer driver architecture for reducing band memory
JP3423532B2 (en) Image reading apparatus
CN1129061C (en) Printing apparatus and method
US5920685A (en) Printing machine with merging/annotating/signaturizing capability
EP1345408A3 (en) Communication apparatus connectable to information processing terminal such as personnal computer
US4811416A (en) Method for reading a document and a document reading apparatus utilizing an image buffer
EP1865409A3 (en) Information processing apparatus, print controlling method, and computer-readable storage medium
WO2001059696A3 (en) Imaging documents having static content and variable data
US8665458B2 (en) Image forming apparatus including a control unit that generates print data by carrying out a rasterizing process based on a display list, and computer readable recording medium
EP1187059B1 (en) Method and apparatus for printing computer generated images
WO2000058823A1 (en) Network system and network interface card
US5511152A (en) Memory subsystem for bitmap printer data controller
US7103833B1 (en) Image processing apparatus, output apparatus, image processing system and image processing method
GB2334356A (en) Interface card for coupling computer to peripheral
KR101278877B1 (en) Data pump for printing
US6483604B1 (en) Disk-based image storage system and method with prioritized loading and retrieval operations
US7365868B2 (en) Information processing apparatus, method of controlling printing, computer program, and printing system
JP2012248160A (en) Network printer and printing method using the same
US6731776B1 (en) Image recording apparatus
JPH099063A (en) Method and system for reading and transferring image
EP1195982A3 (en) Image processing apparatus, method of image processing, print control apparatus, and recording media
KR20020060327A (en) Apparatus for controlling printer to improve printing speed and method thereof
CN101551866B (en) Image output apparatus
JPH0628434A (en) Information processor

Legal Events

Date Code Title Description
PB01 Publication
SE01 Entry into force of request for substantive examination