![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
@thi.ng/geom-trace-bitmap
Advanced tools
This project is part of the @thi.ng/umbrella monorepo.
Bitmap image to hairline vector and point cloud conversions. This is a support package for @thi.ng/geom.
This package provides an extensible setup to extract user selectable
single-pixel width line segments in horizontal, vertical and diagonal (45°)
directions and/or single pixels as 2d point cloud. The main
traceBitmap()
function supports a predicate function to filter qualifying pixel values,
options to control which line orientations should be considered (incl. providing
custom ones and in which order of application), as well as a 2x3 matrix to
transform extracted points (pixel coordinates). See
TraceBitmapOpts
and example below for details.
ALPHA - bleeding edge / work-in-progress
Search or submit any issues for this package
yarn add @thi.ng/geom-trace-bitmap
ES module import:
<script type="module" src="https://cdn.skypack.dev/@thi.ng/geom-trace-bitmap"></script>
For Node.js REPL:
const geomTraceBitmap = await import("@thi.ng/geom-trace-bitmap");
Package sizes (brotli'd, pre-treeshake): ESM: 988 bytes
Several demos in this repo's /examples directory are using this package.
A selection:
Screenshot | Description | Live demo | Source |
---|---|---|---|
![]() | Multi-layer vectorization & dithering of bitmap images | Demo | Source |
TODO
For brevity, this example uses
thi.ng/pixel-io-netpbm
to load an image in PGM format. For that image format, the read()
function
returns a thi.ng/pixel
IntBuffer using the
GRAY8
pixel format...
import { asSvg, group, line, points, svgDoc } from "@thi.ng/geom";
import { traceBitmap } from "@thi.ng/geom-trace-bitmap";
import { read } from "@thi.ng/pixel-io-netpbm";
import { readFileSync, writeFileSync } from "fs";
// vectorize bitmap, the returned arrays contain:
// - pairs of vectors (line segments)
// - vectors (points)
const { lines, points: dots } = traceBitmap({
// source image (WILL be mutated!)
img: read(readFileSync("foo.pgm")),
// pixel selection predicate (here to select all bright pixels)
select: (x) => x > 128,
// process horizontals, verticals, diagonals & points (default)
// see: https://docs.thi.ng/umbrella/geom-trace-bitmap/types/TraceDir.html
dir: ["h", "v", "d1", "d2", "p"]
});
// write extracted geometry as SVG file
writeFileSync(
"export/trace.svg",
asSvg(
svgDoc(
{},
group({}, lines.map(([a,b]) => line(a, b))),
points(dots, { fill: "#000", stroke: "none" })
)
)
);
If this project contributes to an academic publication, please cite it as:
@misc{thing-geom-trace-bitmap,
title = "@thi.ng/geom-trace-bitmap",
author = "Karsten Schmidt",
note = "https://thi.ng/geom-trace-bitmap",
year = 2022
}
© 2022 - 2023 Karsten Schmidt // Apache License 2.0
FAQs
Bitmap image to hairline vector and point cloud conversions
The npm package @thi.ng/geom-trace-bitmap receives a total of 39 weekly downloads. As such, @thi.ng/geom-trace-bitmap popularity was classified as not popular.
We found that @thi.ng/geom-trace-bitmap demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.