Skip to content

Add XTCH 2-bit conversion support#18

Open
varo6 wants to merge 1 commit into
masterfrom
xtch
Open

Add XTCH 2-bit conversion support#18
varo6 wants to merge 1 commit into
masterfrom
xtch

Conversation

@varo6
Copy link
Copy Markdown
Owner

@varo6 varo6 commented Mar 6, 2026

Summary

  • add XTCH as a basic conversion option and emit true XTH page payloads inside XTCH containers
  • extend the dithering and worker pipelines to quantize to 4 grayscale levels for 2-bit output
  • preserve XTCH files in merge/split flows and update app copy to mention XTC/XTCH support

Verification

  • bun run build
  • bun -e "import { imageDataToXth } from './src/lib/processing/xtg.ts'; import { buildXtcFromBuffers } from './src/lib/xtc-format.ts'; import { parseXtcFile } from './src/lib/xtc-reader.ts'; const width=8, height=8; const data=new Uint8ClampedArray(widthheight4); for (let y=0; y<height; y++) { for (let x=0; x<width; x++) { const idx=(y*width+x)*4; const val=((x+y)%4)*85; data[idx]=data[idx+1]=data[idx+2]=val; data[idx+3]=255; } } const page=imageDataToXth({ width, height, data }); const xtch=await buildXtcFromBuffers([page], { is2bit: true }); const parsed=await parseXtcFile(xtch); console.log({ pageMagic:String.fromCharCode(...new Uint8Array(page).slice(0,3)), is2bit:parsed.header.is2bit, payloadMagic:String.fromCharCode(...new Uint8Array(parsed.pageData[0]).slice(0,3)) });"

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.

1 participant