@oh-my-pi/pi-natives 18.11.3 → 18.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -1
- package/native/index.d.ts +8 -4
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -41,13 +41,22 @@ const files = await find({
|
|
|
41
41
|
|
|
42
42
|
// SIXEL encode for a terminal cell box (px), off the JS thread
|
|
43
43
|
// (`encodeSixel` is the synchronous form)
|
|
44
|
-
const
|
|
44
|
+
const backgroundRgb = 0x202040; // Actual terminal background, packed 0xRRGGBB
|
|
45
|
+
const sequence = await encodeSixelAsync(pngBytes, widthPx, heightPx, backgroundRgb);
|
|
45
46
|
|
|
46
47
|
// Extract PDF text and identify pages that still need OCR
|
|
47
48
|
const pdf = await pdfToMarkdown(pdfBytes);
|
|
48
49
|
console.log(pdf.markdown, pdf.pagesNeedingOcr);
|
|
49
50
|
```
|
|
50
51
|
|
|
52
|
+
Both SIXEL encoder forms require the terminal background as a fourth argument,
|
|
53
|
+
packed as a 24-bit `0xRRGGBB` number. When resizing images with alpha, RGB is
|
|
54
|
+
premultiplied before Lanczos filtering so transparent pixels cannot darken or
|
|
55
|
+
discolor visible edges. After resizing, the terminal background is composited
|
|
56
|
+
without applying alpha twice. Fully transparent pixels remain transparent;
|
|
57
|
+
unscaled images retain their existing blending path. Re-encode when the terminal
|
|
58
|
+
background RGB changes.
|
|
59
|
+
|
|
51
60
|
### Lazy Windows path helpers
|
|
52
61
|
|
|
53
62
|
Import `expandWindowsLongPath` and `getWindowsShortPath` from
|
package/native/index.d.ts
CHANGED
|
@@ -1794,13 +1794,17 @@ export interface EnclosingBoundaryOptions {
|
|
|
1794
1794
|
* the calling thread.
|
|
1795
1795
|
*
|
|
1796
1796
|
* The input image is decoded and resized to the requested pixel dimensions
|
|
1797
|
-
*
|
|
1798
|
-
*
|
|
1797
|
+
* (not resampled when it already has them), then partial alpha is composited
|
|
1798
|
+
* against `background_rgb` (packed `0xRRGGBB`). Fully transparent pixels
|
|
1799
|
+
* remain transparent. Encoding uses whole 6-pixel bands: a partial last band
|
|
1800
|
+
* is dropped, see [`band_rows`]. Prefer
|
|
1801
|
+
* [`encode_sixel_async`] unless the caller cannot wait: the decode, resize
|
|
1802
|
+
* and dither block the JS thread.
|
|
1799
1803
|
*
|
|
1800
1804
|
* # Errors
|
|
1801
1805
|
* Returns an error if decoding, resizing, or SIXEL encoding fails.
|
|
1802
1806
|
*/
|
|
1803
|
-
export declare function encodeSixel(bytes: Uint8Array, targetWidthPx: number, targetHeightPx: number): string
|
|
1807
|
+
export declare function encodeSixel(bytes: Uint8Array, targetWidthPx: number, targetHeightPx: number, backgroundRgb: number): string
|
|
1804
1808
|
|
|
1805
1809
|
/**
|
|
1806
1810
|
* Same result as [`encode_sixel`], but the decode, resize and dither run on
|
|
@@ -1809,7 +1813,7 @@ export declare function encodeSixel(bytes: Uint8Array, targetWidthPx: number, ta
|
|
|
1809
1813
|
* # Errors
|
|
1810
1814
|
* Rejects if decoding, resizing, or SIXEL encoding fails.
|
|
1811
1815
|
*/
|
|
1812
|
-
export declare function encodeSixelAsync(bytes: Uint8Array, targetWidthPx: number, targetHeightPx: number): Promise<string>
|
|
1816
|
+
export declare function encodeSixelAsync(bytes: Uint8Array, targetWidthPx: number, targetHeightPx: number, backgroundRgb: number): Promise<string>
|
|
1813
1817
|
|
|
1814
1818
|
/** Tokenizer encoding to use. */
|
|
1815
1819
|
export declare enum Encoding {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oh-my-pi/pi-natives",
|
|
3
|
-
"version": "18.
|
|
3
|
+
"version": "18.12.0",
|
|
4
4
|
"description": "Native Rust bindings for PDF conversion, audio, WebRTC, grep, clipboard, image processing, syntax highlighting, PTY, and shell operations via N-API",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"homepage": "https://omp.sh",
|
|
@@ -113,11 +113,11 @@
|
|
|
113
113
|
}
|
|
114
114
|
},
|
|
115
115
|
"optionalDependencies": {
|
|
116
|
-
"@oh-my-pi/pi-natives-linux-x64": "18.
|
|
117
|
-
"@oh-my-pi/pi-natives-linux-arm64": "18.
|
|
118
|
-
"@oh-my-pi/pi-natives-darwin-x64": "18.
|
|
119
|
-
"@oh-my-pi/pi-natives-darwin-arm64": "18.
|
|
120
|
-
"@oh-my-pi/pi-natives-win32-x64": "18.
|
|
121
|
-
"@oh-my-pi/pi-natives-win32-arm64": "18.
|
|
116
|
+
"@oh-my-pi/pi-natives-linux-x64": "18.12.0",
|
|
117
|
+
"@oh-my-pi/pi-natives-linux-arm64": "18.12.0",
|
|
118
|
+
"@oh-my-pi/pi-natives-darwin-x64": "18.12.0",
|
|
119
|
+
"@oh-my-pi/pi-natives-darwin-arm64": "18.12.0",
|
|
120
|
+
"@oh-my-pi/pi-natives-win32-x64": "18.12.0",
|
|
121
|
+
"@oh-my-pi/pi-natives-win32-arm64": "18.12.0"
|
|
122
122
|
}
|
|
123
123
|
}
|