MCPcopy
hub / github.com/ollm/OpenComic / resize

Function resize

scripts/image.js:12–36  ·  view source on GitHub ↗
(fromImage, toImage, config = {})

Source from the content-addressed store, hash-verified

10}
11
12async function resize(fromImage, toImage, config = {})
13{
14 await loadSharp();
15
16 if(!inChildFork)
17 {
18 fromImage = app.shortWindowsPath(fromImage);
19 fileManager.macosStartAccessingSecurityScopedResource(fromImage);
20
21 const extension = app.extname(fromImage);
22
23 if(/*compatible.image.ico.has(extension)/* || */compatible.image.ico.has(extension)) // Unsupported images format for resize
24 throw new Error({});
25 }
26
27 config = {
28 width: 200,
29 fit: sharp.fit.inside,
30 quality: 95,
31 background: 'white',
32 ...config,
33 };
34
35 return _resize(fromImage, toImage, config);
36}
37
38async function _resize(fromImage, toImage, config = {}, deep = 0)
39{

Callers

nothing calls this directly

Calls 2

loadSharpFunction · 0.85
_resizeFunction · 0.70

Tested by

no test coverage detected