中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-08-13 03:09
47,811 topics / 349,897 posts / today 0 new / 48,256 members
DOS批处理 & 脚本技术(批处理室) » VBS is powerful - converting image formats
Printable Version  3,827 / 13
Floor1 electronixtar Posted 2006-11-04 12:01
铂金会员 Posts 2,672 Credits 7,493
```
Dim Img 'Image file
Dim IP 'Image processing

Set Img = CreateObject("WIA.ImageFile")
Set IP = CreateObject("WIA.ImageProcess")

Img.LoadFile "Bliss.bmp" 'Load original image

IP.Filters.Add IP.FilterInfos("Convert").FilterID
IP.Filters(1).Properties("FormatID").Value = "{B96B3CAE-0728-11D3-9D7B-0000F81EF32E}" 'The format here can be set by yourself, see the attached table
IP.Filters(1).Properties("Quality").Value = 5 'Image quality

Set Img = IP.Apply(Img) 'Apply

Img.SaveFile "BlissCompressed.jpg" 'Save the converted image
```

Notes:

BMP {B96B3CAB-0728-11D3-9D7B-0000F81EF32E}

PNG {B96B3CAF-0728-11D3-9D7B-0000F81EF32E}

GIF {B96B3CB0-0728-11D3-9D7B-0000F81EF32E}

JPEG {B96B3CAE-0728-11D3-9D7B-0000F81EF32E}

TIFF {B96B3CB1-0728-11D3-9D7B-0000F81EF32E}


System requirements: WinME and above + Windows Image Acquisition

WIA is very powerful, supporting
Rotate image
Crop image
Resize
Image watermark
EXIF information
TIFF multi-page
ARGB
Convert format

Reference:
Windows® Image Acquisition runtime library and reference

http://download.microsoft.com/download/WinXPHome/Utility/2.0/WXP/EN-US/WIAAutSDK.zip

[ Last edited by electronixtar on 2007-2-28 at 02:59 PM ]
Floor2 everest79 Posted 2007-02-25 13:28
金牌会员 Posts 1,127 Credits 2,564
Boss ect, can you simplify the code to let mshta execute, only need to convert BMP
Floor3 slore Posted 2007-02-25 14:24
铂金会员 Posts 2,478 Credits 5,212
It is suggested that finally Set variable = Nothing
Floor4 jmz573515 Posted 2007-02-25 21:07
银牌会员 Posts 464 Credits 1,212
I don't know how to use it. Can you explain it? Thanks!
Floor5 slore Posted 2007-02-26 02:45
铂金会员 Posts 2,478 Credits 5,212
Suggest a next tool that supports commands...
Floor6 electronixtar Posted 2007-02-28 14:49
铂金会员 Posts 2,672 Credits 7,493
Ect boss, can you simplify the code to let mshta execute, only need to convert BMP

It may be more troublesome to let mshta execute. I'll try. Maybe use Javascript instead of vbs.
P.S. My name is est, not etc or ect, nor CET

It is suggested to finally Set variable=Nothing
Thank you for your suggestion. This is one of my bad habits

I don't know how to use it? Can you explain it, please!

Refer to the comments. Put Bliss.bmp in the same directory as the vbs, run this vbs to get BlissCompressed.jpg

It is suggested to download a tool that supports commands...

I'll write out the mshta version first, hehe
Floor7 electronixtar Posted 2007-02-28 14:52
铂金会员 Posts 2,672 Credits 7,493
Now I'm hanging out in an internet cafe, and there are many tools missing. I'm feeling depressed.....
Floor8 everest79 Posted 2007-02-28 20:33
金牌会员 Posts 1,127 Credits 2,564
Where does that S come from?
Floor9 jmz573515 Posted 2007-03-01 05:42
银牌会员 Posts 464 Credits 1,212
Finally understand what's going on, but there's still one question to ask. Can you write a program to resize all images in a certain folder to a specified size (such as 400*300), that is, scale proportionally?
Floor10 electronixtar Posted 2007-03-01 10:02
铂金会员 Posts 2,672 Credits 7,493
Floor11 qasa Posted 2007-03-01 10:14
高级用户 Posts 311 Credits 959 From 广东-LianJiang
Originally posted by electronixtar at 2007-2-28 01:52:
Now I'm hanging out in an internet cafe, many tools are not available, feeling depressed.....


Has est also started doing internet cafe maintenance?
Floor12 ran520 Posted 2007-03-01 11:34
初级用户 Posts 12 Credits 24
I also used to hang out in internet cafes``Hehe``
Floor13 vkill Posted 2007-11-18 19:26
金牌会员 Posts 1,744 Credits 4,103 From 甘肃.临泽
The last sentence is lowercase with a '

Img.SaveFile "BlissCompressed.jpg" ' to save the converted image
Floor14 jswxcy Posted 2007-11-18 21:48
新手上路 Posts 8 Credits 16
Can't understand~ Please explain specifically how to use it? I'm a newbie~
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023