[Mac/Linux] 用 file 指令快速查詢圖檔的長寬
今天在修改 Cordova app 裡的 iOS 圖示大小,
不過遇到一個小問題:我要怎麼快速知道每個圖示的長寬呢?
當然用 Finder 一個個點圖檔,就會顯示它的長寬,但實在太慢了…
上網瞄了一下,才發現平常很常用的 file 指令就已經可以做到了,例如:
testuser@localhost ~ $ file *.png
icon-40.png: PNG image data, 40 x 40, 8-bit/color RGBA, non-interlaced
icon-40@2x.png: PNG image data, 80 x 80, 8-bit/color RGBA, non-interlaced
icon-50.png: PNG image data, 50 x 50, 8-bit/color RGBA, non-interlaced
icon-50@2x.png: PNG image data, 100 x 100, 8-bit/color RGBA, non-interlaced
icon-60@2x.png: PNG image data, 120 x 120, 8-bit/color RGBA, non-interlaced
icon-60@3x.png: PNG image data, 180 x 180, 8-bit/color RGBA, non-interlaced
icon-72.png: PNG image data, 72 x 72, 8-bit/color RGBA, non-interlaced
icon-72@2x.png: PNG image data, 144 x 144, 8-bit/color RGBA, non-interlaced
icon-76.png: PNG image data, 76 x 76, 8-bit/color RGBA, non-interlaced
icon-76@2x.png: PNG image data, 152 x 152, 8-bit/color RGBA, non-interlaced
icon-83.5@2x.png: PNG image data, 167 x 167, 8-bit/color RGBA, non-interlaced
icon-small.png: PNG image data, 29 x 29, 8-bit/color RGBA, non-interlaced
icon-small@2x.png: PNG image data, 58 x 58, 8-bit/color RGBA, non-interlaced
icon-small@3x.png: PNG image data, 128 x 128, 8-bit/color RGBA, non-interlaced
icon.png: PNG image data, 57 x 57, 8-bit/color RGBA, non-interlaced
icon@2x.png: PNG image data, 114 x 114, 8-bit/color RGBA, non-interlaced
用這個方式,一下子就可以將所有圖檔的長寬都列出來,方便多啦~^^
參考資料:Get the dimensions of most images from the command line
(本頁面已被瀏覽過 174 次)