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 669163
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T00:07:16+00:00 2026-05-14T00:07:16+00:00

I am developing image redraw app. i know the center of one image view

  • 0

I am developing image redraw app. i know the center of one image view which is having scaling property. i.e it can change it frame and center . that to be applied to another view center. when i apply center to newly formed Image view it giving wrong center because of the previous image view is having scaling property. so how can i get exact center to my new image view from previous imageview

  • 1 1 Answer
  • 1 View
  • 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-14T00:07:16+00:00Added an answer on May 14, 2026 at 12:07 am

    Your view or image is

    width*height 
    

    your center view should always be in position

    (width/2,height/2) 
    

    whether the image is scaled or not.
    Just recalculate your center after the scale if you need the “scaled” center or keep in memory the original center position if you don’t.

    Pseudocode:

    getCenter(w,h){
        pos[0]=w/2;
        pos[1]=h/2;
        return pos;
    }
    
    calc(image){
        c = getCenter(image.w,image.h);
        scaled = image.scale(80); //That is 80% of original
        d = getCenter(scaled.w,scaled.h);
    
        if(something) return c;
        else return d;
    }
    

    Second explanation after discussion (read comments):

    Let’s assume you have a 640X480 image and you create a view of 320X240 (a quarter of it) and you move THIS view 100px right and 50 pixels down from position (0,0) which is usually top left corner of your image then:

    • your new center of the VIEW will be as usual in position (160,120) of the VIEW

    • the original center of the ORIGINAL image will remain in its position (320,240) which casually corresponds to the bottom right corner of your VIEW.

    • IF you want to know WHERE the original center of the ORIGINAL image DID end up AFTER movement and “cropping” then you just have to know where did you move the VIEW:

      100px right becomes (original position - relative movement) (320 - 100) = 220 
      50px down becomes (original position - relative movement) (240 - 50) = 190
      

      So your ORIGINAL center will be in position (220,190) of the new VIEW.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am developing an Android app which gets an image encoded in base 64
Hi Iam developing an image viewer application just like irfan-view or acdsee which should
i am developing one app i am using upload image in sdcard getting from
I am developing an Image Gallery using scrollview. I want to know can I
i m developing application in which i have to change the background image on
I've been developing a image manipulation script which has a background and user can
I am developing an app in which I need the image in TIFF format.
I'm developing an image warping iOS app with OpenGL ES 2.0. I have a
In an iPhone application I'm developing I have a Image View that displays eyes
I'm developing a menu. This menu, will change the background image when you click

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.