Skip to content

Commit

Permalink
0.0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
twlite committed Dec 31, 2023
1 parent c2a98ff commit 906dc3d
Show file tree
Hide file tree
Showing 29 changed files with 51 additions and 109 deletions.
53 changes: 0 additions & 53 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -162,59 +162,6 @@ jobs:
name: bindings-${{ matrix.settings.target }}
path: ${{ env.APP_NAME }}.*.node
if-no-files-found: error
# build-freebsd:
# runs-on: macos-12
# name: Build FreeBSD
# steps:
# - uses: actions/checkout@v3
# with:
# submodules: true
# - name: Build
# id: build
# uses: vmactions/freebsd-vm@v0
# env:
# DEBUG: napi:*
# RUSTUP_HOME: /usr/local/rustup
# CARGO_HOME: /usr/local/cargo
# RUSTUP_IO_THREADS: 1
# with:
# envs: DEBUG RUSTUP_HOME CARGO_HOME RUSTUP_IO_THREADS
# usesh: true
# mem: 3000
# prepare: |
# pkg install -y -f curl node libnghttp2 llvm cmake # Install the llvm package to fix the libclang error
# curl -qL https://www.npmjs.com/install.sh | sh
# npm install --location=global --ignore-scripts yarn
# curl https://sh.rustup.rs -sSf --output rustup.sh
# sh rustup.sh -y --profile minimal --default-toolchain beta
# rustup component add rustfmt
# export PATH="/usr/local/cargo/bin:$PATH"
# echo "~~~~ rustc --version ~~~~"
# rustc --version
# echo "~~~~ node -v ~~~~"
# node -v
# echo "~~~~ yarn --version ~~~~"
# yarn --version
# run: |
# export PATH="/usr/local/cargo/bin:$PATH"
# pwd
# ls -lah
# whoami
# env
# freebsd-version
# yarn install
# yarn build
# strip -x *.node
# yarn test
# rm -rf node_modules
# rm -rf target
# rm -rf .yarn/cache
# - name: Upload artifact
# uses: actions/upload-artifact@v3
# with:
# name: bindings-freebsd
# path: ${{ env.APP_NAME }}.*.node
# if-no-files-found: error
test-macOS-windows-binding:
name: Test bindings on ${{ matrix.settings.target }} - node@${{ matrix.node }}
needs:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# @neplex/vectorizer

A simple Node.js library to convert raster images into svg using [VTracer](https://github.com/visioncortex/vtracer).
A simple Node.js library to convert raster images into svg using [VTracer](https://github.com/visioncortex/vtracer), with time complexity of `O(n)`.

## Installation

Expand Down
2 changes: 1 addition & 1 deletion __test__/data/result-bw.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion __test__/data/result-firefox.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion __test__/data/result-photo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion __test__/data/result-poster.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion __test__/data/result-raw.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion __test__/data/result.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions example/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ const config = {
maxIterations: 2,
};

const begin = performance.now();
const result = await vectorize(src, config);
const end = performance.now();

console.log(`[Anime Girl Vectorization] Time: ${(end - begin).toFixed(2)}ms`);

await writeFile('./example/result.svg', result);
2 changes: 1 addition & 1 deletion example/result.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,27 @@ export const enum PathSimplifyMode {
Spline = 2
}
export interface Config {
/** True color image or binary image (black and white) */
colorMode: ColorMode
/** Hierarchial clustering or non-stacked. Only applicable to color images. */
hierarchical: Hierarchical
/** Discard patches smaller than X pixels in size (cleaner) */
filterSpeckle: number
/** The number of significant bits to use in an RGB channel (more accurate) */
colorPrecision: number
/** The color difference between gradient layers (less layers) */
layerDifference: number
/** Curve fitting mode */
mode: PathSimplifyMode
/** Minimum momentary angle (degree) to be considered a corner (smoother) */
cornerThreshold: number
/** Perform iterative subdivide smooth until all segments are shorter than this length */
lengthThreshold: number
/** The maximum number of iterations to perform */
maxIterations: number
/** Minimum angle displacement (degree) to splice a spline (less accurate) */
spliceThreshold: number
/** Number of decimal places to use in path string */
pathPrecision?: number
}
export interface RawDataConfig {
Expand Down
2 changes: 1 addition & 1 deletion npm/android-arm-eabi/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@neplex/vectorizer-android-arm-eabi",
"version": "0.0.0",
"version": "0.0.4",
"os": [
"android"
],
Expand Down
2 changes: 1 addition & 1 deletion npm/android-arm64/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@neplex/vectorizer-android-arm64",
"version": "0.0.0",
"version": "0.0.4",
"os": [
"android"
],
Expand Down
2 changes: 1 addition & 1 deletion npm/darwin-arm64/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@neplex/vectorizer-darwin-arm64",
"version": "0.0.0",
"version": "0.0.4",
"os": [
"darwin"
],
Expand Down
2 changes: 1 addition & 1 deletion npm/darwin-universal/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@neplex/vectorizer-darwin-universal",
"version": "0.0.0",
"version": "0.0.4",
"os": [
"darwin"
],
Expand Down
2 changes: 1 addition & 1 deletion npm/darwin-x64/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@neplex/vectorizer-darwin-x64",
"version": "0.0.0",
"version": "0.0.4",
"os": [
"darwin"
],
Expand Down
3 changes: 0 additions & 3 deletions npm/freebsd-x64/README.md

This file was deleted.

Loading

0 comments on commit 906dc3d

Please sign in to comment.