-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Printer MF3228 encoded data [CCITT G4/CARPS] #23
Comments
MF3228 reportedly uses CARPS, not CAPT. The carps-cups driver would likely be the place to start. The carps.txt file documents the compression format on known devices, hopefully the MF3228 won't be too different. UPDATE: I just realised there is an existing issue on the carps-cups repo that concerns MF3228 support, I'll just link it so the others can find the really useful info you posted here: ondrej-zary/carps-cups#15 I'm afraid I won't be able to help you much at this point, as I am not yet familiar with some of the techniques used in the compression. This issue has been closed as support for this device is beyond the scope of captdriver. |
Maybe I understand what's going on with the white pages. The white pages appear to be RLE-compressed: 2360 * 3384px / A4 300 dpi (120px W, 123px H crop)Encoded in 295B * 3384 == 998280B A4 600 dpi (120px crop in both sides)The data size is twice as large as the compressed A4 300dpi white page 😁 A5 300 dpiA5 is 5.8x8.3 in == 1470x2490px raw Black pages and Black StripeBlack pages seem to have very different starting bytes for different image sizes. Both black and white pixels are referenced with The black stripe pages seem to suggest that some kind of dictionary encoding is in use, which LZ family encoders are based on. Earlier this year, I wrote a Python script Just be careful to avoid accidentally overwriting files with the script, the overwrite detection in the script is a little lacking |
Data compression by CCITT Group 4. |
I repeated your black page and white page experiments with a hand-coded SVG and an Black Page SVG ⚫ <?xml version='1.0' encoding='UTF-8' standalone='no' ?>
<svg width='210mm' height='297mm' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'>
<desc>Just a blank, black A4 page</desc>
<rect x='0' y='0' width='210mm' height='297mm' stroke='black' fill='black' />
</svg> White Page SVG ⚪ <?xml version='1.0' encoding='UTF-8' standalone='no' ?>
<svg width='210mm' height='297mm' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'>
<desc>Just a blank, white A4 page</desc>
<rect x='0' y='0' width='210mm' height='297mm' stroke='white' fill='white' />
</svg> My pipeline: rsvg-convert -f pdf -o $PDF_FILE $SVG_FILE
gs -dSAFER -dNOPAUSE -dNOPROMPT -r 600 -SDEVICE=faxg4 -o $IMAGE_FILE $PDF_FILE Try Results: |
Repeated steps and add option page size
Try decompose result from GhostScript
2560 + 2112 + 48 = 4720px. For your example A4 600dpi Black Page
I got difference ending file from GhostScript. I didn't see end-of-facsimile block (EOF). The format if EOF
A4 600dpi Black Page: |
Just in case it matters, I was using GhostScript 9.26 from late 2018, but I doubt that makes much of a difference, unlike JPEG or other lossy compression codecs. Looks like using the GS encoder as-is won't work, but it looks to me that the changes required won't be too difficult to implement. Or maybe I might have missed some option that enables LSB-first mode? (it would make things so easy if there was such a thing!) |
I found parameter |
Pls help understand encoded data printer MF3228
White pages encoded:
ff ff ff … 00 08 80
A4 300dpi, length 426 bytesff ff ff … 00 08 80
A4 600dpi, length 846 bytesff ff ff … 00 08 80
A5 300dpi, length 298 bytesBlack fill pages:
64 05 74 a0 f8 ff … ff 01 10 00 01
A4 300dpi, length 854 bytes64 05 7c 40 01 93 ff … ff 1f 00 01 10
A4 600dpi, length 1701 bytes64 05 da 60 F5 ff … ff 01 10 00 01
A5 300dpi, length 598 bytesLeft vertical black line. Origin top left corner.
All samples with format A4, 300 dpi. Width 2360px, height 3384px
Offset of the printable area relative to the left side (the origin) is 5.165mm.
Pixel width is approximately 0.085mm.
I printed samples with the Inkscape.
example data for width 5.165mm, 1px
64 d5 ff … ff 0f 80 00 08
data length 1274 bytes64 d5
01100100 11010101
0f 80 00 08
64 fd
01100100 11111101
07 40 00 04
64 ed
01100100 11101101
07 40 00 04
64 f5
01100100 11110101
0f 80 00 08
64 e5
01100100 11100101
1f 00 01 10
64 a5
01100100 10100101
1f 00 01 10
64 c5
01100100 11000101
3f 00 02 20
64 45
01100100 01000101
7f 00 04 40
64 45 ef
01100100 01000101 11101111
7f 00 04 40
64 85 fc
01100100 10000101 11111100
00 08 80
64 85 fe
01100100 10000101 11111110
00 08 80
64 85 ff
01100100 10000101 11111111
00 08 80
64 05 66 b0 fe
01100100 00000101 01100110 10110000 11111110
01 10 00 01
64 05 16 20 f9
01100100 00000101 00010110 00100000 11111001
01 10 00 01
64 05 36 60 f2
01100100 00000101 00010110 00100000 11111001
02 20 00 02
64 05 6e 30 f3
01100100 00000101 01101110 00110000 11110011
03 20 00 02
64 05 04 fa
01100100 00000101 00000100 11111010
03 20 00 02
The text was updated successfully, but these errors were encountered: