ASPPY.image

The ASPPY.image namespace exposes the powerful Python Pillow library directly to VBScript. You can resize, crop, draw, apply filters, and enhance images seamlessly.

Namespaces

ASPPY.image.Image

ASPPY.image.ImageDraw

ASPPY.image.ImageFilter

Sample Code

<%
Dim img, draw, filter, blurredImg
' 1. Create a new 200x200 RGB image with a blue background
Set img = ASPPY.image.Image.new("RGB", Array(200, 200), Array(0, 0, 255))

' 2. Draw a red rectangle and some text
Set draw = ASPPY.image.ImageDraw.Draw(img)

' Rectangle box: Array(Left, Top, Right, Bottom)
draw.rectangle Array(50, 50, 150, 150), Array(255, 255, 255), Array(255, 0, 0)

' Draw text at Array(X, Y)
draw.text Array(60, 90), "ASPPY Image", Array(255, 255, 255)

' 3. Apply a Gaussian Blur filter
Set blurredImg = img.filter(ASPPY.image.ImageFilter.GaussianBlur(2.0))

' 4. Save the modified image
Dim savePath
savePath = Server.MapPath("/images/output.jpg")
blurredImg.save savePath

Response.Write "Image saved successfully. Dimensions: " & blurredImg.width & "x" & blurredImg.height
%>

Resizing and Cropping Example

<%
Dim srcImg, resizedImg, croppedImg

' Open an existing image
Set srcImg = ASPPY.image.Image.open(Server.MapPath("/images/photo.jpg"))

' Resize
Set resizedImg = srcImg.resize(Array(800, 600))

' Crop center
Set croppedImg = resizedImg.crop(Array(100, 100, 700, 500))

' Save back to disk
croppedImg.save Server.MapPath("/images/photo_cropped.jpg")
%>