ImageInfo

Returns information about a image file. This method works in conjunction with AddPictureFrame.

Syntax

Rhino.ImageInfo (strFileName)

Parameters

strFileName

Required.  String.  The name of the image file to query.  The supported image types are as follows:

Type

Description

bmp

Windows Bitmap

tga

Truevision Targa

jpg, jpeg

JPEG Compliant

pcx

Zsoft Paintbrush

png

Portable Network Graphics

tif, tiff

Tagged Image File Format

Returns

Array

An array of image information if successful. The array will contain the following information:

Element

Description

0

Number.  The width of the image in pixels.

1

Number.  The height of the image in pixels.

2

Number.  The horizontal resolution of the image in dots-per-inch (dpi).

3

Number.  The vertical resolution of the image in dots-per-inch (dpi).

Null

If not successful, or on error.

Example

Sub AddPictureFrameOneToOne()

  Dim bmp, info, pl

  Dim pw, ph, px, py

  Dim us, uw, uh

 

  bmp = Rhino.OpenFileName("Open", "Image Files (*.jpg)|*.jpg|All Files (*.*)|*.*||")

  If IsNull(bmp) Then Exit Sub

  

  info = Rhino.ImageInfo(bmp)

  If IsNull(info) Then Exit Sub

 

  pw = info(0) ' width in pixels

  ph = info(1) ' height in pixels

  px = info(2) ' horizontal pixels per inch

  py = info(3) ' vertical pixels per inch

 

  us = Rhino.UnitScale(8) ' unit scale factor

  uw = pw / (us * px)     ' scaled width

  uh = ph / (us * py)     ' scaled height

 

  pl = Rhino.WorldXYPlane

  Call Rhino.AddPictureFrame(pl, bmp, uw, uh)

End Sub

Also See

AddPictureFrame