# @dannadori/super-resolution-worker-js

> ![image](https://user-images.githubusercontent.com/48346627/128611056-978ee70c-b893-4ee6-96dd-650dec002eba.png)

Latest version **1.0.11** (published 2022-04-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install @dannadori/super-resolution-worker-js
pnpm add @dannadori/super-resolution-worker-js
yarn add @dannadori/super-resolution-worker-js
bun add @dannadori/super-resolution-worker-js
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; large bundle.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.11 |
| Published | 2022-04-30 |
| First published | 2021-08-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 17.5 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 294 |
| Author | wataru.okada@flect.co.jp |
| Maintainers | dannadori |
| Keywords | webworker, image processing, tensorflowjs, super resolution |

## Links

- npm: https://www.npmjs.com/package/@dannadori/super-resolution-worker-js
- Repository: https://github.com/w-okada/image-analyze-workers
- Homepage: https://github.com/w-okada/image-analyze-workers#readme
- Issues: https://github.com/w-okada/image-analyze-workers/issues
- npm.io page: https://npm.io/package/@dannadori/super-resolution-worker-js

## Dependencies (4)

- [buffer](https://npm.io/package/buffer.md) ^6.0.3
- [@tensorflow/tfjs](https://npm.io/package/@tensorflow/tfjs.md) ^3.16.0
- [@dannadori/worker-base](https://npm.io/package/@dannadori/worker-base.md) ^1.0.1
- [@tensorflow/tfjs-backend-wasm](https://npm.io/package/@tensorflow/tfjs-backend-wasm.md) ^3.16.0

## Alternatives

- [exif-parser](https://npm.io/package/exif-parser.md) — 3.8M weekly downloads
- [vite-plugin-compression](https://npm.io/package/vite-plugin-compression.md) — 569.5K weekly downloads
- [pica](https://npm.io/package/pica.md) — 442.4K weekly downloads
- [@reportportal/client-javascript](https://npm.io/package/@reportportal/client-javascript.md) — 408.8K weekly downloads
- [@tldraw/state](https://npm.io/package/@tldraw/state.md) — 316.0K weekly downloads

## Recent versions

- 1.0.11 (latest) — 2022-04-30
- 1.0.10 — 2022-04-25
- 1.0.9 — 2022-04-11
- 1.0.8 — 2022-04-08
- 1.0.7 — 2021-11-07
- 1.0.6 — 2021-11-02
- 1.0.5 — 2021-08-20
- 1.0.4 — 2021-08-09
- 1.0.3 — 2021-08-09
- 1.0.2 — 2021-08-07
- 1.0.1 — 2021-08-07

## README

# SuperResolution

![image](https://user-images.githubusercontent.com/48346627/128611056-978ee70c-b893-4ee6-96dd-650dec002eba.png)



## Reference
ESPCN

This repository's model is generated with the code [here](https://github.com/w-okada/espcn-tensorflow2). And this repository is inspired by [the repository](https://github.com/HighVoltageRocknRoll/sr). And some code is originally in [the repository](https://github.com/HighVoltageRocknRoll/sr).


[paper](https://arxiv.org/abs/1609.05158)

## API

```
    init: (config: SuperResolutionConfig | null) => Promise<void>;
    predict: (src: HTMLCanvasElement | HTMLImageElement | HTMLVideoElement, params?: SuperResolutionOperationParams) => Promise<Uint8Array | null>;

```

## Configuration and Parameter
```

export interface SuperResolutionConfig{
    browserType         : BrowserType
    processOnLocal      : boolean
    modelPath           : string
    workerPath          : string
    enableSIMD          : boolean

}


export interface SuperResolutionOperationParams{
    inputWidth          : number
    inputHeight         : number
    scaleFactor         : number
    interpolation       : number
    useSIMD             : boolean
}


export const InterpolationType = {
    INTER_NEAREST   :0,
    INTER_LINEAR    :1,
    INTER_AREA      :2,
    INTER_CUBIC     :3,
    INTER_LANCZOS4  :4,
    INTER_ESPCN     :100,
    CANVAS          :200,
}

```


## Step by step
### Create environment and install package
```
$ npx create-react-app demo --template typescript
$ cd demo/
$ npm install
$ npm install @dannadori/super-resolution-worker-js
$ cp node_modules/\@dannadori/super-resolution-worker-js/dist/super-resolution-worker-worker.js public/
$ mkdir -p public/static/js
$ cp node_modules/\@dannadori/super-resolution-worker-js/resources/tflite.wasm public/static/js
$ cp node_modules/\@dannadori/super-resolution-worker-js/resources/tflite-simd.wasm public/static/js
```

### Download Model
https://flect-lab-web.s3-us-west-2.amazonaws.com/P01_wokers/t13_super-resolution/models/model_x2_nopadding.tflite

https://flect-lab-web.s3-us-west-2.amazonaws.com/P01_wokers/t13_super-resolution/models/model_x3_nopadding.tflite

https://flect-lab-web.s3-us-west-2.amazonaws.com/P01_wokers/t13_super-resolution/models/model_x4_nopadding.tflite


### Add source image to public. 
In this time, the name is "srcImage.jpg"

### Edit src/App.tsx
TBD

### build and start

```
$ npm run start
```

---
_Source: https://npm.io/package/@dannadori/super-resolution-worker-js · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
