Select your printer model
addImage
Adds a raster image print command to the command buffer.
Prints Android.graphics.Bitmap class graphics.
A specified area of Android.graphics.Bitmap class graphics is binarized according to the mode, halftone, and brightness parameters and converted into a raster image.
The converted image is compressed or not compressed before transmission according to the compress parameter value.
One pixel of an image corresponds to one dot of the printer. When a transparent color is contained in the image, the background of the image is assumed to be white.
Syntax
public void addImage(Bitmap data, int x, int y, int width, int height, int color, int mode, int halftone, double brightness, int compress) throws Epos2Exception |
Parameter
data
Specifies an instance of the android.graphics.Bitmap class.
x
Specifies the horizontal start position of the print area (in pixels).
Value |
Description |
---|---|
Integer from 0 to 65534 |
Horizontal start position of the print area (in pixels) |
y
Specifies the vertical start position of the print area (in pixels).
Value |
Description |
---|---|
Integer from 0 to 65534 |
Vertical start position of the print area (in pixels) |
width
Specifies the width of the print area (in pixels).
Value |
Description |
---|---|
Integer from 1 to 65535 |
Width of the print area (in pixels). |
height
Specifies the height of the print area (in pixels).
Value |
Description |
---|---|
Integer from 1 to 65535 |
Height of the print area (in pixels). |
color
Specifies the color.
Value |
Description |
---|---|
Printer.COLOR_NONE |
No printing |
Printer.COLOR_1 |
First color |
Printer.COLOR_2 |
Second color |
Printer.COLOR_3 |
Third color |
Printer.COLOR_4 |
Fourth color |
Printer.PARAM_DEFAULT |
Specifies the default value (first color). |
mode
Specifies the color mode.
Value |
Description |
---|---|
Printer.MODE_MONO |
Monochrome (2 scales) |
Printer.MODE_GRAY16 |
Multi-gradation (16 scales) |
Printer. MODE_MONO_HIGH_DENSITY |
Monochrome (2 scales), double density |
Printer.PARAM_DEFAULT |
Specifies the default (monochrome (2 scales)). |
halftone
Specifies the halftone processing method.
Value |
Description |
---|---|
Printer.HALFTONE_DITHER |
Dithering (appropriate for printing graphics only) |
Printer.HALFTONE_ERROR_DIFFUSION |
Error diffusion (appropriate for printing text and graphics) |
Printer.HALFTONE_THRESHOLD |
Threshold (appropriate for printing text only) |
Printer.PARAM_DEFAULT |
Specifies the default (dithering). |
Effective for the monochrome (2 scales) color mode only.
brightness
Specifies the brightness compensation value.
Value |
Description |
---|---|
Real number from 0.1 to 10.0 |
Brightness compensation (gamma correction) value |
Printer.PARAM_DEFAULT |
Default (1.0) |
When a value other than 1.0 is specified for the brightness compensation value, processing gets slower.
compress
Enables or disables compression.
Compressing print images can prevent white banding or streaks from occurring on printed images.
This works well when connecting with the printer using Bluetooth.
Value |
Description |
---|---|
Printer.COMPRESS_DEFLATE |
Compresses the image. |
Printer.COMPRESS_NONE |
Does not compress the image. |
Printer.COMPRESS_AUTO |
Automatically chooses to or not to compress the image internally. |
Printer.PARAM_DEFAULT |
Default |
Exception
When the process fails, Epos2Exception with one of the following error status occurs.
Error status |
Description |
---|---|
ERR_PARAM |
An invalid parameter was passed. |
ERR_MEMORY |
Memory necessary for processing could not be allocated. |
ERR_FAILURE |
An unknown error occurred. |
Supplementary explanation
- Use this API at the "beginning of a line." If this API is used elsewhere, it will be ignored.
- If the area specified by x/y and width/height parameters does not fit within the image size specified by data parameter, ERR_PARAM will be returned as an exception.
- The "compress" parameter is effective when the printer is connected via Bluetooth. For other printers, specify Printer.COMPRESS_AUTO.
-
Model
Restriction
TM-m10
No restriction
TM-m30/TM-m30II/TM-m30II-H/TM-m30II-NT/TM-m30II-S/
TM-m30II-SL/TM-m30III/TM-m30III-HNo restriction
TM-m50/TM-m50II-H
No restriction
TM-P20/TM-P20II
No restriction
TM-P60II (Receipt)
Firmware version 5.14 ESC/POS or later
TM-P60II (Peeler)
Firmware version 6.14 ESC/POS or later
TM-P80
Firmware version 1.02 ESC/POS or later
TM-P80AC
Firmware version 2.01 ESC/POS or later
TM-P80II
No restriction
TM-T20II/TM-T20III
No restriction
TM-T70II
No restriction
TM-T82III
No restriction
TM-T88V/TM-T88VI
No restriction
- Printing may get slower if a transparent image is printed.
- The multi-gradation and the compression of image data are not supported in the page mode. If you set those in the page mode, nothing will be printed.
- Set an image size appropriate for the printer. If you set to print a large image, the API commands will be succeeded, but the printer may print nothing.
- Even if the size of an image is printable, the ERR_MEMORY error may occur depending on the Android device specification. In such case, reduce the image size.
- This API consumes a lot of the buffer provided in the printer. When using this API for LFCPrinter class, be sure to check the buffer size of the printer.
Quick Access
- [Name]
- [Format]
- [Range]
- [Description]
- [Notes]
- Introduction
- help
- Printer class
- Printer
- connect
- disconnect
- startMonitor
- stopMonitor
- getStatus
- sendData
- beginTransaction
- endTransaction
- requestPrintJobStatus
- clearCommandBuffer
- addTextAlign
- addLineSpace
- addTextRotate
- addText
- addTextLang
- addTextFont
- addTextSmooth
- addTextSize
- addTextStyle
- addHPosition
- addFeedUnit
- addFeedLine
- addImage
- addLogo
- addBarcode
- addSymbol
- addHLine
- addVLineBegin
- addVLineEnd
- addPageBegin
- addPageEnd
- addPageArea
- addPageDirection
- addPagePosition
- addPageLine
- addPageRectangle
- addRotateBegin
- addRotateEnd
- addCut
- addPulse
- addSound
- addFeedPosition
- addLayout
- addCommand
- getMaintenanceCounter
- resetMaintenanceCounter
- getPrinterSetting
- setPrinterSetting
- getPrinterSettingEx
- setPrinterSettingEx
- setPrinterSettingEx[Obsolete]
- verifyPassword
- getPrinterInformation
- downloadFirmwareList
- getPrinterFirmwareInfo
- verifyUpdate
- updateFirmware
- forceRecover
- forcePulse
- forceStopSound
- forceCommand
- forceReset
- setStatusChangeEventListener
- setReceiveEventListener
- setGetPrinterSettingExListener
- setSetPrinterSettingExListener
- setVerifyPasswordListener
- interval
- LFCPrinter class
- HybridPrinter class
- HybridPrinter
- connect
- disconnect
- startMonitor
- stopMonitor
- getStatus
- sendData
- beginTransaction
- endTransaction
- clearCommandBuffer
- selectPaperType
- waitInsertion
- cancelInsertion
- ejectPaper
- readMicrData
- cleanMicrReader
- forceRecover
- forcePulse
- forceCommand
- forceReset
- paperType
- interval
- waitTime
- mode40Cpl
- setStatusChangeEventListener
- setReceiveEventListener
- LineDisplay class
- LineDisplay
- connect
- disconnect
- getStatus
- sendData
- clearCommandBuffer
- addInitialize
- addCreateWindow
- addDestroyWindow
- addSetCurrentWindow
- addClearCurrentWindow
- addCreateScreen
- addCreateScreenCustom
- addCreateTextArea
- addDestroyTextArea
- addSetCurrentTextArea
- addClearCurrentTextArea
- addSetCursorPosition
- addMoveCursorPosition
- addSetCursorType
- addText
- addReverseText
- addMarqueeText
- addSetBlink
- addSetBrightness
- addBackgroundColor
- addStartSlideShow
- addStopSlideShow
- addDownloadImage
- addRegisterDownloadImage
- addNVImage
- addClearImage
- addSymbol
- addClearSymbol
- addShowClock
- addCommand
- setReceiveEventListener
- Keyboard class
- POSKeyboard class
- BarcodeScanner class
- MSR class
- SimpleSerial class
- GermanyFiscalElement class
- OtherPeripheral class
- CommBox class
- Common to all classes
- Discovery class
- Epos2Exception class
- Log class
- EasySelect class
- EasySelectInfo class
- Appendix
- Status list
- Key code list
- List of Supported Classes
- List of Supported APIs
- Printer-specific Support Information
- TM-m10
- TM-m30
- TM-m30II
- TM-m30II-H
- TM-m30II-NT
- TM-m30II-S
- TM-m30II-SL
- TM-m30III
- TM-m30III-H
- TM-m50
- TM-m50II
- TM-m50II-H
- TM-T20
- TM-T20II
- TM-T20III
- TM-T20IIIL
- TM-T20IV-L
- TM-T20X
- TM-T20X-II
- TM-T60
- TM-T70
- TM-T70II
- TM-T81II
- TM-T81III
- TM-T82
- TM-T82II
- TM-T82III
- TM-T82IIIL
- TM-T82IV-L
- TM-T82X
- TM-T82X-II
- TM-T83II
- TM-T83III
- TM-T83IV
- TM-T88V
- TM-T88VI
- TM-T88VII
- TM-T100
- TM-L90 Liner-Free Label Printer Model
- TM-L100
- TM-U220
- TM-U330
- EU-m30
- TM-P20
- TM-P20II
- TM-P60 (Receipt)
- TM-P60 (Peeler)
- TM-P60II (Receipt)
- TM-P60II (Peeler)
- TM-P80
- TM-P80II
- TM-H6000V
- TM-T20II-i
- TM-T70-i
- TM-T82II-i
- TM-T83II-i
- TM-T88V-i
- TM-T88VI-iHUB
- TM-U220-i
- TM-T70II-DT
- TM-T70II-DT2
- TM-T88V-DT
- TM-T88VI-DT2
- TM-H6000IV-DT
- TM-T88IV
- TM-T90
- TM-L90
- TM-H6000IV