Skip to content

Removes image fragmentation from bitImageColumn - #810

Open
dalpil wants to merge 1 commit into
python-escpos:masterfrom
dalpil:fix-bitimagecolumn-fragmentation
Open

dalpil wants to merge 1 commit into
python-escpos:masterfrom
dalpil:fix-bitimagecolumn-fragmentation

Conversation

@dalpil

@dalpil dalpil commented Oct 31, 2026

Copy link
Copy Markdown
Contributor

Description

The bitImageColumn (ESC *) method for printing images does not need image fragmentation, as it's already built into the command itself. Image data is always sent in chunks with a height of 8 or 24.

I also simplified the to_column_format-method a bit.

I'm not entirely sure why the line feed is being set to 16. I feel like it should be set to 24 for double-density images. This does not seem to matter though, as I can push the line feed up to 50 until i start getting white horizontal lines in my prints.

I looked into some other implementations, and most of them seem to set the line-feed to 24, but it could just as well be set to 0 it seems, at least on my printer.

Since I don't know why it's being set to 16 I'll refrain from changing it, as it doesn't seem to matter on my printer.

Anyhow, here's a comparison of two bitImageColumn-prints before and after my changes (i set fragment_height to 100 for the print on the left):

IMG_1348

Please let me know if the PR can be improved in any way, I'm open for discussion.

Closes #802.

Tested with

Epson TM-m30

Fragmentation is already built into the ESC * command, so there's no
need to fragment images.
@codecov

codecov Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.28%. Comparing base (106e251) to head (2eb0c5a).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #810      +/-   ##
==========================================
- Coverage   79.33%   79.28%   -0.05%     
==========================================
  Files          21       21              
  Lines        1742     1738       -4     
  Branches      241      241              
==========================================
- Hits         1382     1378       -4     
  Misses        282      282              
  Partials       78       78              
Flag Coverage Δ
unittests 79.28% <100.00%> (-0.05%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/escpos/escpos.py 79.33% <100.00%> (ø)
src/escpos/image.py 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Image fragmentation logic causes horizontal white stripes with "bitImageColumn" for certain fragment_height values

1 participant