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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:22:29+00:00 2026-05-26T13:22:29+00:00

Basically, I have an image which could be large (couple of thousand pixels in

  • 0

Basically, I have an image which could be large (couple of thousand pixels in both height and width), and can vary quite a bit in width’s and height’s.

What I need to do is display these images at approximately 500 pixels in height and width – but I want to keep the aspect ratio of these intact, so the values would just be fairly close. But I’m a bit confused on what calculations I could use on the original width’s and heights to get them to the right figures.

Any ideas?

  • 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-26T13:22:30+00:00Added an answer on May 26, 2026 at 1:22 pm

    Try this:

    Size original = new Size(5000,4000);
    double ratio = (double)original.Height/original.Width;
    int resizePercent = 50;
    int newWidth = Convert.ToInt32(original.Width*resizePercent/100);
    int newHeight = Convert.ToInt32(newWidth * ratio);
    Size resized = new Size(newWidth,newHeight);
    

    Of course simply set original variable to your images size and determine your resize percentage. You could calculate the resize percentage if you had a target width like this:

    int targetWidth = 500;
    int resizePercent = Convert.ToInt32((double)original.Width/targetWidth);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If I have one png which is basically a button image with nothing inside
I have 55 000 image files (in both JPG and TIFF format) which are
I have an app whose navigation tree is described on the attached image. Basically,
I've created an image which is basically a CSS sprite of 3 images together.
Basically what the title says... I need to have an image that when clicked,
I've got a linq query, which is admittedly pretty large. I can't identify where
I have a django app which basically is just a photo album. Right now
I basically have the following class: .sf-sub-indicator { background: url(/abcprod/images/arrows-ffffff.png) no-repeat -10px -100px; }
I basically have three tables, posts, images and postimages (this simply contains the ids
So basically I have a PHP script that takes all the images from the

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.