Results 1 to 8 of 8

Thread: Logic Question/Problem

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2006
    Posts
    1

    Logic Question/Problem

    I have 2 images - that are proportional, but different sizes. One is 201px wide and 272px tall. The other is 442px wide and 596 px tall.

    I have a small 80X90 box (div) placed on the small image (covering, for example someone's face). I would like to transform the same box onto the second image. In other words, the same person's face should be covered by the <div> on the larger image.

    I know the coordinates of the box in the first (smaller image); and expect the box to get larger in the larger image. The algorithmn should be screen-resolution independent.

    Need to do this in javascript

    Please help.
    Attached Images Attached Images  

  2. #2
    Frenzied Member zaza's Avatar
    Join Date
    Apr 2001
    Location
    Borneo Rainforest Habits: Scratching
    Posts
    1,486

    Re: Logic Question/Problem

    Welcome to the Forums

    I don't know any Javascript. But I can tell you that the box on the larger image will measure 176 x 197 pixels. If your small box is located at (a,b) then the large box will be located at (a x 442 / 201 , b x 596 / 272).

    You just need the ratio of the small side to the large side. The dimensions of the box can be obtained by filling into the above formula as well.

    zaza
    I use VB 6, VB.Net 2003 and Office 2010



    Code:
    Excel Graphing | Excel Timer | Excel Tips and Tricks | Add controls in Office | Data tables in Excel | Gaussian random number distribution (VB6/VBA,VB.Net) | Coordinates, Vectors and 3D volumes

  3. #3
    Hyperactive Member PlaGuE's Avatar
    Join Date
    Jun 2005
    Location
    in ur mind.
    Posts
    445

    Re: Logic Question/Problem

    Uhh this isnt really "graphics programming"

    SomeBody Move Dis Plz.
    Without balance, there could only be chaos.
    Without chaos, there could be no balance.
    I live with karma. Eat with destiny. Dream of life without shackles....
    Yet. If life had no consequences, life could not exist, nor could it flourish.


    If at first you dont succeed.You're screwed.

    C++/Java NOOB.

    I aint a professional at PHP, but if i can help i will.

  4. #4
    Fanatic Member damasterjo's Avatar
    Join Date
    Nov 2005
    Location
    In front of my Comp DirectX7 EXpert
    Posts
    827

    Re: Logic Question/Problem

    Quote Originally Posted by PlaGuE
    Uhh this isnt really "graphics programming"

    SomeBody Move Dis Plz.
    what do you mean? I see a graphic... In fact two of them, and he is wondering how to put a graphical box on the images also...
    Software languages known:
    Qbasic - TI-Basic - Liberty Basic - Visual Basic 6
    Software API's known:
    Directx 7 and 8
    Internet languages, in the process of learning:
    HTML - JAVASCRIPT - PHP - CSS - MYSQL - AJAX

  5. #5
    Fanatic Member damasterjo's Avatar
    Join Date
    Nov 2005
    Location
    In front of my Comp DirectX7 EXpert
    Posts
    827

    Re: Logic Question/Problem

    Quote Originally Posted by zaza
    Welcome to the Forums

    I don't know any Javascript. But I can tell you that the box on the larger image will measure 176 x 197 pixels. If your small box is located at (a,b) then the large box will be located at (a x (442 / 201) , b x (596 / 272)).

    You just need the ratio of the small side to the large side. The dimensions of the box can be obtained by filling into the above formula as well.

    zaza
    Dont forget parenthesis
    Software languages known:
    Qbasic - TI-Basic - Liberty Basic - Visual Basic 6
    Software API's known:
    Directx 7 and 8
    Internet languages, in the process of learning:
    HTML - JAVASCRIPT - PHP - CSS - MYSQL - AJAX

  6. #6
    Frenzied Member zaza's Avatar
    Join Date
    Apr 2001
    Location
    Borneo Rainforest Habits: Scratching
    Posts
    1,486

    Re: Logic Question/Problem

    Err..ok. But it doesn't make any difference.





    By the way, don't forget the apostrophe. Or that you spell "parentheses" (plural) with an "e"...
    I use VB 6, VB.Net 2003 and Office 2010



    Code:
    Excel Graphing | Excel Timer | Excel Tips and Tricks | Add controls in Office | Data tables in Excel | Gaussian random number distribution (VB6/VBA,VB.Net) | Coordinates, Vectors and 3D volumes

  7. #7
    Fanatic Member damasterjo's Avatar
    Join Date
    Nov 2005
    Location
    In front of my Comp DirectX7 EXpert
    Posts
    827

    Re: Logic Question/Problem

    it does matter 9 * 4 / 2 = 18 but ... 9 * (4 / 2) = 18... see the difference? duh!
    Software languages known:
    Qbasic - TI-Basic - Liberty Basic - Visual Basic 6
    Software API's known:
    Directx 7 and 8
    Internet languages, in the process of learning:
    HTML - JAVASCRIPT - PHP - CSS - MYSQL - AJAX

  8. #8
    Hyperactive Member PlaGuE's Avatar
    Join Date
    Jun 2005
    Location
    in ur mind.
    Posts
    445

    Re: Logic Question/Problem

    Quote Originally Posted by damasterjo
    what do you mean? I see a graphic... In fact two of them, and he is wondering how to put a graphical box on the images also...
    This is more of a HTML question. As indicated by the word "<div>"
    Without balance, there could only be chaos.
    Without chaos, there could be no balance.
    I live with karma. Eat with destiny. Dream of life without shackles....
    Yet. If life had no consequences, life could not exist, nor could it flourish.


    If at first you dont succeed.You're screwed.

    C++/Java NOOB.

    I aint a professional at PHP, but if i can help i will.

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