-
Notifications
You must be signed in to change notification settings - Fork 74
Images
- one image.
- one Bitonal implementation algorithm to define the dithering.
- one ImageWrapperInterface implementation to determine the command set to be used.
One regular image (png, jpg...)
We have two buitin implementation for this:
BitonalThreshold:
// using bitonal threshold for dithering
Bitonal algorithm = new BitonalThreshold();
BitonalOrderedDither:
Bitonal algorithm = new BitonalOrderedDither();
This implementation of ImageWrapperInterface uses esc/pos sequence: "GS 'v' '0'"
RasterBitImageWrapper imageWrapper = new RasterBitImageWrapper();
This implementation of ImageWrapperInterface uses esc/pos sequence: "GS(L"
GraphicsImageWrapper imageWrapper = new GraphicsImageWrapper();
This implementation of ImageWrapperInterface uses esc/pos sequence: "ESC '*'"
BitImageWrapper imageWrapper = new BitImageWrapper();
As you can see, we have three implementation, but wich one is the best choice? To answer this you need to know about your printer cababilities and what of this works better for you, you can test printer speed and quality of the printed image. Personally, my preference of use is RasterBitImageWrapper, then GraphicsImageWrapper and than BitImageWrapper. Besides this, not every printer recognizes all three standards and can print unexpected characters.
if you want to print ample(big) images like longs jpg/pdf receipts, then take a look at Slice image sample to see how to use the ImageHelper class
ImageHelper helper = new ImageHelper();
Bitonal algorithm = new BitonalThreshold();
GraphicsImageWrapper imageWrapper = new GraphicsImageWrapper();
helper.write(escPos, new CoffeeImageImpl(image),imageWrapper,algorithm);
escPos.feed(5).cut(EscPos.CutMode.FULL);
escPos.close();