Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
@digitalmasterpieces/styles-client
Advanced tools
Client for processing images via the Stylization-as-a-Service REST API by Digital Masterpieces GmbH.
@digitalmasterpieces/
Client for processing images via the Stylization-as-a-Service REST API by Digital Masterpieces GmbH.
You can install the StylesClient using NPM or Yarn to get the latest version of our library.
npm install @digitalmasterpieces/styles-client
For usage from a CDN we recommend using Skypack CDN. The StylesClient package is accessable at the following URL:
https://cdn.skypack.dev/@digitalmasterpieces/styles-client
When using the CDN URL you need to add your script tag of type module
to the HTML. Then you can initialize the client as follows:
import StylesClient from "https://cdn.skypack.dev/@digitalmasterpieces/styles-client";
const client = new StylesClient({
apiKey: { id: "<your-key-id>", key: "<your-api-key>" },
});
Otherwise, when using Node.js in combination with TypeScript or ES modules:
import StylesClient from "@digitalmasterpieces/styles-client";
const client = new StylesClient({
apiKey: { id: "<your-key-id>", key: "<your-api-key>" },
});
With the client initialized you can use it as follows:
import { Pipeline } from "@digitalmasterpieces/styles-client";
// Get a list of all available processing operations
const operations = await client.getOperations();
// Get a specific operation you want to use for processing
const operation = await client.getOperation(operations[0].id);
// Create a processing pipeline and use it for processing an image
const pipeline = new Pipeline();
pipeline.add(operation);
const image = /* your image to process */
const processedImage = await client.process(image, pipeline);
When using the client in browser your image
should be a File
. When you use the client on server-side with Node.js you could use either a Buffer
or a Readable
stream.
In browser this could look like:
const image = document.querySelector("#file-input").files[0];
In Node.js you could achieve it with the following:
// Using an image from file system as a readable stream
const image = {
data: fs.createReadStream(path.join(IMAGE_DIR, "image.png")),
mimetype: "image/png",
name: "image.png",
};
// Using an image from file system as a buffer
const image = {
data: fs.readFileSync(path.join(IMAGE_DIR, "image.png")),
mimetype: "image/png",
name: "image.png",
};
The full documentation with some usage examples is available here.
To learn more about the Stylization SDK visit our homepage at https://saas.digitalmasterpieces.com.
Get your own API key here.
Try our demo application here.
FAQs
Client for processing images via the Stylization-as-a-Service REST API by Digital Masterpieces GmbH.
We found that @digitalmasterpieces/styles-client demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers 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
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.