首页 收录 文章 排行榜 免抠元素 VIP会员 申请收录 注册登录

bat批量获取图片分辨率和像素尺寸

@echo off & title 批量获取图片分辨率和像素尺寸 By 依梦琴瑶
cd /d %~dp0
setlocal enabledelayedexpansion
 
set Pic=*.jp*g,*.png,*.bmp,*.gif
 
call :CreatVBS
(for %%a in (%Pic%) do (
    for /f "tokens=1-3 delims=x" %%b in ('cscript -nologo "%tmp%\GetImgInfo.vbs" "%%~sa"') do (set /a z=%%~za/1024 +1
        echo 标题%%~nxa	%%~bx%%~c	!z!KB
    )
))>图片信息.txt
pause
exit
:CreatVBS
(echo '获取图片文件的宽、高、DPI By 依梦琴瑶
echo On Error Resume Next
echo Dim Img
echo Set Img = CreateObject^("WIA.ImageFile"^)
echo Img.LoadFile WScript.Arguments^(0^)
echo Wscript.Echo Img.Width ^& "x" ^& Img.Height ^& "x" ^& Img.HorizontalResolution)>"%tmp%\GetImgInfo.vbs"
goto :eof