以下に簡単な例を示します。
Sample.vbs
'//---
'// ex1: Image is in file.
set oNmageman = createobject("NmagemanCOM")
if oNmageman.Load("sample.jpg") then
oNmageman.Width = 100 '// width to 100px (keep ratio)
oNmageman.Save("sample.out.jpg")
end if
'//---
'// ex2: Image is in stream.
set oNmageman = createobject("NmagemanCOM")
set oStreamIN = createobject("ADODB.Stream")
'{
oStreamIN.open
oStreamIN.type = 1
oStreamIN.loadFromFile "sample.jpg"
'}
set oStreamOUT = createobject("ADODB.Stream")
'{
oStreamOUT.open
oStreamOUT.type = 1
'}
if oNmageman.Load(oStreamIN) then
oNmageman.Width = 100 '// |
oNmageman.Height = 100 '// | box convertion with 100*100
oNmageman.Format = 13 '// 13: PNG
oNmageman.Save(oStreamOUT)
oStreamOUT.saveToFile "sample.out2.png", 2
end if
'//---
'// ex3: Metadata access
set oNmageman = createobject("NmagemanCOM")
if oNmageman.Load("metadata.jpg") then
set oMetadata = oNmageman.Metadata(1) '// 1: EXIF_MAIN
if not oMetadata is nothing then
for each sName in oMetadata
wscript.echo sName & " : " & oMetadata(sName):
next
end if
wscript.echo "--"
set oMetadata = oNmageman.Metadata(2) '// 2: EXIF_EXIF
if not oMetadata is nothing then
for each sName in oMetadata
wscript.echo sName & " : " & oMetadata(sName):
next
end if
wscript.echo "--"
set oMetadata = oNmageman.Metadata(3) '// 3: EXIF_GPS
if not oMetadata is nothing then
for each sName in oMetadata
wscript.echo sName & " : " & oMetadata(sName):
next
end if
wscript.echo "--"
end if
'//---
'// ex4: Paste iamge
set oNmagemanBase = createobject("NmagemanCOM")
set oNmagemanSeal = createobject("NmagemanCOM")
if oNmagemanBase.Load("sample.jpg") and oNmagemanSeal.Load("sample.t.gif") then
oNmagemanBase.Paste oNmagemanSeal
oNmagemanBase.Save("sample.out4.jpg")
end if
[console output]
ImageDescription : 080417_1614~01
Make : KDDI-KC
Model : W52K
Orientation : top, left side
ResolutionUnit : inches
Tag 0xC4A5 : PrintIM
XResolution : 72
YCbCrPositioning : Center of pixel array
YResolution : 72
--
BrightnessValue : 0
ColorSpace : sRGB
ComponentsConfiguration : YCbCr
Contrast : Normal
CustomRendered : Normal process
DateTimeDigitized : 2008:04:17 16:14:29
DateTimeOriginal : 2008:04:17 16:14:29
DigitalZoomRatio : 100/100
ExifVersion : 0220
ExposureMode : Auto exposure
ExposureProgram : Program normal
ExposureTime : 1/9 sec
Flash : Flash did not fire
FlashPixVersion : 0100
MeteringMode : Center weighted average
PixelXDimension : 240
PixelYDimension : 320
Saturation : Normal
SceneCaptureType : Standard
Sharpness : Normal
WhiteBalance : Auto white balance
--
GPSLatitude : 36:4:0.04
GPSLatitudeRef : N
GPSLongitude : 136:14:44.56
GPSLongitudeRef : E
GPSMapDatum : WGS-84
GPSProcessingMethod : JIS
GPSVersionID : 2 2 0 0
--