imagejs
imagejs copied to clipboard
How to get metadata of images?
Hi, I want to resize my images to half size, but I do not know the size of orignal image. How can I get this?
Hi, I want to resize my images to half size, but I do not know the size of orignal image. How can I get this?
Hi, if someone is looking for metadata especially size of image you have 2 option :
- You can print bitmap after initialization , and log bitmap details.
`var bitmap = new Bitmap();
bitmap.readFile(`sourceimg.png`).then(function () {
// bitmap is ready
console.log("bitmapData >>>", bitmap);
` Here you get bitmap detail :
ready { _data: { data: <Buffer 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ... 974 more bytes>, width: 16, height: 16 } }
2.Also you can use another module https://www.npmjs.com/package/image-size