mirror of
				https://github.com/python-escpos/python-escpos
				synced 2025-10-23 09:30:00 +00:00 
			
		
		
		
	apply fixes, mainly to whitespace ( patch by @patkan in #128 )
This commit is contained in:
		@@ -49,7 +49,7 @@ class Escpos(object):
 | 
			
		||||
        """
 | 
			
		||||
        pass
 | 
			
		||||
 | 
			
		||||
    def image(self, img_source, high_density_vertical = True, high_density_horizontal = True, impl = "bitImageRaster"):
 | 
			
		||||
    def image(self, img_source, high_density_vertical=True, high_density_horizontal=True, impl="bitImageRaster"):
 | 
			
		||||
        """ Print an image
 | 
			
		||||
 | 
			
		||||
        :param img_source: PIL image or filename to load: `jpg`, `gif`, `png` or `bmp`
 | 
			
		||||
@@ -78,12 +78,11 @@ class Escpos(object):
 | 
			
		||||
        if impl == "bitImageColumn":
 | 
			
		||||
            # ESC *, column format bit image
 | 
			
		||||
            density_byte = (1 if high_density_horizontal else 0) + (32 if high_density_vertical else 0)
 | 
			
		||||
            header = ESC + b"*" + six.int2byte(density_byte) + self._int_low_high( im.width, 2 )
 | 
			
		||||
            outp = []
 | 
			
		||||
            outp.append(ESC + b"3" + six.int2byte(16)) # Adjust line-feed size
 | 
			
		||||
            header = ESC + b"*" + six.int2byte(density_byte) + self._int_low_high(im.width, 2)
 | 
			
		||||
            outp = [ESC + b"3" + six.int2byte(16)]  # Adjust line-feed size
 | 
			
		||||
            for blob in im.to_column_format(high_density_vertical):
 | 
			
		||||
                outp.append(header + blob + b"\n")
 | 
			
		||||
            outp.append(ESC + b"2"); # Reset line-feed size
 | 
			
		||||
            outp.append(ESC + b"2")  # Reset line-feed size
 | 
			
		||||
            self._raw(b''.join(outp))
 | 
			
		||||
 | 
			
		||||
    def _image_send_graphics_data(self, m, fn, data):
 | 
			
		||||
@@ -136,7 +135,7 @@ class Escpos(object):
 | 
			
		||||
            self.image(im)
 | 
			
		||||
            return
 | 
			
		||||
        # Native 2D code printing
 | 
			
		||||
        cn = b'1' # Code type for QR code
 | 
			
		||||
        cn = b'1'  # Code type for QR code
 | 
			
		||||
        # Select model: 1, 2 or micro.
 | 
			
		||||
        self._send_2d_code_data(six.int2byte(65), cn, six.int2byte(48 + model) + six.int2byte(0))
 | 
			
		||||
        # Set dot size.
 | 
			
		||||
 
 | 
			
		||||
@@ -10,6 +10,7 @@ This module contains the image format handler :py:class:`EscposImage`.
 | 
			
		||||
 | 
			
		||||
from PIL import Image, ImageOps
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class EscposImage(object):
 | 
			
		||||
    """
 | 
			
		||||
    Load images in, and output ESC/POS formats.
 | 
			
		||||
@@ -64,7 +65,7 @@ class EscposImage(object):
 | 
			
		||||
        _, height_pixels = self._im.size
 | 
			
		||||
        return height_pixels
 | 
			
		||||
 | 
			
		||||
    def to_column_format(self, high_density_vertical = True):
 | 
			
		||||
    def to_column_format(self, high_density_vertical=True):
 | 
			
		||||
        """
 | 
			
		||||
        Extract slices of an image as equal-sized blobs of column-format data.
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user