Optimize “CSS Repeated” Background Images In Photoshop

Website-Gradient-Optimize

Today were going to take a look at how to optimize your background images in Photoshop. Most blogs use a repeated background image to provide a sense of individuality in their blog designs. In most cases, this sets blogs apart by appearance which is an excellent first step in attracting new readers.

Photoshop CS3 is an amazing tool that has years of experience built into its image algorithms. By utilizing the 4 pane view in Photoshop (when saving an image) you can reduce the size of your image to the smallest possible.

Using CSS’s repeat function, you can use beautiful gradients and background images without killing your web server.

Lets take a real look at what I’m talking about here:

The Correct Way To Optimize Background Images in Photoshop:

Step 1 – Find a vector image on the internet or custom design your own gradient with Photoshop, as such:

Step1-Design-The-Gradient

Step 2 – Depending on the image chosen, make the vector as small as possible so that you can “repeat” the property using CSS – Using a large image to repeat a pattern just wastes bandwidth. For gradients, reduce your picture to 1px by the height.

Step2-Reduce-The-File-Size

Step 3 – Click “File” and “Save for Web & Devices” (just using “Save As” doesn’t take advantage of the unique algorithms). Once you are in this menu, choose the “4-Up” option in the tabs which allows you to see four different previews in any format you choose.

Step3-Choose-The-4up-Menu

Step 4 – In the first square is the original file. Click the second frame and choose a JPEG, set it to at least high quality. In the third frame choose the PNG-24 encoding and finally in the fourth frame choose the PNG-8 option. You can change the colours as you wish, but the best you can get with PNG-8 is 256 colours.

Step 5 – Now comes the easy part, after adjusting the settings on each of the proofs, you can now view which file is the smallest! For 1px width gradients, I’ve found that PNG-24 compresses it the best without a loss of quality.

Step5-Choose-The-Smallest-Image-File

Step 6 – Choose your save location and then start using it in your website! If you like the gradient used in the example, save this file to your computer and feel free to use it. If you want to use it via CSS, simply use the “background” property of an element. IE:

.elementexample {
background: url("WhereisTheGradientLocated.png") repeat-x;
}

Conclusion – Compressing Gradients For Faster Loading Websites

This is such an easy method to use if you have Photoshop to reduce website loading times. I utilize this technique on every website that I design and find it to be well worth the effort. This method can be used to save any image for a website, as it gives you four different formats to choose from.

Have you found a better way to compress gradients? What techniques do you use when saving a gradient for a website?

Part 1 of the “Reduce Your Blog’s Loading Speed” post series.

Related posts:

  1. Further Accelerate Your Blog – MaxCDN is offering 1TB of Bandwidth for $10
  2. Save Money, Save Time – Use The World’s Largest Free CDN
This entry was posted in Blog Loading Speed and tagged , , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

Enjoy this post? Theres more to come, so click here to subscribe to our RSS Feed.

11 Comments

  1. Posted December 10, 2009 at 3:12 pm | Permalink

    Really cool tip Brad…. very clever. I usually design a logo and compress in png24. Not that I can design logo’s very well.

    • Posted December 10, 2009 at 4:34 pm | Permalink

      Funny enough.. I also used PNG24 to format my logo at the top of this blog! I like PNG24 not only for the fact that it supports transparency and millions of colours, but it also makes a perfect image compared to a JPEG.

      Great hearing your opinion, Jonny! :D

  2. Posted December 11, 2009 at 9:37 pm | Permalink

    Nice to be learning online about photoshop. I also want my website background to stand out.

    • Posted December 19, 2009 at 3:56 pm | Permalink

      Repeated backgrounds are easy on bandwidth and provide a great way to differentiate your website against the billions of other ones on the internet! :)

  3. Posted December 14, 2009 at 10:21 pm | Permalink

    I’ve been using Photoshop CS3 for a year and only now did I know notice that there’s a save as ‘Save for Web & Devices’. I’ve always thought of JPG as the best format with the least size for webpages. 4UP? PNG24? Hmmmn…it pays to read more and not pretend to know enough. :) Thanks Brad.
    Jenny M.´s last blog ..Flower Shops That Deliver My ComLuv Profile

    • Posted December 19, 2009 at 3:57 pm | Permalink

      Hi Jenny – I thought the same thing until I read a tutorial on how to create photoshop images which lead me to that save button. LOL – Glad you found the article useful! :)

  4. Posted December 17, 2009 at 2:21 pm | Permalink

    Nice technique there!

    What is the difference between the standard Photoshop and CS3. Can you the same with the standard one?

    • Posted December 19, 2009 at 3:57 pm | Permalink

      I’m sure that there should be a “Save for web” option on older versions, however I do not know what it would be called in older versions… do you?

  5. Posted December 19, 2009 at 8:49 am | Permalink

    My current theme cannot support it. Need to do some customization before apply this. ;)
    Jayce´s last blog ..How to hack Facebook account profile My ComLuv Profile

    • Posted December 19, 2009 at 3:58 pm | Permalink

      Could you elaborate on what you mean by not supporting it? I’d be glad to help.

  6. Posted December 30, 2009 at 7:07 am | Permalink

    Oh it’s really nice post and very informative. I find it helpful and useful for my site. Thanks for sharing.

One Trackback

  1. [...] Optimize “CSS Repeated” Background Images In Photoshop (bradblogging.com) Categories: Tips Tags: Web Design and Development [...]

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

CommentLuv Enabled

686 RSS Subscribers

Subscribe today to recieve any updates on this blog for free!

You'll also receive, "The Blog Manual" free of charge for being a subscriber which you can download at the bottom of each post.

 


Blog Advertisers

Recent Comments

  • Rian said: Hi Brad, I am assuming hooks are only great for loyal blog readers. Because usually, our blog posts...

  • Jonny said: As usual you are right Brad I think I should pay more attention to headlines looking back at some...

  • SEO said: Exactly proper marketing can get an article attention, one of proper marketing encompasses the...

  • Ganesh Iyer said: Apart from having an interesting title, the content of the article should be absorbing. This...

  • George Angus said: Brad, Great stuff. Looking forward to the next in the series. Headlines (titles) are...

  • About The Author

    Brad Ney

    I am a Wordpress enthusiast, part-time website designer, and enjoy using the latest technology via the internet for website promotion.I enjoy writing about startup websites, XHTML, CSS, Wordpress based on what I've learned in the industry.

    Reader Poll

    • Are you a...

      View Results

      Loading ... Loading ...