If (WScript.Arguments.length <> 1) Then
	WScript.Echo("USAGE: cscript photoshop_encode_jpeg.vbs inputfile.png output_prefix")
End If

WScript.Echo("Loading " & WScript.Arguments.Item(0) & "...")
Dim ps, doc
Set ps = CreateObject("Photoshop.Application")
Set doc = ps.Open(WScript.Arguments.Item(0))

For i = 1 To 100
	WScript.Echo("Saving at quality " & i & "...")
	Dim opts
	Set opts = CreateObject("Photoshop.ExportOptionsSaveForWeb")
	opts.Quality = i
	opts.Format = 6 'psJPEGSave
	doc.Export WScript.Arguments.Item(1) & i & ".jpg", 2, opts 
Next