@plurid/enhanced-image-in-out
v0.0.0-0
Published
Enhanced Image Input/Output
Downloads
2
Readme
The enhaced image input/output
package provides utility for the enhanced image format .eimg
.
Contents
Install
To install the enhaced image input/output
package run
npm install @plurid/enhanced-image-io
or
yarn add @plurid/enhanced-image-io
Usage
Import Reader
and Writer
and use accordingly.
import {
promises as fs,
} from 'fs';
import {
// Objects.
Reader,
Writer,
// Interface.
PartialHeader,
} from '@plurid/enhanced-image-io`;
// Local paths to images.
const jpgImage = '/path/to/jpg/image';
const eimgImage = '/path/to/eimg/image';
const main = async () => {
// Reading an .eimg and writing the image it enhances to a separate file.
{
const reader = new Reader(eimgImage);
const data = await reader.read();
// Use the header data.
console.log('eimg header', data.header);
const jpgPath = 'eimg.jpg';
await fs.writeFile(
jpgPath,
data.image,
);
}
// Writing an .eimg from a .jpg with a custom header.
{
const customHeader: PartialHeader = {
// ...
// header data
// ...
};
const image = await fs.readFile(jpgImage);
const writer = new Writer(
customHeader,
image,
);
const eimgPath = 'jpg.eimg';
const result = await writer.write(
eimgPath,
);
if (result) {
console.log('Enhanced Image written succesfully to', eimgPath);
} else {
console.log('Enhanced Image written unsuccesfully.');
}
}
}
main();
Features
Viewing
Enhanced Images can be viewed natively using the viewer application.
Enhanced Images can be viewed in browser using the browser extension:
Depict
Enhanced Image uses plurid's depict services for text extraction. A custom API endpoint can be used, provided it uses GraphQL and implements the schema.
Packages
@plurid/enhanced-image-react • implementation for React
@plurid/enhanced-image-io • input/output operations