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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T05:37:43+00:00 2026-06-10T05:37:43+00:00

We have two images. Image tempImage = new Image(); tempImage.width = 500; Image tempImage2

  • 0

We have two images.

Image tempImage = new Image();
tempImage.width = 500;

Image tempImage2 = new Image();
tempImage2.width = 1000;

I want to compare the widthes of these images and find image with greater width:

I tried following:

if (tempImage.Width < tempImage2.Width) Response.write("width of tempImage2 is bigger");
else Response.write("width of tempImage1 is bigger");

Compiler gets an error: cannot compare these two values.

I tried following:

    Image1.Width = (int)Math.Max(Convert.toDouble(tempImage.Width),Convert.toDouble(tempImage2.Width));
Response.Write("max width is " + Image1.Width);

Compiler couldn’t convert width to double.

So how to compare the width of images and find the image with bigger width?

  • 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-06-10T05:37:44+00:00Added an answer on June 10, 2026 at 5:37 am

    You’re getting the error because the Width property of an Image is a Unit structure type, not a scalar and there is no comparison operator implemented for it.

    if (i.Width.Value < j.Width.Value) 
    

    will work, but that comparison is strictly only valid if the Type of the unit is the same. In your sample, it defaults to pixel, but in a more general case, you’d need to make sure you’re comparing values of the same unit.

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

Sidebar

Related Questions

I have three images, two of these images animate as follow and third image
I have two images. I want to display one image if its day and
I have two images, both with alpha channels. I want to put one image
Imagine you have two images A and B, and a third grayscale image T.
I have image Array with two images out of that first image its showing
I have two images which i would like to compare and do different operations
I have two images per product, one is a simple image, and one is
I have two images next to each other in HTML. One image is taller
I have two images I would like to merge then save to a new
I have two images that I want to be positioned directly on top of

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.