The Dark Furie

Resizing Images - Quick And Dirty, How To Guide

I've been asked by a few people to explain how to resize an image so that it displays better in blog posts and forums. Rather than continue to type out how to do it over and over, I've decided to add this post to my Tips collection of posts.


First, start with your basic image. For this example we'll use my favourite thing in the whole world...Fresh steak, ready to cook.

The address of this image is http://files.myopera.com/Furie/files/steak1.JPG and the dimensions of the image are 1600 width and 1200 height, though my page automatically cuts it down to a decent size for viewing.

Now, that's a bit big isn't it? So lets cut it down a bit, shall we.

What sorcery is this then? The address of this image is still http://files.myopera.com/Furie/files/steak1.JPG but now the dimensions have been cut down to 200 width and 150 height. So, how do we do this? Simple.

<img src="http://files.myopera.com/Furie/files/steak1.JPG">
is what I typed to display the first image and
<img src="http://files.myopera.com/Furie/files/steak1.JPG" width="200" height="150">
is what I used to display the second one. Spot the difference yet?


By adding the height and width commands into the image code I can control the maximum size that the image will display at. The numbers I enter into the quotes will be the maximum allowed dimension of the image for either the height or the width.

One thing to remember while trying this out is that the image will display wrong if you don't cut each parameter down by the same percentage. As an example, on the following version of the same photo I'll cut the width down to 400 but keep the height at 100.

<img src="http://files.myopera.com/Furie/files/steak1.JPG" width="400" height="100">
is what I typed to get that one. You can still just about tell what it is, but I like my meat a little thicker than that...

To fix it I've got to figure out what the height should be. Using the original image size of width 1600 and height 1200, I can see that I've taken the width down to a quarter of what it started out as because the current width is 400. But the height isn't enough, so I need to take the height down to a quarter of it's original starting value as well. Lets see... A quarter of 1200 is 300 so I should enter that in the height value instead of 100 as it currently is. My final code should therefore be

<img src="http://files.myopera.com/Furie/files/steak1.JPG" width="400" height="300">

And it works perfectly.

Hope this post was helpful to people.

Highway To HellFinally Finished My CSS

Comments

theoddbod Saturday, November 3, 2007 10:05:42 PM

I'd like to add that this does not affect the actual download size of the image at all, so I don't want to see massive 3000x2000 bitmaps appearing everywhere as tiny scale images.

~ Callya ~Callya Saturday, November 3, 2007 10:33:11 PM

up Thanx a million for this Mik. I'm gonna try it out.

Dark FurieFurie Saturday, November 3, 2007 11:07:13 PM

Well said Mart. pssst Everyone knows what to put in comments to Mart now. lol

Seriously though, good point.

Christopher DaSilvadannii Sunday, November 4, 2007 1:13:06 AM

Great post up Always good to know when posting images yes

Dacotah Sunday, November 4, 2007 1:44:52 AM

up

KYrenKYren Sunday, November 4, 2007 4:11:08 AM

:up:Thank you Mik,you are an angel angel

Bad WolfCois Sunday, November 4, 2007 10:45:36 AM

ooh.. something to play with.. p how do you work it in the albums or are you unable to?

Dark FurieFurie Sunday, November 4, 2007 12:32:10 PM

Can't in albums I don't think.

Christopher DaSilvadannii Sunday, November 4, 2007 12:49:04 PM

Can we do it with the brand new [ IMG = ]??

Cuz I totally stopped using the < img src = now that it doesn't work on comments and when using them in posts then then it f*cks up all the breaks in hte post nervous

Dark FurieFurie Sunday, November 4, 2007 12:54:42 PM

I use manual breaks for most of my posts anyway. But no, I can't find how to make it work with square brackets. sad It's not something you'd use that often anyway, but I have been asked a few times how to do it.

Christopher DaSilvadannii Sunday, November 4, 2007 1:07:03 PM

Manual breaks suck cry

KYrenKYren Sunday, November 4, 2007 7:24:10 PM

There is a []bbcode for resizing images on this site http://handbook.abovetopsecret.com/bbcode.htm
but it didn't work.

Dark FurieFurie Sunday, November 4, 2007 7:42:22 PM

Not everything is supported on every site. To make things worse, some sites make their own codes too.

Reshade Friday, May 2, 2008 7:06:50 PM

I like the way the image looks. I will have to try this out. I usually use a different online image resizer.

Dark FurieFurie Friday, May 2, 2008 7:19:09 PM

Whatever works for you. I rarely use this method myself, unless I can't find an image I want at the right size, but I was asked by a friend how to do this so thought it was worth the tutorial post.

Bad WolfCois Saturday, May 3, 2008 9:26:34 AM

It wasn't me was it?

Dark FurieFurie Saturday, May 3, 2008 11:04:08 AM

No, don't think so. confused

KYrenKYren Saturday, May 3, 2008 12:01:59 PM

This code has been very useful for me.Thank you,Mik.smile

Dark FurieFurie Saturday, May 3, 2008 4:31:45 PM

Glad to help anyone that wants it.

Dark FurieFurie Saturday, May 3, 2008 4:31:47 PM

Glad to help anyone that wants it.

Bad WolfCois Saturday, May 3, 2008 7:09:11 PM

Glad to help anyone that wants it.

Dark FurieFurie Saturday, May 3, 2008 10:58:52 PM

I don't remember reverting to my wolf form and typing that. scared

Bad WolfCois Sunday, May 4, 2008 9:40:20 AM

Its the classical Jekyl and Mr Hyde story.. left

Mad Scientistqlue Wednesday, January 7, 2009 4:01:58 PM

Is it just me or are all those images virtually the same in Operamini. left.

Dark FurieFurie Wednesday, January 7, 2009 4:04:47 PM

Opera Mini does play silly buggers with it.

ɥʇɐǝp ɟo ssǝɔuıɹdprincessofdeath Tuesday, April 28, 2009 10:04:23 AM

one disadvatage though... you can't put an image beside a paragraph. I used to resize image via HTML stuff but I had to use tables and stuff just to put the image on the right side of a block of text or on the left side (too complicated as Mik once told me).

Even if I use table format, the paragraph spacing gets smaller and disarray.

ɥʇɐǝp ɟo ssǝɔuıɹdprincessofdeath Tuesday, April 28, 2009 10:07:45 AM

btw.. the auto resize thing only works on Opera. The I can only see 1/3 of the first piture since I'm using IE

Dark FurieFurie Tuesday, April 28, 2009 11:16:57 AM

I don't cater for IE anymore. p You should try something along the lines of align="left" added to the code.

ɥʇɐǝp ɟo ssǝɔuıɹdprincessofdeath Tuesday, April 28, 2009 2:10:53 PM

seriously? it works? I'll try it then next time I post smile

Mad Scientistqlue Tuesday, April 28, 2009 2:26:17 PM

The only thing that works properly in IE is vbscript. Of course, since it doesn't work in any other browser you should probably avoid using it. whistle.

ɥʇɐǝp ɟo ssǝɔuıɹdprincessofdeath Wednesday, April 29, 2009 12:05:27 PM

ahahahaha.

Write a comment

New comments have been disabled for this post.