标题: [问题求助] VBS控制台输出图片 [打印本页]
作者: jyswjjgdwtdtj 时间: 2024-6-7 20:31 标题: VBS控制台输出图片
- set o=wscript.stdout
- wscript.stdin.readline
- set ws=createobject("wscript.shell")
- set pcs=ws.exec("cmd /c ""mode con""")
- a=split(pcs.stdout.readall(),vbcrlf)
- h=replace(replace(a(3),"行:","")," ","")
- w=replace(replace(a(4),"列:","")," ","")/2
- Set imf = CreateObject("WIA.ImageFile")
- Set ip = CreateObject("WIA.ImageProcess")
- imf.loadfile("C:\Users\lich\Documents\ClassIn Files\Files\新建文件夹\1.jpg")
- IP.Filters.Add IP.FilterInfos("Scale").FilterID
- IP.Filters(1).Properties("MaximumWidth") = w
- IP.Filters(1).Properties("MaximumHeight") = h
- set imf=ip.apply(imf)
- set argb=imf.argbdata
- o.write(vbtab&string(1000,chr(8)))
- for i=0 to imf.height-1
- p=""
- for j=0 to imf.width-1
- krgb=ExtractRGB(argb(i*imf.width+j+1))
- p=p&replace("%ESC_CHAR%[7;40;38;2;"&krgb(0)&";"&krgb(1)&";"&krgb(2)&"m %ESC_CHAR%[m","%ESC_CHAR%",chr(27))
- next
- o.writeline p
- next
- wscript.stdin.readline
-
- Function ExtractRGB(argbValue)
- argbValue=argbValue and &hffffff
- red = (argbValue And &HFF0000) \ &H10000
- blue = argbValue And &HFF
- green = (argbValue -red*&h10000-blue) \ &H100
-
- ExtractRGB = Array(red, green, blue)
- End Function
复制代码
全屏且字体最小下一张图片要输出半分钟 耗百来兆内存 活像上世纪的古早电脑
欢迎光临 批处理之家 (http://www.bathome.net/) |
Powered by Discuz! 7.2 |