Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 910143
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T16:59:42+00:00 2026-05-15T16:59:42+00:00

This is very programming related but a somewhat non-programming question. I am performing image

  • 0

This is very programming related but a somewhat non-programming question. I am performing image scaling in a web based application and I need to maintain my image relative to a fixed location even though it scales anchored by its top, left corner. Hope the graphic make this possible.
alt text

The idea is that C is a fixed location that I want to maintain as my scaling origin rather than B which which is the current css behavior. C may or may not be within the actual image. So as the image scale, B needs to move relative to C. Example: if the image was scaled 50%, then B would move 1/2 the distance to C. If the image grew to 200% of its size, then B would move twice the distance away from C.

Ultimately looking for a formula for x & y for B given the location of C and a scaling factor for the image. Not sure the size of the image needs to be part of this but I have it if needed.

Thanks for any help!

Things I know:

  1. I know the width and height of the
    image rectangle.
  2. I know the offset of B from A.
  3. I know the offset of C from A.
  4. I know the scale factor in percent of the image.
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T16:59:43+00:00Added an answer on May 15, 2026 at 4:59 pm

    Effectively, you want to treat C as the origin, and just “move” B by the scaling amount. By treating it as a vector from C to B, and scaling it by the amount in question, you can do this fairly easily.

    newBx = Cx - (Cx - Bx) * scale;
    newBy = Cy - (Cy - By) * scale;
    

    For example, with a scale of 0.5 (50%), this becomes:

    newBx = 100 - (100 - 50) * 0.5 
          = 100 - 25
          = 75                 // 1/2 the distance to C
    newBy = 100 - (100 - 25) * 0.5
          = 100 - 37.5
          = 62.5               // 1/2 the distance to C
    

    With a scale of 2 (200%):

    newBx = 100 - (100 - 50) * 2 
          = 100 - 100
          = 0                  // 2x the distance to C
    newBy = 100 - (100 - 25) * 2
          = 100 - 150
          = -50                // 2x the distance to C
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This isn't a programming question per say, but very programming related, so I figured
This question is not directly programming related but I need my Server to pass
This is very basic question from programming point of view but as I am
Not really a programming related question but... I'd like very much to experiment with
This is basically a math problem, but very programing related: if I have 1
This should be very simple question. There are many programming languages out there, compiled
This is probably a very simple Object Oriented Programming question. What I am trying
This very well my be a SuperUser.com question, however it's directly related to my
I don't know if i should ask this question here, but it's related to
Before I begin, I guess this may not be strictly programming related but I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.