![](/img/trans.png)
[英]Retrieving image dimensions using image-size, and adding these values to an object
[英]I am using image-size module of Nodejs in my code .Can anyone tell me what unit it measures the dimensions of the image( its not pixels I checked )
下面是一個簡單的代碼,它需要“圖像大小”模塊 Nodejs,在變量“sizeOf”中,並將它與參數一起調用,作為其當前目錄中的圖像名稱。 然后它打印圖像的寬度和高度。 我只需要知道它以什么單位測量圖像。
const sizeOf = require('image-size');
(異步()=> {
dimensions = sizeOf("photo.jpg") console.log("width: ", dimensions.width,"height: ", dimensions.height)
})();
Output= width: 192 height: 612
Dimension in file folder for photo.jpg= width: 750 pixels height: 750 pixels
單位實際上是像素,因為圖像也是以像素為單位的。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.