Image file scale

Discussion in 'AutoCAD' started by PeteB, Aug 6, 2003.

  1. PeteB

    PeteB Guest

    Hi
    When I attach/insert an Image file to a drg file manually, (with a scale of
    1) the size of the image is as it should be (they are scanned A1 drgs) but
    when I use VBA to do the same thing using the following :-

    Dim rasterObj As AcadRasterImage
    insertionPoint(0) = 0
    insertionPoint(1) = 0
    insertionPoint(2) = 0
    scalefactor = 1
    rotationAngle = 0
    Set rasterObj = ThisDrawing.ModelSpace.AddRaster(imageName, insertionPoint,
    scalefactor, rotationAngle)

    the image measures nothing like what it should be and is a lot smaller ie. 1
    x 1.322 instead of 645x853 (ish)
    anyone any ideas ?
    thanks
    PeteB
     
    PeteB, Aug 6, 2003
    #1
  2. PeteB

    Dale Guest

    Try this:

    Dim pt1(0 To 2) As Double
    Dim imgName As String
    Dim oImg As AcadRasterImage

    imgName = "c:\test.bmp"
    pt1(0) = 0
    pt1(1) = 0
    pt1(2) = 0
    Set oImg = ThisDrawing.ModelSpace.AddRaster(imgName, pt1, 1, 0)
    oImg.ImageWidth = oImg.Width
    oImg.ImageHeight = oImg.Height

    ..Width & .Height are the size of the image in pixels, .ImageWidth &
    ..ImageHeight are the "physical size" in drawing units.

    Also, the .AddRaster "ScaleFactor" refers to the X axis image size, so if
    you knew the X size of the image ahead of time you could specify it when
    calling .AddRaster such as:

    Set oImg = ThisDrawing.ModelSpace.AddRaster(imgName, pt1, 645, 0)

    Dale
     
    Dale, Aug 7, 2003
    #2
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.