MCPcopy
hub / github.com/faressoft/terminalizer / loadPNG

Function loadPNG

commands/render.js:67–83  ·  view source on GitHub ↗

* Read and parse a PNG image file * * @param {String} path the absolute path of the image * @return {Promise} resolve with the parsed PNG image

(path)

Source from the content-addressed store, hash-verified

65 * @return {Promise} resolve with the parsed PNG image
66 */
67function loadPNG(path) {
68 return new Promise(function (resolve, reject) {
69 di.fs.readFile(path, function (error, imageData) {
70 if (error) {
71 return reject(error);
72 }
73
74 new di.PNG().parse(imageData, function (error, data) {
75 if (error) {
76 return reject(error);
77 }
78
79 resolve(data);
80 });
81 });
82 });
83}
84
85/**
86 * Get the dimensions of the first rendered frame

Callers 2

getFrameDimensionsFunction · 0.85
mergeFramesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected