Runs fully in browser memory.
Compare text, code, and document snippets.
Compares text, code, and document snippets with split, unified, inline, and stats views.
Pre-release workspace package. No public npm install command is documented until publishing is configured.
Examples use public package imports and run in browser memory without a Pixxl server API.
Paste or type both texts.
Choose line, word, or character granularity.
Toggle case or whitespace normalization when needed.
Run compare, then switch between result views.
Package/browser API. No HTTP endpoint is exposed.
| API | Behavior |
|---|---|
compareText(input) | Returns unified diff lines and similarity stats. |
createLineComparisons(input) | Returns paired rows for side-by-side comparison. |
createInlineComparison(input) | Returns inline added/removed/same spans. |
createScrollIndicators(rows) | Returns left/right diff marker positions. |
Input uses firstText, secondText, optional granularity, ignoreCase, and ignoreWhitespace.
Output uses diff rows plus stats.additions, stats.deletions, stats.similarity.
Line numbers are optional because added rows have only newLineNumber and removed rows have only oldLineNumber.
import { compareText } from "@pixxl-tools/compare/text";
const result = compareText({
"firstText": "Pixxl tools\nCompare text",
"secondText": "Pixxl tools\nCompare documents",
"granularity": "word",
"ignoreCase": false,
"ignoreWhitespace": false
});{
"firstText": "Pixxl tools\nCompare text",
"secondText": "Pixxl tools\nCompare documents",
"granularity": "word",
"ignoreCase": false,
"ignoreWhitespace": false
}{
"stats": { "additions": 1, "deletions": 1, "similarity": 67 },
"diff": [
{ "type": "context", "content": "Pixxl tools", "oldLineNumber": 1, "newLineNumber": 1 },
{ "type": "removed", "content": "Compare text", "oldLineNumber": 2 },
{ "type": "added", "content": "Compare documents", "newLineNumber": 2 }
]
}Empty left or right text disables UI comparison.
Invalid granularity should be rejected by TypeScript; runtime defaults to line where omitted.
Huge pasted values may be slower because diff cost grows with input length.
Runs fully in browser memory.
No network or server endpoint is used.
Compare images visually and numerically.
Compares raster images visually and numerically with split, fade, slider, and difference modes.
Pre-release workspace package. No public npm install command is documented until publishing is configured.
Examples use public package imports and run in browser memory without a Pixxl server API.
Drop or choose two images.
Inspect with split, fade, slider, or difference mode.
Use zoom, pan, ruler, and cluster controls for detailed review.
Replace or remove either image without changing the route.
Package/browser API. No HTTP endpoint is exposed.
| API | Behavior |
|---|---|
compareImageData(input) | Compares RGBA pixel buffers and returns similarity, differences, clusters. |
clusterImageDifferences(points, options) | Groups nearby difference points into inspectable regions. |
JSON cannot carry typed arrays directly; encode image buffers before transport, then recreate Uint8Array or Uint8ClampedArray.
differenceThreshold is normalized from 0 to 1.
Clusters are emitted only when calculateClusters is true.
import { compareImageData } from "@pixxl-tools/compare/image";
const result = compareImageData({
"firstImage": { "data": "Uint8ClampedArray", "width": 800, "height": 600 },
"secondImage": { "data": "Uint8ClampedArray", "width": 800, "height": 600 },
"differenceThreshold": 0.05,
"calculateClusters": true
});{
"firstImage": { "data": "Uint8ClampedArray", "width": 800, "height": 600 },
"secondImage": { "data": "Uint8ClampedArray", "width": 800, "height": 600 },
"differenceThreshold": 0.05,
"calculateClusters": true
}{
"percentage": 98.42,
"totalPixels": 480000,
"differentPixels": 7584,
"comparisonWidth": 800,
"comparisonHeight": 600,
"clusters": [{ "id": 0, "centerX": 320, "centerY": 180, "pixelCount": 240 }]
}Image dimensions must be positive integers.
Pixel data length must be at least width * height * 4.
Unsupported files are rejected by the browser image loader before comparison.
Comparison samples the shared visible area when dimensions differ.
Zoom, pan, slider, fade, ruler, and difference views are UI-only state.