Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/julusian/atem-connection-image-tools
Optimised image algorithms for use with `atem-connection`
https://github.com/julusian/atem-connection-image-tools
Last synced: 23 days ago
JSON representation
Optimised image algorithms for use with `atem-connection`
- Host: GitHub
- URL: https://github.com/julusian/atem-connection-image-tools
- Owner: Julusian
- License: mit
- Created: 2023-09-17T16:28:13.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-01-28T16:19:38.000Z (12 months ago)
- Last Synced: 2024-12-01T10:24:14.647Z (about 1 month ago)
- Language: Rust
- Homepage: https://www.npmjs.com/package/@atem-connection/image-tools
- Size: 1.46 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# ATEM connection image tools
[![Node CI](https://github.com/julusian/atem-connection-image-tools/actions/workflows/CI.yaml/badge.svg)](https://github.com/julusian/atem-connection-image-tools/actions/workflows/CI.yaml)
[![npm](https://img.shields.io/npm/v/@atem-connection/image-tools)](https://www.npmjs.com/package/@atem-connection/image-tools)## Usage
This library is intended to be used as optional optimisations for atem-connection [NPM](https://www.npmjs.com/package/atem-connection) [Github](https://github.com/nrkno/sofie-atem-connection). It provides some image utilities with compiled (rust) implementations, which can be used instead of the javascript implementations used elsewhere.
### Example:
```ts
import { Atem } from 'atem-connection'
import * as fs from 'fs'
import { encodeImageForAtem } from '@atem-connection/image-tools'const conn = new Atem()
const file = fs.readFileSync('./testframe.rgba')
const encodedImage = encodeImageForAtem(1920, 1080, file, 'rgba')
conn.uploadStill(0, encodedImage, 'Test image', '').then(() => {
console.log('Uploaded!')
})// Or the less efficient method, with 'atem-connection' performing the colour conversion:
conn.uploadStill(1, file, 'Test image', '').then(() => {
console.log('Uploaded!')
})
```## Development
### Setting up
- Clone the repository
- Install a compatible version of nodejs and yarn
- Install the rust compiler with [rustup](https://rustup.rs/)
- Build the project with `yarn build`
- You can use [`yarn link`](https://yarnpkg.com/cli/link) to link this into `atem-connection`### Modifying the rust code
To rebuild the native component you can run `yarn build:rs`. If you are changing the exposed api, you should instead run `yarn build`, so that typescript can check the new typings.
There are some rust unit tests, which can be run with `yarn unit:rs`, or you can run all the unit tests with `yarn unit` (make sure to rebuild the module first!).
### Modifying the js code
You can run `yarn build:js` to rebuild the typescript code, optionally with the `--watch` parameter to re-run upon saving a file.
There are some unit tests, which can be run with `yarn unit:js`. This command calls into jest, so any jest arguments can also be used