@xn-sakina/image-magick
Version:
Easy use WASM-ImageMagick process image utils for webpack
219 lines (218 loc) • 9.86 kB
TypeScript
/**
* Execute first command in given config.
*/
declare function executeOne$$1(configOrCommand: any): any;
declare function isExecuteCommand$$1(arg: any): boolean;
/**
* Transform `configOrCommand: ExecuteConfig | ExecuteCommand` to a valid ExecuteConfig object
*/
declare function asExecuteConfig$$1(arg: any): any;
/**
* `execute()` shortcut that useful for commands that return only one output file or when only one particular output file is relevant.
* @param outputFileName optionally user can give the desired output file name
* @returns If `outputFileName` is given the file with that name, the first output file otherwise or undefined
* if no file match, or no output files where generated (like in an error).
*/
declare function executeAndReturnOutputFile$$1(configOrCommand: any, outputFileName: any): any;
declare function addExecuteListener$$1(l: any): void;
/**
* Execute all commands in given config serially in order. Output files from a command become available as
* input files in next commands. In the following example we execute two commands. Notice how the second one uses `image2.png` which was the output file of the first one:
*
* ```ts
* const { outputFiles, exitCode, stderr} = await execute({
* inputFiles: [await buildInputFile('fn.png', 'image1.png')],
* commands: `
* convert image1.png -bordercolor #ffee44 -background #eeff55 +polaroid image2.png
* convert image2.png -fill #997711 -tint 55 image3.jpg
* `
* })
* if (exitCode) {
* alert(`There was an error with the command: ${stderr.join('\n')}`)
* }
* else {
* await loadImageElement(outputFiles.find(f => f.name==='image3.jpg'), document.getElementById('outputImage'))
* }
* ```
*
* See {@link ExecuteCommand} for different command syntax supported.
*
* See {@link ExecuteResult} for details on the object returned
*/
declare function execute$$1(configOrCommand: any): any;
declare function createImageHome$$1(): ImageHomeImpl;
declare function newExecutionContext$$1(inheritFrom: any): ExecutionContextImpl;
/**
* {@link call} shortcut that only returns the output files.
*/
export function Call(inputFiles: any, command: any): any;
/**
* Low level execution function. All the other functions like [execute](https://github.com/KnicKnic/WASM-ImageMagick/tree/master/apidocs#execute)
* ends up calling this one. It accept only one command and only in the form of array of strings.
*/
export function call(inputFiles: any, command: any): Promise<any>;
export function CreatePromiseEvent(): Promise<any>;
/**
* Generates a valid command line string from given `string[]` that is compatible with {@link call}. Works with multiple
* commands by separating them with new lines and support comand splitting in new lines using `\`.
* See {@link ExecuteCommand} for more information.
*/
export function arrayToCli(command: any): any;
/**
* Generates a command in the form of `string[][]` that is compatible with {@link call} from given command line string.
* This works for strings containing multiple commands in different lines. and also respect `\` character for continue the same
* command in a new line. See {@link ExecuteCommand} for more information.
*/
export function cliToArray(cliCommand: any): any[][];
/**
* Makes sure that given {@link ExecuteCommand}, in whatever syntax, is transformed to the form `string[][]` that is compatible with {@link call}
*/
export function asCommand(c: any): any;
export function blobToString(blb: any): Promise<any>;
export function isInputFile(file: any): boolean;
export function isOutputFile(file: any): boolean;
/**
* Read files as string. Useful when files contains plain text like in the output file info.txt of `convert logo: -format '%[pixel:p{0,0}]' info:info.txt`
*/
export function readFileAsText(file: any): any;
export function isImage(file: any): any;
/**
* Builds a new {@link MagickInputFile} by fetching the content of given url and optionally naming the file using given name
* or extracting the file name from the url otherwise.
*/
export function buildInputFile(url: any, name?: any): any;
export function asInputFile(f: any, name?: any): any;
export function asOutputFile(f: any, name?: any): any;
export function getFileName(url: any): any;
export function getFileNameExtension(filePathOrUrl: any): any;
/**
* Will load given html img element src with the inline image content.
* @param image the image to be loaded
* @param el the html image element in which to load the image
* @param forceBrowserSupport if true and the image extension is not supported by browsers, it will convert the image to png
* and return that src so it can be shown in browsers
*/
declare function loadImageElement$$1(image: any, el: any, forceBrowserSupport?: boolean): any;
/**
* Return a string with the inline image content, suitable to be used to assign to an html img src attribute. See {@link loadImageElement}.
* @param forceBrowserSupport if true and the image extension is not supported by browsers, it will convert the image to png
* and return that src so it can be shown in browsers
*/
declare function buildImageSrc$$1(image: any, forceBrowserSupport?: boolean): any;
/**
* Build `MagickInputFile[]` from given HTMLInputElement of type=file that user may used to select several files
*/
declare function getInputFilesFromHtmlInputElement$$1(el: any): any;
declare function getPixelColor$$1(img: any, x: any, y: any): any;
declare const builtInImageNames$$1: string[];
/**
* Gets ImageMagick built-in images like `rose:`, `logo:`, etc in the form of {@link MagickInputFile}s
*/
declare function getBuiltInImages$$1(): any;
/**
* shortcut of {@link getBuiltInImages} to get a single image by name
*/
declare function getBuiltInImage$$1(name: any): any;
/**
* Compare the two images and return true if they are equal visually. Optionally, a margin of error can be provided using `fuzz`
*/
declare function compare$$1(img1: any, img2: any, fuzz?: number): any;
declare function compareNumber$$1(img1: any, img2: any): any;
/**
* Execute `convert $IMG info.json` to extract image metadata. Returns the parsed info.json file contents
* @param img could be a string in case you want to extract information about built in images like `rose:`
*/
declare function extractInfo$$1(img: any): any;
declare function getConfigureFolders$$1(): any;
/**
* list of image formats that are known to be supported by wasm-imagemagick. See `spec/formatSpec.ts`
*/
declare const knownSupportedReadWriteImageFormats$$1: string[];
export var IMAlign: any;
export var IMAlpha: any;
export var IMAutoThreshold: any;
export var IMBoolean: any;
export var IMCache: any;
export var IMChannel: any;
export var IMClass: any;
export var IMClipPath: any;
export var IMColorspace: any;
export var IMCommand: any;
export var IMCompliance: any;
export var IMComplex: any;
export var IMCompose: any;
export var IMCompress: any;
export var IMDataType: any;
export var IMDebug: any;
export var IMDecoration: any;
export var IMDirection: any;
export var IMDispose: any;
export var IMDistort: any;
export var IMDither: any;
export var IMEndian: any;
export var IMEvaluate: any;
export var IMFillRule: any;
export var IMFilter: any;
export var IMFunction: any;
export var IMGradient: any;
export var IMGravity: any;
export var IMIntensity: any;
export var IMIntent: any;
export var IMInterlace: any;
export var IMInterpolate: any;
export var IMKernel: any;
export var IMLayers: any;
export var IMLineCap: any;
export var IMLineJoin: any;
export var IMList: any;
export var IMLogEvent: any;
export var IMLog: any;
export var IMMethod: any;
export var IMMetric: any;
export var IMMode: any;
export var IMMorphology: any;
export var IMModule: any;
export var IMNoise: any;
export var IMOrientation: any;
export var IMPixelChannel: any;
export var IMPixelIntensity: any;
export var IMPixelMask: any;
export var IMPixelTrait: any;
export var IMPolicyDomain: any;
export var IMPolicyRights: any;
export var IMPreview: any;
export var IMPrimitive: any;
export var IMQuantumFormat: any;
export var IMSparseColor: any;
export var IMStatistic: any;
export var IMStorage: any;
export var IMStretch: any;
export var IMStyle: any;
export var IMTool: any;
export var IMType: any;
export var IMUnits: any;
export var IMValidate: any;
export var IMVirtualPixel: any;
export var IMWeight: any;
declare class ImageHomeImpl {
images: {};
builtInImagesAdded: boolean;
get(name: any): any;
remove(names: any): any[];
getAll(): any;
register(file: any, name?: any): any;
isRegistered(name: any, andReady?: boolean): any;
addBuiltInImages(): any;
}
declare class ExecutionContextImpl {
static create(inheritFrom: any): ExecutionContextImpl;
constructor(imageHome?: ImageHomeImpl);
imageHome: ImageHomeImpl;
execute(configOrCommands: any): any;
addFiles(files: any): void;
getAllFiles(): any;
getFile(name: any): any;
addBuiltInImages(): any;
removeFiles(names: any): any[];
}
export { executeOne$$1 as executeOne, isExecuteCommand$$1 as isExecuteCommand, asExecuteConfig$$1 as asExecuteConfig, executeAndReturnOutputFile$$1 as executeAndReturnOutputFile, addExecuteListener$$1 as addExecuteListener, execute$$1 as execute, createImageHome$$1 as createImageHome, newExecutionContext$$1 as newExecutionContext, loadImageElement$$1 as loadImageElement, buildImageSrc$$1 as buildImageSrc, getInputFilesFromHtmlInputElement$$1 as getInputFilesFromHtmlInputElement, getPixelColor$$1 as getPixelColor, builtInImageNames$$1 as builtInImageNames, getBuiltInImages$$1 as getBuiltInImages, getBuiltInImage$$1 as getBuiltInImage, compare$$1 as compare, compareNumber$$1 as compareNumber, extractInfo$$1 as extractInfo, getConfigureFolders$$1 as getConfigureFolders, knownSupportedReadWriteImageFormats$$1 as knownSupportedReadWriteImageFormats };