Board logo

标题: [问题求助] VBS控制台输出图片 [打印本页]

作者: jyswjjgdwtdtj    时间: 2024-6-7 20:31     标题: VBS控制台输出图片

  1. set o=wscript.stdout
  2. wscript.stdin.readline
  3. set ws=createobject("wscript.shell")
  4. set pcs=ws.exec("cmd /c ""mode con""")
  5. a=split(pcs.stdout.readall(),vbcrlf)
  6. h=replace(replace(a(3),"行:","")," ","")
  7. w=replace(replace(a(4),"列:","")," ","")/2
  8. Set imf = CreateObject("WIA.ImageFile")
  9. Set ip = CreateObject("WIA.ImageProcess")
  10. imf.loadfile("C:\Users\lich\Documents\ClassIn Files\Files\新建文件夹\1.jpg")
  11. IP.Filters.Add IP.FilterInfos("Scale").FilterID
  12. IP.Filters(1).Properties("MaximumWidth") = w
  13. IP.Filters(1).Properties("MaximumHeight") = h
  14. set imf=ip.apply(imf)
  15. set argb=imf.argbdata
  16. o.write(vbtab&string(1000,chr(8)))
  17. for i=0 to imf.height-1
  18. p=""
  19. for j=0 to imf.width-1
  20. krgb=ExtractRGB(argb(i*imf.width+j+1))
  21. p=p&replace("%ESC_CHAR%[7;40;38;2;"&krgb(0)&";"&krgb(1)&";"&krgb(2)&"m  %ESC_CHAR%[m","%ESC_CHAR%",chr(27))
  22. next
  23. o.writeline p
  24. next
  25. wscript.stdin.readline
  26. Function ExtractRGB(argbValue)
  27.     argbValue=argbValue and &hffffff
  28.     red = (argbValue And &HFF0000) \ &H10000
  29.     blue = argbValue And &HFF
  30.     green = (argbValue -red*&h10000-blue) \ &H100
  31.     ExtractRGB = Array(red, green, blue)
  32. End Function
复制代码
全屏且字体最小下一张图片要输出半分钟 耗百来兆内存 活像上世纪的古早电脑




欢迎光临 批处理之家 (http://bbs.bathome.net/) Powered by Discuz! 7.2