homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / HTML
Forum Library, Charter, Moderators: incrediBILL

HTML Forum

Is it possible to change image resolution with HTML?

 6:30 pm on Aug 11, 2005 (gmt 0)

I know it is possible to specify the size of an image with html code. But is it possible to specify the image resolution.
I have several images that I am linking to on our webserver that are stored as 300 dpi images - I want them to display on my web page as 96 dpi.

Can I specify both the size and resolution of my existing images?



 8:21 pm on Aug 11, 2005 (gmt 0)

>>>>> I want them to display on my web page as 96 dpi.

It doesn't matter what DPI (PPI) the image is; it will display the same on a computer screen.

>>>>>>Can I specify both the size and resolution of my existing images?



 8:23 pm on Aug 11, 2005 (gmt 0)

Welcome to the forums, bubba1965. Unfortunately, there is no way of specifying the resolution of the images in HTML. For best results, you should lower the quality and filesize of your images to ensure that they are the appropriate resolution quick to download.


 12:59 am on Aug 12, 2005 (gmt 0)

Is it possible to do with php?


 1:26 am on Aug 12, 2005 (gmt 0)

Looking through the function list for images, no.


 2:41 am on Aug 12, 2005 (gmt 0)

Note that the height and width attributes for the <img> tag are in pixels - that number is just a "mere" pixel count and has nothing to with resolution of the image. This is sometimes called an "intrinsic dimension" as opposed to the kind of height and width that are described in a css rule and NEED UNITS.

It is possible for a browser to read the pixel width and height directly from the image file itself - and if you do not define width and height attributes for the <img> element, that is exactly what will happen.


 2:58 am on Aug 12, 2005 (gmt 0)

There are server-side components that can resize/resample images in this fashion on demand.


 9:24 am on Aug 12, 2005 (gmt 0)

For bitmap images, DPI is meaningless garbage. DPI is only meaningful with respect to vector images (such as fonts and meta files) and possibly fractal images.

Use PaintShop Pro (or whatever) and rescale the images, save under another name and display those on your website.

Unless you have specific need to rescale on demand (which will use a lot of CPU power) this is the only sensible solution. Specifying the image size in html can result in extremely ugly rendering. I always remove the width and height attributes from <IMG> tags. That way if I change the native size of an image, I don't have to edit every page it appears on.



 5:45 am on Aug 13, 2005 (gmt 0)

DPI is relevant to Bitmap (raster images) in some situations, but just not when you are talking screen resolution I agree.
When going to print with images the DPI is a factor as usally they are specified in width and height of the image in milimeters/inches.
e.g. width (in inches) x dpi = width in pixels

Hence when you say an image is so many pixels wide, the resolution is irelevant :-)

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / HTML
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved