* 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)
| 65 | * @return {Promise} resolve with the parsed PNG image |
| 66 | */ |
| 67 | function 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 |
no outgoing calls
no test coverage detected