Share via


Small Basic: Image

This article is about images and related operations in Microsoft Small Basic programming language.


What is an Image

A word image in computer area is mostly used as a bitmap (picture painted as raster graphics).  In Small Basic, following image file formats are supported.

  • bmp - Microsoft Bitmap (monochrome, 16 color, 256 color, 24bit color)
  • gif - GIF (Graphics Interface Format)
  • ico - Microsoft Icon
  • jpg - JPEG (Joint Photographic Experts Group)
  • png - Portable Network Graphics
  • tif - TIFF (Tagged Image File Format)

Operations for Images

In Small Basic, following operations are for images.  ImageList.LoadImage() can load an image from a file or a network to a memory.  For parameter img , either path or list can be used.

  • list = ImageList.LoadImage(path)
  • w = ImageList.GetWidthOfImage(list)
  • h = ImageList.GetHeightOfImage(list)
  • GraphicsWindow.DrawImage(img, x, y)
  • GraphicsWindow.DrawResizedImage(img, x, y, w, h)
  • shp = Shapes.AddImage(img)
  • Shapes.Move(shp, x, y)
  • Shapes.Rotate(shp, angle)
  • Shapes.Zoom(shp, scaleX, scaleY)
  • Shapes.Animate(shp, x, y, duration)
  • Desktop.SetWallPaper(path)
  • path = Flickr.GetPictureOfMoment()
  • path = Flickr.GetRandomPicture(tag)

Sample Programs

  • Image Viewer 0.1 (CRV802) - uses ImageList object and GraphicsWindow.DrawImage() operation.   This program runs only in desktop (not in browser).  Before running this program, remove comment marks in lines with File object.  Usage: push arrow keys to see other images.

Known Issues

  • ImageList.GetHeightOfImage() and ImageList.GetWidthOfImage() return zeros in remote.
  • Shapes.Zoom() zooms image at center in local but at corner in remote. (detail)
  • Shapes.Zoom() with scale 0.7 or smaller of an image that has transparent pixels causes run time error in local but not in remote. (detail)

See Also