Gifs, Pngs, & Jpgs: What's The Difference?



The img tag is used to put an image in an HTML document and it looks like this:

  1. Gifs Pngs & Jpgs: What's The Difference Regular
  2. Gifs Pngs & Jpgs: What's The Difference Female
  3. Gifs Pngs & Jpgs: What's The Difference Two

The src attribute tells the browser where to find the image. Like the a tag, this can be absolute, as the above example demonstrates, but is usually relative. For example, if you create your own image and save it as “alienpie.jpg” in a directory called “images” then the code would be <img src='images/alienpie.jpg'...

The width and height attributes are necessary because if they are excluded, the browser will tend to calculate the size as the image loads, instead of when the page loads, which means that the layout of the document may jump around while the page is loading.

In the email below, you can see how only the PNGs are disabled, while JPEGs and GIFs render just fine: SVG Unlike JPG, PNG, and GIF format images, SVG images are just plain text documents that describe the lines, shapes, and colors that make up the image. Files must be below 1 Megabyte in size and either be a PNG, GIF, or JPG. PNGs and GIFs with transparent backgrounds will keep their transparency. Image Optimizer lets you easily optimize your gifs, animated gifs, jpgs, and pngs, so they load as fast as possible on your site. Furthermore, you can easily convert from one image type to another. Upload Size limit: 2.86 MB.

The alt attribute is the alternative description. This is an accessibility consideration, providing meaningful information for users who are unable to see the image (if they are visually impaired, for example).

Note that, like the br tag, because the img element does not enclose any content, no closing tag is required.

The construction of images for the web is a little outside of the remit of this website, but it is worth noting a few things…

What

The most commonly used file formats used for images are JPEGs, GIFs, and PNGs. They are compressed formats, and have very different uses.

Gifs,

A JPEG (pronounced “jay-peg”) uses a mathematical algorithm to compress the image and will distort the original slightly. The lower the compression, the higher the file size, but the clearer the image.

Gifs Pngs & Jpgs: What's The Difference Regular

JPEGs are typically used for images such as photographs.

A GIF (pronounced “jif”) can have no more than 256 colors, but they maintain the colors of the original image. The lower the number of colors you have in the image, the lower the file size will be. GIFs also allow any pixel in the image to be transparent.

GIFs are typically used for images with solid colors, such as icons or logos.

Gifs, Pngs, & Jpgs: What

A PNG (pronounced “ping”) replicates colors, much like a GIF, but allows 16 million colors as well as alpha transparency (that is, an area could be 50% transparent).

Gifs, Pngs, & Jpgs: What

Gifs Pngs & Jpgs: What's The Difference Female

PNGs are typically used for versatile images in more complex designs BUT they are not fully supported by some older browsers.

Gifs Pngs & Jpgs: What's The Difference Two

The web is forever getting faster and faster but you obviously want your web pages to download as quickly as possible. Using super-high resolution images isn’t doing your or your user’s bandwidth (or patience) any favors. Image compression is a great tool and you need to strike a balance between image quality and image size. Most modern image manipulation programs allow you to compress images and the best way to figure out what is best suited for yourself is trial and error.