Secret ingredients to quality software

SSW Foursquare

Rules to Better Websites - Graphics - 20 Rules

  1. Do you avoid BMPs for web at all times?

    Never use bitmap images (.BMP format) on your website or in emails. BMP is an uncompressed format, and typically has an unlimited color palette. This results in unnecessarily large file sizes, which makes it unsuitable for pretty much everything.

    As an alternative, the most ideal format for Internet-ready lossless images is PNG.

    We have a program called SSW Code Auditor to check for this rule.

  2. Many websites have screenshots images to illustrate content instructions. With so many different screens sizes and resolutions, you probably have seen a screenshot that was unreadable.

    You don't want that in your website! Always make sure the screenshots you share as content are readable to the user.

    Only keep what is relevant

    Crop your image when you can, keeping only the relevant areas of the image.

    In the cases where you do need a full screenshot, it's a good idea to allow users to open the image in a bigger size, using lightboxes for example.

    images uncropped bad
    Figure: Bad Example - The contents of the screenshots are difficult to read

    images cropped good
    Figure: Good Example - The contents of the screenshots are readable, since the image was cropped to the relevant part

    Mobile screenshots

    Most times screenshots bad readability is caused by too small texts in images, however too big images can also make it difficult for the reader to follow.

    Modern mobile devices have extraordinary screen resolution, which makes screenshots huge. Another problem is that these screenshots are in usually in portrait dimensions (image is taller than it is wider).

    When adding a mobile screenshot, make sure its width is about 50% of a desktop screen.

    privacy mode ios huge
    Figure: Bad Example - mobile screenshot is way too big

    privacy mode ios
    Figure: Good Example - mobile screenshot is smaller and easier to follow

  3. Specifying the width and height properties for an <img> tag of HTML can sometimes turn out to be more trouble than it's worth, particularly if the image is later updated with different dimensions. If the height / width ratio doesn't match that of original image, the image might be stretched.

    Adding fixed widths to your images may also disrupt the responsiveness of your content.

    In other words, you should not have the image dimensions specified in HTML unless you have a very specific reason to do so. Use CSS if you need to specify images dimensions.

    <img src="images/codeauditor-logo.png" alt="Code Auditor logo" width="150" height="100" />

    streched image
    Figure: Bad example - Stretched image caused by inline height/width ratio that doesn't match

    <img src="images/codeauditor-logo.png" alt="Code Auditor logo"  />

    non streched image
    Figure: Good example - Avoiding inline height/width ratio keeps the image as original

  4. Specifying the width and height properties for images on your web pages can sometimes turn out to be more trouble than it's worth, particularly if the image is updated with different dimensions. Adding fixed widths to your images also disrupt your content on any responsive websites.

    In other words, you should not have the image dimensions specified in HTML unless you have a very specific reason to do so. Use CSS if you need to specify images dimensions.

    <img src="MyPic.gif" width="93" height="25">

    Figure: Bad Example - Including the width and height properties for content images

    <img src="MyPic.gif">

    Figure: Good Example - Exclude width and height properties for content images

  5. Do you have a favicon in your webpage?

    A Favicon is a small image file included on professionally developed sites. The favicon reflects the look and feel of the website or the organizations' visual identity.

    favicon bad
    Figure: Bad Example - When you don't add a favicon the user sees a generic icon

    favicon good
    Figure: Good Example - Using the favicon gives your website professional look and feel

    Which formats and sizes to use?

    The format of the image must be one of PNG (a W3C standard), GIF, or ICO. You can export your favicon in all necessary sizes on Favicon Generator website.

    How to implement the favicon?

    1. Copy your company's favicon to the root of the site
    2. Add the highlighted code below inside the <HEAD> tags in your HTML

    <head> <title>Page Title</title> <link rel="shortcut icon" href="/images/favicon.ico" type="image/x-icon" /> </head>

    Figure: One line of HTML lets you add your company's icon to your web page ** **
    This works for most websites, including ASPX WebForms, MVC and WordPress.

    We have SSW CodeAuditor and SSW LinkAuditor to check for this rule.

  6. Do you have good quality images?

    Every time you add an image to your content, make sure it:

    • Has at least 800px width (except for logos, icons, and profile images)
    • Is readable if it has any text on it
    • Looks consistent with others on the same page
    • (optional) Is not in dark-mode - Light background images look better most of the times
  7. Developers should never do design work. A bad design can be dangerous for the project. It's the web designer’s responsibility to create the overall look and feel of the website and define anything related to layout, typography, color selection, branding and overall consistency. The designer is also responsible for any image processing, web optimization and browser/platform testing of the website.

    BadDesignGun
    Figure: Bad design can be dangerous!

  8. If you've ever wondered why the formats of graphics on the web differ from each other, you're not alone. With SVGs, PNGs, and JPGs, it's hard to know which format you should use in a particular situation. Don't simply add any image that looks alright, it is very important to know the advantages and disadvantages of each format for optimization.

  9. Screenshots are a very important part of websites these days. Be careful to avoid unnecessary toolbars and taskbars in screen shots.

    Figure: Bad Example - This screenshot includes personal browsers

    Good No Personal Info
    Figure: Good Example - This screenshot has been cropped to hide personal browsers

    Tips:

    1. Use a region screen shot if appropriate (however the URL is generally helpful in most browser screen shots)
    2. Go full screen e.g. F11 in Internet Explorer, then <Alt>+<Print>
    3. Always have the 'Auto-hide the taskbar' option checked

    Figure: Always have the 'Auto-hide the taskbar' option checked so you do be screen shots

  10. Do you know when to use JPG?

    In line with the statement above, all photographs should be stored in JPG format. JPG rationalizes the quality of the image by averaging out the colors in segments of the image that it defines. To see an example of this working, try lowering the quality of a JPG to minimum quality.

    Screen JPGQuality1
    Figure: Bad Example – Low quality JPG (11.87k)

    Screen JPGQuality2
    Figure: Bad Example – Uncompressed JPG (159.6k)

    Screen JPGQuality3
    Figure: Good Example – Compressed JPG (59.6k)

  11. Do you know when to use PNG?

    PNG is an alternative to JPG, heavily endorsed by some circles, mainly because of its open source and non-commercial nature.

    PNG boasts:

    • Alpha blending (24 bit transparency map support)
    • Unlimited and limited color palettes. This makes it a good alternative to BMP.
    • Multiple CRCs so that file integrity can be checked without viewing

    However, it has rather poor file compression and should be used sparingly.

  12. Do you know when to use SVG?

    Line art graphics and anything with well defined shapes (logos, vector illustrations, e.t.c.) must be saved in SVG format.

    Some of SVG format advantages are:

    • Written in XML
    • Text-based
    • Official W3C graphics standard
    • Accessible for people with visual disabilities
    • Searchable
    • Can be animated
    • No pixelation
    • Small file size
    • Supports transparency
    • Text can be selected, copied, spoken by the computer, and indexed by search engines.

    jpg vs svg bad
    Figure: Bad Example - this graphic is line art, but has mistakenly been saved as a JPEG. It loses resolution.

    svg
    Figure: Good Example - the same graphic, saved as an SVG, no pixelation.

  13. When want to show an image from the web on your website, the easiest way is to just copy the image's path and add it. This is not a good idea as the original host of the image can delete it, which will cause a broken image in your website.

    The right way to do this is to copy the image locally and upload to your own server, so you have total control over the image.

    <img src="https://some-external-url.com/images/open-extension.png" alt="Open extension"> 
    <dd>Figure: Open extension</dd>

    Figure: Bad example - using an external URL as image source. The image can be edited or deleted and there is nothing you can do about it

    <img src="https://ssw.com.au/images/open-extension.png" alt="Open extension"> 
    <dd>Figure: Open extension</dd>

    Figure: Good example - Image is hosted internally. You have control over the image

    Note:  For copyrighted images, it is important to always mention the source.

  14. Image files are outside the realm of most database developers mind sets. So I've seen many very messy websites that have duplicate images all over the place. You only need an image in one place in your web site. The rule is that if it is used once, it goes in the associated directory - e.g. /ssw/Company/Images OR if it is used more than once, the image is moved to the root images directory - e.g. /ssw/Images. One of benefits of avoiding duplicate images is speed up web surfing for your users.

  15. Do you optimize your images for web?

    A nice looking image can be harmful to your website if it's not optimized. It's important to optimize images for the web because the fewer bytes the browser has to download, the less bandwidth the client uses, and the faster the browser can download and render your content on the screen.

    The first thing is to save your graphics in the right format and size. After that, you should run an image optimizer.

    Some tips and techniques to keep in mind as you work on optimizing your images:

    • Don't be afraid to dial down the "quality" settings if the results are very good and byte savings are significant
    • Remove unnecessary image metadata like geo information, camera information, and so on.
    • Use automated tools to ensure that all of your images are always optimized. E.g.: http://optimizilla.com

    optimizeexample
    Figure: Optimizilla reduced the image below in 31%

    WordPress

    If your website is running on WordPress you should install and activate the plugin WP Smush. It scans every image you upload – or have already added to your site – cuts all the unnecessary data and scales it for you before adding it to your media library.

    wp smush
    Figure: WP Smush plugin saved 9.4MB from one web site

  16. Do you prefix your images appropriately?

    It is important to sensibly name your images. We don't use "img" (in the same way we don't use "tbl" for tables).

    However, for special types of images we do include a prefix.

    Image TypePrefixExample
    BannerbanbanSSW.gif
    IconicoicoSSW.ico
    ScreenshotScreenScreenCodeAuditorMainWindow.gif

    Figure: Correctly named images

  17. Do you use high quality images?

    Never stretch small, low-resolution photos to make it fill up the space. This degrades the resolution and the image will appear very coarse and granular on the projection screen.

    The quality of your images is a subconscious message to your audience. If you use low quality pictures, then you unintentionally suggest the same message about your product.

    For this reason, we encourage you to choose only high quality photos and to avoid cartoons and word art.

    low quality
    Figure: Bad Example - What is this monstrosity!

    high quality
    Figure: Figure: Good Example - Looks classy, that

  18. A sprite is an image that has all of your other images inside of it, so if your sprite has 5 images, you’d be getting rid of 4 HTTP requests and speeding your site’s loading time up by the time for each of those 4 requests latency. You will use CSS selectors for each link to display only a portion of the image sprite - effectively showing just the image you need.

    The benefits to use CSS image sprites are:

    • to save bandwidth
    • to reduce HTTP server requests
    • to speed up page load times

    Ensure that the file size of your master image isn't greater than the sum of its pieces.

    Figure: Bad Example - four images, one for each icon

    Figure: Good Example - one image contains all the icons and CSS selectors make the browser display only the part you need

  19. Many people will simply "plonk" an image onto a web page in between or next to a block of text. This interrupts the flow of the page and gives a disjointed, unprofessional impression.

    A good technique is to set a CSS style to images. This style will be consistent and easy to be used by any person who might edit the website content.

    imageWithoutStyles
    Figure: Bad Example - The image has no styles

    imageWithStyles
    Figure: Good Example - The image has CSS driven margin, padding, borders

    It's also important to choose the correct semantic formatting for images. Different HTML codes might give the same look and feel, but the best way to add images to your page is using <dl> , <dt> and <dd> tags.

    <div class="badImage">
            <img src="Images/imageWithoutStyles.jpg" alt="Image without styles">
            <span>Figure: Bad Example - The image has no styles</span>
        </div>

    Figure: Bad Example - Inserting images and captions inside <div> tags

            <img src="Images/imageWithoutStyles.jpg" alt="Image without styles">
            <dd>Figure: Bad Example - The image has no styles</dd>
        

    Figure: Good Example - Using the <dl>, <dt> and <dd> tags for images

  20. Using text rather than images has multiple advantages:

    • Downloads faster - a users patience extends to about 7 seconds.
    • Cheaper to update - a simple find and replace.
    • Discoverable by search engines - if people can't get to your site, what's the point of it being there?
    • Readable on an iPhone - Images will either be resized or require scrolling, which would create difficulties for readability.

    <img src="Images/Heading_Welcome.gif">Figure: Bad Example - using image for text header<h1>Welcome to My Page</h1>Figure: Good Example - this text can be easily rendered by the browser and recognized by search engine

We open source. Powered by GitHub