China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-07-14 23:27
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » [Original] VBS is powerful - Picture Size Conversion (8 sentences to get it done!) View 3,215 Replies 9
Original Poster Posted 2006-10-24 23:18 ·  中国 四川 成都 教育网
铂金会员
★★★★
Credits 7,493
Posts 2,672
Joined 2005-09-02 00:00
20-year member
UID 42173
Gender Male
Status Offline
ResizeImg.vbs

Set oImg = CreateObject("WIA.ImageFile")
Set oProc = CreateObject("WIA.ImageProcess")
oImg.LoadFile "Water lilies.jpg" 'Open the Water lilies.jpg in the current folder
oProc.Filters.Add oProc.FilterInfos("Scale").FilterID 'Add a Scale filter
oProc.Filters(1).Properties("MaximumWidth")="400" 'Define the new image width
oProc.Filters(1).Properties("MaximumHeight")="300" 'Define the new image height
Set oNewImg = oProc.Apply(oImg) 'Save the new image to the oNewImg object
oNewImg.SaveFile "New.jpg" 'Save the oNewImg object as an image


Test system: Windows XP SP2 WSH 5.6, can run successfully on any operating system that has Windows Image Acquisition installed. Windows ME and XP have WIA installed by default.

Among them, Water lilies.jpg is the "Sample Picture" included with XP. Please make sure to copy Water lilies.jpg to the folder where the script is located when running the vbs script.

Next program exciting tips: Convert image format with vbs, webcam screenshots, character recognition, speech recognition... Those who are interested can join our QQ discussion group: 21154458. Note: This group only welcomes friends who are sincerely discussing and learning vbs, not for answering batch processing/vbs questions.

[ Last edited by electronixtar on 2006-10-24 at 11:23 PM ]
Recent Ratings for This Post ( 3 in total) Click for details
RaterScoreTime
shikx2008 +2 2006-11-15 00:36
jmz573515 +8 2007-03-01 10:53
redtek +20 2007-03-02 00:29

C:\>BLOG http://initiative.yo2.cn/
C:\>hh.exe ntcmds.chm::/ntcmds.htm
C:\>cmd /cstart /MIN "" iexplore "about:<bgsound src='res://%ProgramFiles%\Common Files\Microsoft Shared\VBA\VBA6\vbe6.dll/10/5432'>"
Floor 2 Posted 2006-10-25 00:42 ·  中国 湖北 武汉 电信
版主
★★★★★
Credits 11,386
Posts 4,938
Joined 2006-07-23 17:10
19-year member
UID 59080
Status Offline

  Strong~~ Learned————
Floor 3 Posted 2006-10-25 00:48 ·  中国 甘肃 甘南藏族自治州 合作市 电信
金牌会员
★★★★
Credits 4,103
Posts 1,744
Joined 2006-01-20 13:00
20-year member
UID 49241
Gender Male
From 甘肃.临泽
Status Offline
Floor 4 Posted 2006-10-25 01:44 ·  中国 湖南 株洲 电信
初级用户
★★
Credits 135
Posts 54
Joined 2006-09-10 03:07
19-year member
UID 62265
Status Offline
It's a pity that I still don't know how to use it yet
55555555
Floor 5 Posted 2006-10-25 01:45 ·  中国 北京 联通
金牌会员
★★★★
Credits 2,902
Posts 1,147
Joined 2006-09-21 12:00
19-year member
UID 63324
Gender Male
Status Offline
    Redtek,一个永远在网上流浪的人……

_.,-*~'`^`'~*-,.__.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._
Floor 6 Posted 2007-03-01 10:53 ·  中国 辽宁 本溪 联通
银牌会员
★★★
Credits 1,212
Posts 464
Joined 2006-12-13 21:11
19-year member
UID 73417
Gender Male
Status Offline
Great! Push it up!
Floor 7 Posted 2007-03-01 11:09 ·  中国 辽宁 本溪 联通
银牌会员
★★★
Credits 1,212
Posts 464
Joined 2006-12-13 21:11
19-year member
UID 73417
Gender Male
Status Offline
Found a problem. The size of the regenerated image seems to be scaled according to the aspect ratio of the original image. I wonder if it can be scaled to a custom size? (For example, change a 1024*768 image to 300*300)
Floor 8 Posted 2007-03-01 12:06 ·  中国 上海 闵行区 电信
初级用户
Credits 24
Posts 12
Joined 2007-02-28 16:58
19-year member
UID 80409
Gender Male
Status Offline
Floor 9 Posted 2007-03-01 12:51 ·  中国 陕西 西安 电信
铂金会员
★★★★
Credits 5,212
Posts 2,478
Joined 2007-02-08 23:39
19-year member
UID 79003
Gender Male
Status Offline
Windows Image Acquisition ?

Both Windows ME and XP have WIA installed by default.

But my XP doesn't have it...

Using Scale should be about the proportional relationship.

I think IrfanView.exe is good, it's compact (no other plugins) and has strong functions.
(The main file size is about the same as the runtime library of WIA)
Floor 10 Posted 2007-03-02 00:14 ·  中国 甘肃 甘南藏族自治州 合作市 电信
金牌会员
★★★★
Credits 4,103
Posts 1,744
Joined 2006-01-20 13:00
20-year member
UID 49241
Gender Male
From 甘肃.临泽
Status Offline
Brother slore:
If you want to use a third-party one, PngMate is better
Forum Jump: