Results 1 to 8 of 8

Thread: quicky !

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2005
    Posts
    7

    Resolved quicky !

    i'm simply trying to find out the dimensions of an image opened in image pro plus (VBA) compatable.

    the image is a .tif and it has been read into an array called ImBuf(Reg.Left,Reg.top). i now want it to work on cropped images, ie. different sizes.

    i've tried putting: Reg.Right=ImBuf.Width
    and Reg.Right=ImBuf().Width
    and Reg.Right=DOCSEL_ACTIVE.Width

    but they don't work and i get told there is a type mismatch (ImBuf is declared as an integer - is that part of the prob?)

    i've only been programming less than 1 week so please help a newbie


    thanx

    J x
    Last edited by jenny1981; Jun 6th, 2005 at 05:28 AM.

  2. #2
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: quicky !

    does reg have a right property?
    most items only have a left and a width the left tells it or you where it is situated on its parent, the width is how wide it is, also somethings have a scalewidth, which is it's inside width,

    same applies with top and height ( no bottom)

    also the scale of the parent may be in twips, while the scale of reg or the image, may be in pixels

    i have never seen image pro, so i am only going by general programming

    pete

  3. #3

    Thread Starter
    New Member
    Join Date
    May 2005
    Posts
    7

    Re: quicky !

    Prob solved 1 min ago!
    thanks anyway, but i found the function UBound on the internet even though they aren't listed in the IPP functions!
    i can just say
    width=UBound(ImBuf,1)
    height=UBound(ImBuf,2)

  4. #4

    Thread Starter
    New Member
    Join Date
    May 2005
    Posts
    7

    Angry Re: quicky !

    aaagggggghhhhhhhhhh

    prob NOT solved

    i can't declare the array without knowing its size and i can't use UBound without declaring the array!


  5. #5
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: quicky !

    if you don't declare the array, you can't store anything in it, so the size to declare the array is the quantity of data you want to store in it.

    maybe with ImBuf(Reg.Left,Reg.top)
    what is the maximimum value of reg.left, is that the number of pixels?
    does reg.left have a count property?
    also you can reset the rightmost dimension of the array and preserve the existing dat, using
    redim pereserve imbuf(reg.left, newreg.top)

    don't know if any of this helps you or is just more confusing

    if the tif file has already been read into the array, it should already have a ubound, so in that case you, still have to load the tif for it to have any value to work with

    pete

  6. #6
    PowerPoster kfcSmitty's Avatar
    Join Date
    May 2005
    Posts
    2,248

    Re: quicky !

    if you want to declare an array with no set length just leave the # out
    IE) Dim strArray () as string

  7. #7

    Thread Starter
    New Member
    Join Date
    May 2005
    Posts
    7

    Re: quicky !

    cheers guys, i eventually found the function below, but am having some probs... the whole prog just shuts down quite often when i run my code - sometimes with a "this app has encountered a prob..." and sometimes everything just suddenly disappears with no message. didn't think my code was THAT bad!

    will try your advice and see if it still falls over

    ret=IpDocGet(GETDOCINFO, DOCSEL_ACTIVE, iInfo)
    ReDim ImBuf(1 To iInfo.Width, 1 To iInfo.Height)

  8. #8
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: quicky !

    do you set breakpoints or step through the code one line at a time, to find out exactly where it shuts down?

    also use ubound to find out what the actual size of you array is after that
    you may need to use dim, rather than redim

    pete

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width