Property

Picture.IndexedImage


Warning

This item was deprecated in version 2019r2. Please use Picture.ImageAt as a replacement.

Description

Returns the image in the picture specified by the passed Index (0-based).

Notes

The individual pictures aren't necessarily stored/returned in ascending scalefactor order. Do not rely on a particular order for the pictures.

Sample code

This example gets the image referenced by the passed index and displays it in the ImageWell.

Var pic As Picture
Var f As FolderItem
f = FolderItem.ShowOpenFileDialog("image/jpeg")
If f <> Nil Then
  pic = Picture.Open(f)
  ImageWell1.Image = pic.IndexedImage(1)
End If

If you have an Image Set with multiple images for HiDPI and want to split out each of the pictures it contains, you can do so like this:

Var g As Graphics
Var p, pics() As Picture

' Break the Image into its component pictures
' Also copy the horizontal/vertical resolution and scale factors
' so that the pictures draw properly when used later.
For i As Integer = 0 To MyImageSet.ImageCount - 1
  p = New Picture(MyImageSet.IndexedImage(i).Width, MyImageSet.IndexedImage(i).Height)
  p.HorizontalResolution = MyImageSet.IndexedImage(i).HorizontalResolution
  p.VerticalResolution = MyImageSet.IndexedImage(i).VerticalResolution
  pics.AddRow(p)
  g = p.Graphics
  g.ScaleX = p.HorizontalResolution / 72
  g.ScaleY = p.VerticalResolution / 72
  g.DrawPicture(MyImageSet.IndexedImage(i), 0, 0)
Next

If you later modify the pictures in the array and want to recreate it as an image, you can do so using the constructor like this:

' Recreate the image from the component pictures
p = New Picture(MyImageSet.Width, MyImageSet.Height, pics)

Compatibility

All project types on all supported operating systems.