apexify.js 4.8.2 → 4.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/tsconfig.esm.tsbuildinfo +1 -1
- package/lib/ai/ApexAI.ts +4 -4
- package/lib/ai/ApexModules.ts +8 -8
- package/lib/ai/modals/electronHub/chatmodels.ts +1 -1
- package/lib/ai/modals/electronHub/imageModels.ts +2 -2
- package/lib/ai/modals/electronHub/speechModels.ts +1 -1
- package/lib/ai/utils.ts +3 -3
- package/lib/canvas/ApexPainter.ts +1 -1
- package/lib/canvas/utils/Background/bg.ts +1 -1
- package/lib/canvas/utils/Charts/charts.ts +1 -1
- package/lib/canvas/utils/Custom/customLines.ts +2 -2
- package/lib/canvas/utils/General/general functions.ts +1 -1
- package/lib/canvas/utils/Image/imageProperties.ts +1 -1
- package/lib/canvas/utils/Texts/textProperties.ts +1 -1
- package/lib/canvas/utils/utils.ts +8 -8
- package/lib/index.ts +5 -5
- package/lib/utils.ts +3 -3
- package/package.json +5 -5
- package/dist/cjs/ai/ApexAI.d.ts +0 -144
- package/dist/cjs/ai/ApexAI.js +0 -486
- package/dist/cjs/ai/ApexModules.d.ts +0 -52
- package/dist/cjs/ai/ApexModules.js +0 -811
- package/dist/cjs/ai/functions/readFiles.d.ts +0 -1
- package/dist/cjs/ai/functions/readFiles.js +0 -56
- package/dist/cjs/ai/functions/tokenizer.d.ts +0 -9
- package/dist/cjs/ai/functions/tokenizer.js +0 -60
- package/dist/cjs/ai/functions/validOptions.d.ts +0 -21
- package/dist/cjs/ai/functions/validOptions.js +0 -93
- package/dist/cjs/ai/modals/electronHub/chatmodels.d.ts +0 -6
- package/dist/cjs/ai/modals/electronHub/chatmodels.js +0 -44
- package/dist/cjs/ai/modals/electronHub/imageModels.d.ts +0 -11
- package/dist/cjs/ai/modals/electronHub/imageModels.js +0 -85
- package/dist/cjs/ai/modals/electronHub/songModels.d.ts +0 -1
- package/dist/cjs/ai/modals/electronHub/songModels.js +0 -1
- package/dist/cjs/ai/modals/electronHub/speechModels.d.ts +0 -6
- package/dist/cjs/ai/modals/electronHub/speechModels.js +0 -56
- package/dist/cjs/ai/modals/electronHub/videoModels.d.ts +0 -5
- package/dist/cjs/ai/modals/electronHub/videoModels.js +0 -56
- package/dist/cjs/ai/modals/groq/chatgroq.d.ts +0 -8
- package/dist/cjs/ai/modals/groq/chatgroq.js +0 -57
- package/dist/cjs/ai/modals/groq/imageAnalyzer.d.ts +0 -7
- package/dist/cjs/ai/modals/groq/imageAnalyzer.js +0 -75
- package/dist/cjs/ai/modals/groq/whisper.d.ts +0 -4
- package/dist/cjs/ai/modals/groq/whisper.js +0 -101
- package/dist/cjs/ai/modals/hercai/chatModels.d.ts +0 -6
- package/dist/cjs/ai/modals/hercai/chatModels.js +0 -19
- package/dist/cjs/ai/utils.d.ts +0 -4
- package/dist/cjs/ai/utils.js +0 -4
- package/dist/cjs/canvas/ApexPainter.d.ts +0 -144
- package/dist/cjs/canvas/ApexPainter.js +0 -900
- package/dist/cjs/canvas/utils/Background/bg.d.ts +0 -30
- package/dist/cjs/canvas/utils/Background/bg.js +0 -151
- package/dist/cjs/canvas/utils/Charts/charts.d.ts +0 -7
- package/dist/cjs/canvas/utils/Charts/charts.js +0 -455
- package/dist/cjs/canvas/utils/Custom/customLines.d.ts +0 -2
- package/dist/cjs/canvas/utils/Custom/customLines.js +0 -105
- package/dist/cjs/canvas/utils/General/conversion.d.ts +0 -5
- package/dist/cjs/canvas/utils/General/conversion.js +0 -26
- package/dist/cjs/canvas/utils/General/general functions.d.ts +0 -38
- package/dist/cjs/canvas/utils/General/general functions.js +0 -590
- package/dist/cjs/canvas/utils/Image/imageProperties.d.ts +0 -114
- package/dist/cjs/canvas/utils/Image/imageProperties.js +0 -590
- package/dist/cjs/canvas/utils/Texts/textProperties.d.ts +0 -16
- package/dist/cjs/canvas/utils/Texts/textProperties.js +0 -154
- package/dist/cjs/canvas/utils/types.d.ts +0 -621
- package/dist/cjs/canvas/utils/types.js +0 -5
- package/dist/cjs/canvas/utils/utils.d.ts +0 -18
- package/dist/cjs/canvas/utils/utils.js +0 -17
- package/dist/cjs/index.d.ts +0 -28
- package/dist/cjs/index.js +0 -67
- package/dist/cjs/utils.d.ts +0 -4
- package/dist/cjs/utils.js +0 -4
- package/dist/esm/ai/ApexAI.d.ts +0 -144
- package/dist/esm/ai/ApexAI.js +0 -486
- package/dist/esm/ai/ApexModules.d.ts +0 -52
- package/dist/esm/ai/ApexModules.js +0 -811
- package/dist/esm/ai/functions/readFiles.d.ts +0 -1
- package/dist/esm/ai/functions/readFiles.js +0 -56
- package/dist/esm/ai/functions/tokenizer.d.ts +0 -9
- package/dist/esm/ai/functions/tokenizer.js +0 -60
- package/dist/esm/ai/functions/validOptions.d.ts +0 -21
- package/dist/esm/ai/functions/validOptions.js +0 -93
- package/dist/esm/ai/modals/electronHub/chatmodels.d.ts +0 -6
- package/dist/esm/ai/modals/electronHub/chatmodels.js +0 -44
- package/dist/esm/ai/modals/electronHub/imageModels.d.ts +0 -11
- package/dist/esm/ai/modals/electronHub/imageModels.js +0 -85
- package/dist/esm/ai/modals/electronHub/songModels.d.ts +0 -1
- package/dist/esm/ai/modals/electronHub/songModels.js +0 -1
- package/dist/esm/ai/modals/electronHub/speechModels.d.ts +0 -6
- package/dist/esm/ai/modals/electronHub/speechModels.js +0 -56
- package/dist/esm/ai/modals/electronHub/videoModels.d.ts +0 -5
- package/dist/esm/ai/modals/electronHub/videoModels.js +0 -56
- package/dist/esm/ai/modals/groq/chatgroq.d.ts +0 -8
- package/dist/esm/ai/modals/groq/chatgroq.js +0 -57
- package/dist/esm/ai/modals/groq/imageAnalyzer.d.ts +0 -7
- package/dist/esm/ai/modals/groq/imageAnalyzer.js +0 -75
- package/dist/esm/ai/modals/groq/whisper.d.ts +0 -4
- package/dist/esm/ai/modals/groq/whisper.js +0 -101
- package/dist/esm/ai/modals/hercai/chatModels.d.ts +0 -6
- package/dist/esm/ai/modals/hercai/chatModels.js +0 -19
- package/dist/esm/ai/utils.d.ts +0 -4
- package/dist/esm/ai/utils.js +0 -4
- package/dist/esm/canvas/ApexPainter.d.ts +0 -144
- package/dist/esm/canvas/ApexPainter.js +0 -900
- package/dist/esm/canvas/utils/Background/bg.d.ts +0 -30
- package/dist/esm/canvas/utils/Background/bg.js +0 -151
- package/dist/esm/canvas/utils/Charts/charts.d.ts +0 -7
- package/dist/esm/canvas/utils/Charts/charts.js +0 -455
- package/dist/esm/canvas/utils/Custom/customLines.d.ts +0 -2
- package/dist/esm/canvas/utils/Custom/customLines.js +0 -105
- package/dist/esm/canvas/utils/General/conversion.d.ts +0 -5
- package/dist/esm/canvas/utils/General/conversion.js +0 -26
- package/dist/esm/canvas/utils/General/general functions.d.ts +0 -38
- package/dist/esm/canvas/utils/General/general functions.js +0 -590
- package/dist/esm/canvas/utils/Image/imageProperties.d.ts +0 -114
- package/dist/esm/canvas/utils/Image/imageProperties.js +0 -590
- package/dist/esm/canvas/utils/Texts/textProperties.d.ts +0 -16
- package/dist/esm/canvas/utils/Texts/textProperties.js +0 -154
- package/dist/esm/canvas/utils/types.d.ts +0 -621
- package/dist/esm/canvas/utils/types.js +0 -5
- package/dist/esm/canvas/utils/utils.d.ts +0 -18
- package/dist/esm/canvas/utils/utils.js +0 -17
- package/dist/esm/index.d.ts +0 -28
- package/dist/esm/index.js +0 -67
- package/dist/esm/utils.d.ts +0 -4
- package/dist/esm/utils.js +0 -4
- package/lib/ai/modals/electronHub/songModels.ts +0 -0
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import Groq from "groq-sdk";
|
|
2
|
-
import axios from "axios";
|
|
3
|
-
import fs from "fs";
|
|
4
|
-
import path from "path";
|
|
5
|
-
async function convertUrlToDataUrl(url) {
|
|
6
|
-
try {
|
|
7
|
-
const response = await axios.get(url, { responseType: "arraybuffer" });
|
|
8
|
-
const buffer = Buffer.from(response.data, "binary");
|
|
9
|
-
return `data:${response.headers["content-type"]};base64,${buffer.toString("base64")}`;
|
|
10
|
-
}
|
|
11
|
-
catch (error) {
|
|
12
|
-
console.error("Error converting URL to Data URL:", error);
|
|
13
|
-
throw new Error("Failed to convert image URL to data URL");
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
async function convertFileToDataUrl(filePath) {
|
|
17
|
-
try {
|
|
18
|
-
const absolutePath = path.resolve(filePath);
|
|
19
|
-
const buffer = fs.readFileSync(absolutePath);
|
|
20
|
-
const mimeType = "image/png";
|
|
21
|
-
return `data:${mimeType};base64,${buffer.toString("base64")}`;
|
|
22
|
-
}
|
|
23
|
-
catch (error) {
|
|
24
|
-
console.error("Error converting file to Data URL:", error);
|
|
25
|
-
throw new Error("Failed to convert file to data URL");
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
function convertBufferToDataUrl(buffer) {
|
|
29
|
-
const mimeType = "image/png"; // Adjust dynamically if needed
|
|
30
|
-
return `data:${mimeType};base64,${buffer.toString("base64")}`;
|
|
31
|
-
}
|
|
32
|
-
export async function groqAnalyzer({ img, ApiKey, prompt }) {
|
|
33
|
-
try {
|
|
34
|
-
const groq = new Groq({
|
|
35
|
-
apiKey: ApiKey || "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",
|
|
36
|
-
});
|
|
37
|
-
let imageDataUrl;
|
|
38
|
-
if (typeof img === "string") {
|
|
39
|
-
if (img.startsWith("http")) {
|
|
40
|
-
imageDataUrl = await convertUrlToDataUrl(img);
|
|
41
|
-
}
|
|
42
|
-
else {
|
|
43
|
-
imageDataUrl = await convertFileToDataUrl(img);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
else if (Buffer.isBuffer(img)) {
|
|
47
|
-
imageDataUrl = convertBufferToDataUrl(img);
|
|
48
|
-
}
|
|
49
|
-
else {
|
|
50
|
-
throw new Error("Invalid image input. Must be a URL, file path, or Buffer.");
|
|
51
|
-
}
|
|
52
|
-
const chatCompletion = await groq.chat.completions.create({
|
|
53
|
-
messages: [
|
|
54
|
-
{
|
|
55
|
-
role: "user",
|
|
56
|
-
content: [
|
|
57
|
-
{ type: "text", text: prompt || "" },
|
|
58
|
-
{ type: "image_url", image_url: { url: imageDataUrl } },
|
|
59
|
-
],
|
|
60
|
-
},
|
|
61
|
-
],
|
|
62
|
-
model: "llama-3.2-90b-vision-preview",
|
|
63
|
-
temperature: 0,
|
|
64
|
-
max_tokens: 8192,
|
|
65
|
-
top_p: 1,
|
|
66
|
-
stream: false,
|
|
67
|
-
stop: null,
|
|
68
|
-
});
|
|
69
|
-
return chatCompletion.choices[0].message.content;
|
|
70
|
-
}
|
|
71
|
-
catch (error) {
|
|
72
|
-
console.error("Error in groqAnalyzer:", error);
|
|
73
|
-
return "❌ Error occurred while analyzing the image.";
|
|
74
|
-
}
|
|
75
|
-
}
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import Groq from "groq-sdk";
|
|
2
|
-
import fs from "fs";
|
|
3
|
-
import path from "path";
|
|
4
|
-
import { URL } from "url";
|
|
5
|
-
import https from "https";
|
|
6
|
-
/**
|
|
7
|
-
* Gets the file size of a given path.
|
|
8
|
-
*/
|
|
9
|
-
function getFileSize(filePath) {
|
|
10
|
-
return fs.statSync(filePath).size;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Creates a readable stream from a local file or a remote URL.
|
|
14
|
-
*/
|
|
15
|
-
async function createReadableStream(filepathOrUrl) {
|
|
16
|
-
const maxFileSizeBytes = 25 * 1024 * 1024; // 25MB limit
|
|
17
|
-
if (filepathOrUrl.startsWith("http")) {
|
|
18
|
-
const parsedUrl = new URL(filepathOrUrl);
|
|
19
|
-
const fileExtension = path.extname(parsedUrl.pathname);
|
|
20
|
-
const tempFilePath = `temp-file-${Date.now()}${fileExtension}`;
|
|
21
|
-
return new Promise((resolve, reject) => {
|
|
22
|
-
const file = fs.createWriteStream(tempFilePath);
|
|
23
|
-
const request = https.get(filepathOrUrl, (response) => {
|
|
24
|
-
let fileSize = 0;
|
|
25
|
-
response.on("data", (chunk) => {
|
|
26
|
-
fileSize += chunk.length;
|
|
27
|
-
if (fileSize > maxFileSizeBytes) {
|
|
28
|
-
request.destroy();
|
|
29
|
-
file.close();
|
|
30
|
-
fs.unlink(tempFilePath, () => resolve({ stream: null, error: "File size exceeds the limit (25MB)" }));
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
response.pipe(file);
|
|
35
|
-
file.on("finish", () => {
|
|
36
|
-
file.close();
|
|
37
|
-
resolve({ stream: fs.createReadStream(tempFilePath), tempFilePath }); // ✅ Ensure fs.ReadStream
|
|
38
|
-
});
|
|
39
|
-
});
|
|
40
|
-
request.on("error", (err) => {
|
|
41
|
-
fs.unlink(tempFilePath, () => reject(err));
|
|
42
|
-
});
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
46
|
-
if (getFileSize(filepathOrUrl) > maxFileSizeBytes) {
|
|
47
|
-
return { stream: null, error: "File size exceeds the limit (25MB)" };
|
|
48
|
-
}
|
|
49
|
-
return { stream: fs.createReadStream(filepathOrUrl) }; // ✅ Ensure fs.ReadStream
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Transcribes audio using Groq Whisper API.
|
|
54
|
-
*/
|
|
55
|
-
export async function whisper(prompt, filepath, lang, API_KEY) {
|
|
56
|
-
try {
|
|
57
|
-
const groq = new Groq({
|
|
58
|
-
apiKey: API_KEY || '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',
|
|
59
|
-
});
|
|
60
|
-
// Ensure filepath is properly resolved
|
|
61
|
-
const resolvedFilePath = filepath.startsWith("http") || path.isAbsolute(filepath)
|
|
62
|
-
? filepath
|
|
63
|
-
: path.join(process.cwd(), filepath);
|
|
64
|
-
const { stream: fileStream, tempFilePath, error } = await createReadableStream(resolvedFilePath);
|
|
65
|
-
if (error)
|
|
66
|
-
return error;
|
|
67
|
-
if (!fileStream)
|
|
68
|
-
return "Failed to create a readable file stream.";
|
|
69
|
-
// ✅ Ensure `fileStream` is a valid `fs.ReadStream`
|
|
70
|
-
const transcription = await groq.audio.transcriptions.create({
|
|
71
|
-
file: fileStream, // ✅ Ensure correct type
|
|
72
|
-
model: "whisper-large-v3-turbo",
|
|
73
|
-
prompt: prompt,
|
|
74
|
-
temperature: 1,
|
|
75
|
-
language: lang || "eng",
|
|
76
|
-
response_format: "verbose_json",
|
|
77
|
-
});
|
|
78
|
-
// ✅ Delete the temp file if it was downloaded from a URL
|
|
79
|
-
if (tempFilePath && fs.existsSync(tempFilePath)) {
|
|
80
|
-
fs.unlinkSync(tempFilePath);
|
|
81
|
-
}
|
|
82
|
-
return transcription.text;
|
|
83
|
-
}
|
|
84
|
-
catch (err) {
|
|
85
|
-
if (err?.status) {
|
|
86
|
-
switch (err.status) {
|
|
87
|
-
case 400:
|
|
88
|
-
return "Bad request, try again after a minute.";
|
|
89
|
-
case 429:
|
|
90
|
-
return "Rate limit exceeded, try again later or provide your own API key.";
|
|
91
|
-
case 401:
|
|
92
|
-
return "Invalid API key provided.";
|
|
93
|
-
default:
|
|
94
|
-
console.error(err);
|
|
95
|
-
return "An unknown error occurred.";
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
console.error(err);
|
|
99
|
-
return "An unknown error occurred.";
|
|
100
|
-
}
|
|
101
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
type hercaiModels = "v3" | "v3-32k" | "turbo" | "turbo-16k" | "gemini" | "llama3-70b" | "llama3-8b" | "mixtral-8x7b" | "gemma-7b" | "gemma2-9b";
|
|
2
|
-
export declare function chatHercai(prompt: string, model: hercaiModels, instructions?: string, memory?: {
|
|
3
|
-
enable?: boolean;
|
|
4
|
-
id?: string;
|
|
5
|
-
}): Promise<string>;
|
|
6
|
-
export {};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { Hercai } from "hercai";
|
|
2
|
-
const hercai = new Hercai('6eZZOdDwm6Epdzn8mnhcX9SBDkxvoNYcNj9ILS0P44=');
|
|
3
|
-
export async function chatHercai(prompt, model, instructions, memory) {
|
|
4
|
-
try {
|
|
5
|
-
if (memory && memory.enable && memory.id) {
|
|
6
|
-
return (await hercai.betaQuestion({ content: prompt, user: memory.id })).reply;
|
|
7
|
-
}
|
|
8
|
-
else if (["v3", "v3-32k", "turbo", "turbo-16k", "gemini", "llama3-70b", "llama3-8b", "mixtral-8x7b", "gemma-7b", "gemma2-9b"].includes(model)) {
|
|
9
|
-
return (await hercai.question({ model, content: prompt, personality: instructions })).reply;
|
|
10
|
-
}
|
|
11
|
-
else {
|
|
12
|
-
throw new Error('Invalid model name.');
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
catch (e) {
|
|
16
|
-
console.error(e.message);
|
|
17
|
-
return 'An Error has occurred in the API';
|
|
18
|
-
}
|
|
19
|
-
}
|
package/dist/esm/ai/utils.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { readFile } from "./functions/readFiles.js";
|
|
2
|
-
import { ApexChat, ApexImagine, ApexListener, ApexVideo, ApexText2Speech, resetHistory } from "./ApexModules.js";
|
|
3
|
-
import { groqAnalyzer } from "./modals/groq/imageAnalyzer.js";
|
|
4
|
-
export { readFile, ApexChat, ApexImagine, ApexListener, groqAnalyzer, ApexVideo, ApexText2Speech, resetHistory };
|
package/dist/esm/ai/utils.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { readFile } from "./functions/readFiles.js";
|
|
2
|
-
import { ApexChat, ApexImagine, ApexListener, ApexVideo, ApexText2Speech, resetHistory } from "./ApexModules.js";
|
|
3
|
-
import { groqAnalyzer } from "./modals/groq/imageAnalyzer.js";
|
|
4
|
-
export { readFile, ApexChat, ApexImagine, ApexListener, groqAnalyzer, ApexVideo, ApexText2Speech, resetHistory };
|
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
import { PathLike } from "fs";
|
|
2
|
-
import { OutputFormat, CanvasConfig, TextObject, ImageProperties, GIFOptions, GIFResults, CustomOptions, cropOptions, Frame, PatternOptions, ExtractFramesOptions, ResizeOptions, MaskOptions, BlendOptions } from "./utils/utils.js";
|
|
3
|
-
interface CanvasResults {
|
|
4
|
-
buffer: Buffer;
|
|
5
|
-
canvas: CanvasConfig;
|
|
6
|
-
}
|
|
7
|
-
export declare class ApexPainter {
|
|
8
|
-
private format?;
|
|
9
|
-
constructor({ type }?: OutputFormat);
|
|
10
|
-
/**
|
|
11
|
-
* Creates a canvas with the given configuration.
|
|
12
|
-
* Applies rotation, shadow, border effects, background, and stroke.
|
|
13
|
-
*
|
|
14
|
-
* @param canvas - The configuration options for the canvas.
|
|
15
|
-
* @returns A promise that resolves to an object containing the image buffer and the canvas config.
|
|
16
|
-
* @throws If the 2D context cannot be retrieved.
|
|
17
|
-
*/
|
|
18
|
-
createCanvas(canvas: CanvasConfig): Promise<CanvasResults>;
|
|
19
|
-
/**
|
|
20
|
-
* Draws one or more images (or shapes) on an existing canvas buffer.
|
|
21
|
-
* @param images - A single image properties object or an array of them.
|
|
22
|
-
* @param canvasBuffer - A Buffer or a CanvasResults object containing a buffer.
|
|
23
|
-
* @returns A promise that resolves to a Buffer representing the updated canvas.
|
|
24
|
-
*/
|
|
25
|
-
createImage(images: ImageProperties | ImageProperties[], canvasBuffer: CanvasResults | Buffer): Promise<Buffer>;
|
|
26
|
-
createText(textOptionsArray: TextObject[], buffer: CanvasResults | Buffer): Promise<Buffer>;
|
|
27
|
-
createCustom(options: CustomOptions[], buffer: CanvasResults | Buffer): Promise<Buffer>;
|
|
28
|
-
createGIF(gifFrames: {
|
|
29
|
-
background: string;
|
|
30
|
-
duration: number;
|
|
31
|
-
}[], options: GIFOptions): Promise<GIFResults | any>;
|
|
32
|
-
resize(resizeOptions: ResizeOptions): Promise<Buffer<ArrayBufferLike>>;
|
|
33
|
-
imgConverter(source: string, newExtension: string): Promise<Buffer<ArrayBufferLike>>;
|
|
34
|
-
effects(source: string, filters: any[]): Promise<Buffer<ArrayBufferLike>>;
|
|
35
|
-
colorsFilter(source: string, filterColor: any, opacity?: number): Promise<any>;
|
|
36
|
-
colorAnalysis(source: string): Promise<{
|
|
37
|
-
color: string;
|
|
38
|
-
frequency: string;
|
|
39
|
-
}[]>;
|
|
40
|
-
colorsRemover(source: string, colorToRemove: {
|
|
41
|
-
red: number;
|
|
42
|
-
green: number;
|
|
43
|
-
blue: number;
|
|
44
|
-
}): Promise<Buffer<ArrayBufferLike> | undefined>;
|
|
45
|
-
removeBackground(imageURL: string, apiKey: string): Promise<Buffer<ArrayBufferLike> | undefined>;
|
|
46
|
-
blend(layers: {
|
|
47
|
-
image: string | Buffer;
|
|
48
|
-
blendMode: 'source-over' | 'source-in' | 'source-out' | 'source-atop' | 'destination-over' | 'destination-in' | 'destination-out' | 'destination-atop' | 'lighter' | 'copy' | 'xor' | 'multiply' | 'screen' | 'overlay' | 'darken' | 'lighten' | 'color-dodge' | 'color-burn' | 'hard-light' | 'soft-light' | 'difference' | 'exclusion' | 'hue' | 'saturation' | 'color' | 'luminosity';
|
|
49
|
-
position?: {
|
|
50
|
-
x: number;
|
|
51
|
-
y: number;
|
|
52
|
-
};
|
|
53
|
-
opacity?: number;
|
|
54
|
-
}[], baseImageBuffer: Buffer, defaultBlendMode?: 'source-over' | 'source-in' | 'source-out' | 'source-atop' | 'destination-over' | 'destination-in' | 'destination-out' | 'destination-atop' | 'lighter' | 'copy' | 'xor' | 'multiply' | 'screen' | 'overlay' | 'darken' | 'lighten' | 'color-dodge' | 'color-burn' | 'hard-light' | 'soft-light' | 'difference' | 'exclusion' | 'hue' | 'saturation' | 'color' | 'luminosity'): Promise<Buffer>;
|
|
55
|
-
createChart(data: any, type: {
|
|
56
|
-
chartType: string;
|
|
57
|
-
chartNumber: number;
|
|
58
|
-
}): Promise<Buffer<ArrayBufferLike> | undefined>;
|
|
59
|
-
cropImage(options: cropOptions): Promise<Buffer>;
|
|
60
|
-
private drawImage;
|
|
61
|
-
extractFrames(videoSource: string | Buffer, options: ExtractFramesOptions): Promise<any[]>;
|
|
62
|
-
/**
|
|
63
|
-
* Sets a pattern on a specific area of a buffered image.
|
|
64
|
-
* @param {Buffer} buffer - The source image buffer.
|
|
65
|
-
* @param {Object} options - Options to customize the pattern.
|
|
66
|
-
* @returns {Promise<Buffer>} - The adjusted image buffer.
|
|
67
|
-
*/
|
|
68
|
-
patterns(buffer: Buffer, options: PatternOptions): Promise<Buffer<ArrayBufferLike>>;
|
|
69
|
-
/**
|
|
70
|
-
* Fills the specified area with a gradient.
|
|
71
|
-
* @param ctx The rendering context of the canvas.
|
|
72
|
-
* @param width The width of the area to fill.
|
|
73
|
-
* @param height The height of the area to fill.
|
|
74
|
-
* @param gradient The gradient options.
|
|
75
|
-
* @param x The x offset of the area.
|
|
76
|
-
* @param y The y offset of the area.
|
|
77
|
-
*/
|
|
78
|
-
private fillWithGradient;
|
|
79
|
-
/**
|
|
80
|
-
* Draws a dots pattern in the specified area.
|
|
81
|
-
* @param ctx The rendering context of the canvas.
|
|
82
|
-
* @param width The width of the area.
|
|
83
|
-
* @param height The height of the area.
|
|
84
|
-
* @param options Options to customize the dot pattern.
|
|
85
|
-
* @param x The x offset of the area.
|
|
86
|
-
* @param y The y offset of the area.
|
|
87
|
-
*/
|
|
88
|
-
private drawDotsPattern;
|
|
89
|
-
/**
|
|
90
|
-
* Draws a stripes pattern in the specified area.
|
|
91
|
-
* @param ctx The rendering context of the canvas.
|
|
92
|
-
* @param width The width of the area.
|
|
93
|
-
* @param height The height of the area.
|
|
94
|
-
* @param options Options to customize the stripes pattern.
|
|
95
|
-
* @param x The x offset of the area.
|
|
96
|
-
* @param y The y offset of the area.
|
|
97
|
-
*/
|
|
98
|
-
private drawStripesPattern;
|
|
99
|
-
/**
|
|
100
|
-
* Draws a grid pattern in the specified area.
|
|
101
|
-
* @param ctx The rendering context of the canvas.
|
|
102
|
-
* @param width The width of the area.
|
|
103
|
-
* @param height The height of the area.
|
|
104
|
-
* @param options Options to customize the grid pattern.
|
|
105
|
-
* @param x The x offset of the area.
|
|
106
|
-
* @param y The y offset of the area.
|
|
107
|
-
*/
|
|
108
|
-
private drawGridPattern;
|
|
109
|
-
/**
|
|
110
|
-
* Draws a checkerboard pattern in the specified area.
|
|
111
|
-
* @param ctx The rendering context of the canvas.
|
|
112
|
-
* @param width The width of the area.
|
|
113
|
-
* @param height The height of the area.
|
|
114
|
-
* @param options Options to customize the checkerboard pattern.
|
|
115
|
-
* @param x The x offset of the area.
|
|
116
|
-
* @param y The y offset of the area.
|
|
117
|
-
*/
|
|
118
|
-
private drawCheckerboardPattern;
|
|
119
|
-
/**
|
|
120
|
-
* Draws a custom image pattern in the specified area.
|
|
121
|
-
* @param ctx The rendering context of the canvas.
|
|
122
|
-
* @param width The width of the area.
|
|
123
|
-
* @param height The height of the area.
|
|
124
|
-
* @param options Options to customize the custom pattern.
|
|
125
|
-
* @param x The x offset of the area.
|
|
126
|
-
* @param y The y offset of the area.
|
|
127
|
-
*/
|
|
128
|
-
private drawCustomPattern;
|
|
129
|
-
private drawWavePattern;
|
|
130
|
-
private drawNoisePattern;
|
|
131
|
-
private drawDiagonalCheckerboardPattern;
|
|
132
|
-
masking(source: string | Buffer | PathLike | Uint8Array, maskSource: string | Buffer | PathLike | Uint8Array, options?: MaskOptions): Promise<Buffer>;
|
|
133
|
-
gradientBlend(source: string | Buffer | PathLike | Uint8Array, options: BlendOptions): Promise<Buffer>;
|
|
134
|
-
animate(frames: Frame[], defaultDuration: number, defaultWidth?: number, defaultHeight?: number, options?: {
|
|
135
|
-
gif?: boolean;
|
|
136
|
-
gifPath?: string;
|
|
137
|
-
onStart?: () => void;
|
|
138
|
-
onFrame?: (index: number) => void;
|
|
139
|
-
onEnd?: () => void;
|
|
140
|
-
}): Promise<Buffer[] | undefined>;
|
|
141
|
-
validHex(hexColor: string): any;
|
|
142
|
-
outPut(results: any): Promise<void | Buffer | string | Blob | Object | HTMLCanvasElement>;
|
|
143
|
-
}
|
|
144
|
-
export {};
|