Resizing an ASP.Net image to scale in Visual Studio - asp.net

I am working on a Visual Studio master page, and trying to add the company logo.
I have imported the JPEG into my project, added an Image control and have set the ImageUrl property to my JPEG.
The problem is my image is massive! I am trying to resize it to scale, by holding down shift (which works in other MS products) but it's not working properly, and when trying to resize manually, I just can't get it to look right.
So my question is, how do I resize an image to scale in ASP.Net using Visual Studio 2010?

Visual studio is not for image scaling. You can scale the image on design view. After spefying image url for image you can re-size it as you do in powerpoint. But this is not a good practice as this will add height and width tag with specific value in your html for image.
So re-size the image using any tool as per your need and use it as this will make the page lighter.

If I'm understanding correctly, you want to change the dimensions of an image in Visual Studio.
Changing the dimensions of the image will just make the image appear smaller; it won't actually resample it and reduce its size in bytes. For both these reasons, take the extra minute or two to use another program to properly resize the image.
Resampling: smooths the image according to an algorithm and properly handles things like edges
Reducing size in bytes: this one is obvious. Your post is tagged with ASP.Net; you don't want a "massize" image being sent over the network.

Related

Resizing images via css

If an image is 200px by 200px and you give that image a class in css with the same dimensions, will the browser still resize that image via css?
Ive been looking frequently into reducing page load time and one of the things that comes up is resizing via css slowing down page load time.
If you apply a class to your image with some fixed dimensions, then it will stuck to the defined dimensions.
Unless you define "max/min-width" and "max/min-height" instead of width and height.
The loading time is not about the dimension of the image but more about the size (octets) of the file (here an image). The performance are poorly influenced by the dimension of it.
No, because image will be same size (as downloaded from server). Also, since width/height of class is same as image, image will not be resized. And I don't think that resizing such images has any impact on page load times.
We can resize image propertionally from css but can't reduce load time from css
Full optimization of images can be quite an art to perfect as there are such a wide variety of images you might be dealing with. Here are the most common ways to optimize your images for the web.
Use proper file formats. If you have icons, bullets or any graphics that don't have too many colours use a format such as GIF and save the file with lower amounts of colours. If you have more detailed graphics then use JPG file format to save your images and reduce the quality.
Save your images in the proper dimensions. If you are having to use HTML or CSS to resize your images, stop right there. Save the image in the desired size to reduce the file size.
To resize your images you will have to use some form of program. For basic compression you can use a simple editing program such as GIMP. For more advanced optimization you will have to save specific files in Photoshop, Illustrator or Fireworks.
Source Link
Edit:
Check this link to get more idea about speeding up page loading time

How to show the same Image at the same location on each page in the RDLC 2010 report

I am composing an RDLC report in Visual Studio 2010.
I need to display the same image at the same location on each generated page.
The image is a background image and needs to be overlapped by one table on the same page.
If the table needs to extend to many pages the image must be repeated on each page at the same
location relative to the page.
I tried to put the image to be a part of the page background but then the image is stretched or repeated as tiles. The only available options at my disposal for the background image to repeat are Default, Repeat, RepeatX, RepeatY or Clip.
What can be the best possible solution to my problem.
It looks like the only solution acceptable for me was to design the image on the A4 paper and put the entire image as a background bitmap of the page template with the Repeat property set to Clip. I hope there will be better solutions then this but for now this the only one I have found.

Image grid on website, can I scale images down with CSS?

I have a lot of images with a resolution around 500x1500 and I want to show all those images in a grid on my website. Each picture in the grid should be 200x200px.
If I scale down the images with CSS from 500x1500px to 200x200px and I show 10 200x200px images on my website, does this mean that the visitor first have to download the 500x1500px images and then their browser scales the pictures down?
If that is the case, then it's a bad solution to do it like this, right? Instead I should have two versions of each picture, one 500x1500px version and one 200x200px version. Am I right?
The question then is what's the easiest way to scale down hundreds of images?
Yes, I think it is the case that the browser will download the larger image and then scale it. You can check for yourself by opening the dev tools on the browser (press F12 if you're using Chrome) and monitoring the network traffic when you reload your site.
The easiest way to scale down hundreds of images is find or write a program to do it.
You are right. You can set height and width of the images but 1) the user will have to download a bigger image than necessary and 2) the height x width ratio will be trouble (the big one is 1x3 and the small one is 1x1). I would either use http://www.imagemagick.org/ , gimp or a similar tool to crop the images, but the problem is that the cropped area might not be very good. Only a human can select a good fit for the cropped area :-(
Edit1: Perhaps a well-trained neural network could select the most "interesting" part of every image programatically but that's kind of a lot of trouble to do that. Still it could be pretty interesting :-)

How can I shrink an image in HTML whilst maintaining its sharpness?

I have an image that I use many times. In several cases I want to shrink its size, but obviously it loses sharpness when I do this in HTML.
Is there a way to fix this? The image is located elsewhere and I can’t save it locally.
Thanks
As dheerosaur states, SVG graphics can be used when you need to have the same image in multiple sizes but don't want to compromise quality.
Another thing to do is use an online service, such as Resize.co. You pass them the URL for your image file, the attributes and they take care of everything else.
You cannot control the way the browser renders images when they are resized. Images will look better when being passed through Photoshop's filters (or those in another tool) upon resize.
There is three way that I know to reduce an image file size in bytes :
Convert the file into a format using lossy compression algorithm such as JPG. Obviously the image will lose sharpness
Convert the file into a format using lossless compression algorithm, like PNG. Only works if the image contains lots of region with flat colors
Resize/resample the image using Photoshop or GIMP. If the new image dimension (width x height) is exactly the same as the displayed image's dimension in HTML, then web users will still see a sharp image
Firefox and Internet Explorer actually do have CSS properties that adjust the way images are rendered when resized via HTML attributes or CSS properties:
Firefox: image-rendering
Internet Explorer: -ms-interpolation-mode
These won’t work in other browsers, and may not work great in all (or any) versions of IE and Firefox.
But it might be worth experimenting with them as a fallback in case resizer.co causes any issues.

asp.net sizing the non-sizable

I'm using the asp.net charting control, and liking it for the most part. However, I would like my charts to size with the panels they are contained in. I cannot set the width of the chart to 100%, I have to give them an exact size. I don't want to stretch and distort the rendered chart image.
Does anyone have an example of how I might do this, or could you point me in the right direction?
If you don't want to stretch generated chart you can load it via ajax and pass size of current image container in an ajax request (e.g. www.site.com/generateCoolChart?height=200&width=300 ). But size of the container may be changed after the user change size of the browser so your chart may become bigger than your container.
With sizing requirement I would consider using flash or silverlight or javascript based charts like amCharts or other. I mean anything not generating static images. These are generated on the client so they can easily adopt to the dedicated space.

Resources