What is image optimisation?

aka Rohan's picture

He has: 200 posts

Joined: Feb 2006

demonhale;214652 wrote: Taking a look at it and your source it seems you do have a lot of unoptimized images.

This is part of Demonhales' reply to Gleamservices' thread about their site being slow which got me thinking;

What exactly is image optimisation, is it purely about reducing the size of the file (i.e. through resolution, number of colours e.t.c.) or does the way an image is coded into the page also have an effect?

I've always just created my image the size I need it for the page (so no browser resizing) and then included it where I want to with <img src="image.gif" alt="image description" />'

Could I be doing more to improve said image inclusions?

Megan's picture

She has: 11,421 posts

Joined: Jun 1999

Having a height and width on the HTML tag (that matches the height and width on the image itslef) can help the browser render it faster.

Renegade's picture

He has: 3,022 posts

Joined: Oct 2002

To me, "image optimisation" simply means saving the best possible quality for the lowest possible file size in an image.

JeevesBond's picture

He has: 3,956 posts

Joined: Jun 2002

Agreed with Renegade, it's the balance between getting the image file size as small as possible whilst retaining enough of the images quality.

There are many ways of doing this, and not all image formats reduce quality (what we call 'lossy'). PNG and GIF are both 'lossless' formats, that is they don't reduce the image quality in order to reduce file size, although they aren't very well suited to photographs. JPEG reduces image quality to decrease file size.

With regard to HTML, there's no way to optimise an image with it, although there are some good practices you can use when embedding images into pages:

  • Specify the height and width of the image (as Megan pointed out; this doesn't optimise the image itself but it does mean your page layout will not change as images are loaded).
  • Don't use HTML to change the dimensions of an image, e.g. width="200" height="200" for an image that has a width and height of 500px. This looks ugly, forces the user to download an image they'll probably never see in its entirety, and looks amateurish. Don't do it! Smiling

That's what I can think of immediately. Can anyone think of anymore best practices?

a Padded Cell our articles site!

aka Rohan's picture

He has: 200 posts

Joined: Feb 2006

Ah ok, I was kinda thinkin' there was something a bit more involved about it all but that's cool, at least I seem to be doing things right.

That specifying the height and width of the image is something i'll do in future though... good call guys. Up until now I just assumed you only used it if you needed to resize images (something I never do myself youuuu understand). Smiling

JeevesBond's picture

He has: 3,956 posts

Joined: Jun 2002

Monkeyboy wrote: (something I never do myself youuuu understand).

You been speaking to Stuart Ford this morning? 'Course, with my skills youuuuuu understand.'

Should've asked him how to do image optimisation!

The great thing about this post is that if Stuart ever does a search for himself on the Internet, there's a good chance he'll find this, especially if he includes the words: 'flat top'. Smiling

Hello Stuart Ford! :wave:

a Padded Cell our articles site!

He has: 1,758 posts

Joined: Jul 2002

JeevesBond;215539 wrote:

You been speaking to Stuart Ford this morning? 'Course, with my skills youuuuuu understand.'

Should've asked him how to do image optimisation!

The great thing about this post is that if Stuart ever does a search for himself on the Internet, there's a good chance he'll find this, especially if he includes the words: 'flat top'. Smiling

Hello Stuart Ford! :wave:

wtf? Confused Laughing out loud

Andy

JeevesBond's picture

He has: 3,956 posts

Joined: Jun 2002

Andy wrote: wtf?

Stuart Ford is someone Jules (monkeyboy) works with (and someone I used to work with). You ought to post a picture of him Jules. Smiling

He has some great catch-phrases, such as: 'You, errrrr, understand.' and 'course, errrr...' you should also get some recordings of that Jules, then everyone would errrr, understand.

a Padded Cell our articles site!

aka Rohan's picture

He has: 200 posts

Joined: Feb 2006

I'll see what I can do youuuuuu understand Laughing out loud

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.