new(basic.gblib): BLUR keyword introduced.
This commit is contained in:
parent
06149126e9
commit
1914d377ab
2 changed files with 37 additions and 2 deletions
|
@ -68,9 +68,9 @@ export class ImageProcessing {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the page object.
|
* Sharpen the image.
|
||||||
*
|
*
|
||||||
* @example OPEN "https://wikipedia.org"
|
* @example file = SHARPEN file
|
||||||
*/
|
*/
|
||||||
public async sharpen({ pid, file: file }) {
|
public async sharpen({ pid, file: file }) {
|
||||||
GBLog.info(`BASIC: Image Processing SHARPEN ${file}.`);
|
GBLog.info(`BASIC: Image Processing SHARPEN ${file}.`);
|
||||||
|
@ -94,4 +94,25 @@ export class ImageProcessing {
|
||||||
};
|
};
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sharpen the image.
|
||||||
|
*
|
||||||
|
* @example file = BLUR file
|
||||||
|
*/
|
||||||
|
public async blur({ pid, file: file }) {
|
||||||
|
GBLog.info(`BASIC: Image Processing SHARPEN ${file}.`);
|
||||||
|
|
||||||
|
const gbfile = DialogKeywords.getFileByHandle(file);
|
||||||
|
const data = await sharp(gbfile.data)
|
||||||
|
.blur()
|
||||||
|
.toBuffer();
|
||||||
|
|
||||||
|
const newFile = {
|
||||||
|
filename: gbfile.filename,
|
||||||
|
data: data
|
||||||
|
};
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -741,6 +741,14 @@ export class KeywordsExpressions {
|
||||||
return `await sys.set ({pid: pid, ${params}})`;
|
return `await sys.set ({pid: pid, ${params}})`;
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
keywords[i++] = [
|
||||||
|
/^\s*(\w+)\s*\=\s*BLUR\s*(.*)/gim,
|
||||||
|
($0, $1, $2, $3) => {
|
||||||
|
return `
|
||||||
|
${$1} = await img.blur({pid: pid, args: [${$2}]})`;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
keywords[i++] = [
|
keywords[i++] = [
|
||||||
/^\s*(\w+)\s*\=\s*SHARPEN\s*(.*)/gim,
|
/^\s*(\w+)\s*\=\s*SHARPEN\s*(.*)/gim,
|
||||||
($0, $1, $2, $3) => {
|
($0, $1, $2, $3) => {
|
||||||
|
@ -749,6 +757,12 @@ export class KeywordsExpressions {
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return keywords;
|
return keywords;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue