• 0

Vector vs Raster


Question

post-32224-1133451181.gif

Throughout my time here in Neowin, I have seen many questions on graphics answered hundreds of times, and felt that a central respository on some of the more simple questions of computer graphics could be useful. And so, I've created this. Please give your comments, corrections and suggestions for revisions.

post-32224-1133451194.gif

Raster graphics are images that are defined in terms of a generally rectangular grid of pixels, or picture elements. Each pixel is one small square of colour, which, when combined with other pixels side by side, merge together to form one solid image to the eye. Let's take a popular Neowin smiley and analyse its pixel content:

post-32224-1133451207.gif

Colours

Computer graphics are generally stored in RGB or CYMK colour formats. The former will be explained in this guide, and should demand be sufficient for a CYMK section, this will be added later.

Colours are made up of a combination of red, green, and blue part intensity. The intensity can vary between 0 and 255.

  • Red is 255 parts red, 0 parts green and 0 parts blue.
  • Black is 0 parts red, 0 parts green, 0 parts blue.
  • White is 255 parts red, 255 parts green, 255 parts blue.
  • Yellow is 255 parts red, 255 parts green and 0 parts blue.

Each one 16,777,216 colours that are theoretically available are made up of a combination of red green and blue.

The colour yellow can be represented as #FFFF00 in the hexadecimal system. Here, 6 digits are used, which can be the numbers 0-9, or the letter A-F. This way, 256 possible values can be represented in two characters. #FFFF00 represents FF parts red, FF parts green and 00 parts blue, FF equalling 255 in regular denary figures. Hexadecimal figures are mostly used in web design, since the HTML specification accepts these figures most readily. Newer, CSS techniques allow individual R, G and B parts to be specified in denary, however.

Anti-aliasing

90s web design was characterised by "the jaggies". The relatively large size of a pixel can be a problem when drawing lines that are neither horizontal nor vertical. Without some way of merging a diagonal line into the background, the line appears choppy and has an unprofessional, unclean appearance. Anti-aliasing to the rescue.

post-32224-1133451142.gif

Anti-aliasing works by adding intermittant pixels with a colour somewhere between that of the foreground and background, such that the images merge in the eye of the viewer. The result is a straighter line without so many visible "steps" due to the grid-nature of raster graphics.

Dithering

Modern displays and graphics adaptors can display the full complement of 16,777,216 colours, to a greater or lesser degree of colour accuracy. But what happens if a user is viewing on less than 32-bit colours, let's say, 256 colours? A process known as dithering can occur - either at the time of image creation of by the graphics adaptor at display time - to trick the eye into seeing more colours than are actually capable of being displayed. For example:

post-32224-1133451165.gif

What initially appears as a block of orange colour is actually alternating pixels of red and yellow. The success of dithering is varied and it is not used often in modern computing when the full compliment of colours is available. Nevertheless, some web browsers still do not support full alpha channels and so a dithered overlay of black and transparent pixels can produce the appearance of a darker shade over an image. For example, the following image obtained from SausageMania.com has a dithering effect applied above the poor girl's eyebrows.

post-32224-1133451201.gif

Transparency

Raster graphics are rectangular. But there are ways to overlay graphics such that the background appears from behind the rectangle. There are two types of transparency. The former, supported by formats such as GIF, allows a pixel to be either transparent or opaque. The latter, supported by formats such as PNG, allows 256 levels of transparency ranging from fully transparent to fully opaque, and everything in between. This second complex level of transparency, full alpha channel support, allows for more complex visual effects to be presented to the viewer where "layers" of an image can be translucent. This is fine in graphic design, but on the web it can prove a little trickier.

Raster formats

There have been a number of formats developed over the years to store raster graphics. Some of the most popular formats are discussed below, each with their advantages and disadvantages.

BMP - Bitmap Graphics

  • Easy to create with the built-in Windows Paint program.
  • Long history, therefore good, universal support.
  • No compression means the format is lossless.
  • Creates huge files since no file compression is used.
  • No transparency.

arrowright6tq.gif Avoid wherever possible.

GIF - Graphics Interchange Format

  • Creates small files as good compression is used.
  • Universally supported across platforms.
  • Transparency supported.
  • Animation supported.
  • Palette of colours limited to 256 per image.
  • Transparency is only 1-bit, therefore no translucency.

arrowright6tq.gif Good for the web, on images of less than 256 colours, for example simple geometric shapes e.g. bullets for lists.

JPG - Joint Photographic Expert Group

  • Lossy compression format produces relatively small files.
  • Universally supported across platforms.
  • Artifacts visible at high compression rates.
  • No transparency.

arrowright6tq.gif Good for the web, for images like photographs where colour depth is important but lossless formats produce large file sizes.

PNG - Portable Network Graphics

  • Both lossy and lossless compression available.
  • Both 1-bit and full alpha channel transparency available.
  • Small file sizes produced.
  • Poor support in some web browsers for full channel transparency.
  • Compression not as great as lossy formats.

arrowright6tq.gif Great for the web, but be careful if using transparency. Good trade-off of quality and compression.

post-32224-1133451226.gif

Where raster graphics are defined in terms of individual pixels, vector graphics are actually stored as mathematical rules - widths, heights, curves, proportions, ratios. Where raster graphics have a set height and width and look pixelated when stretched beyond these boundaries, vector graphics render themselves to the space given to them, such that they are resolution independent. Let's take a look at the Microsoft logo.

post-32224-1133451188.gif

As you can see, the vector based logo is not based on pixels any longer. It is based on points set at proportional distances, joined with lines and curves, and filled with a solid black colour.

When drawing curves in vector graphics programs, a number of points are defined and dragged such that a smooth curve is plotted. This curve is independent of dimensions but is saved as in proportions and ratios such that it will scale to any resolution. An example:

post-32224-1133451159.gif

Vector graphics formats

Again, a number of formats exist for storing vector graphics, each with their advantages. It is important to note that, by their very definition, vector graphics are SMALL in comparison to raster graphics when it comes to file size. Since they are not saving information on each and every pixel, but rather rules for rendering, file size is cut immensely. The universally accepted format for vector graphics, particularly when it comes to company logos and sending files to print, is EPS - Encapsulated PostScript. PostScript is a format developed by Adobe to describe pages to a printer, plotter, or screen. Rather than storing straight data it stores instructions for the makeup of the page. Fonts are stored as individual character vector objects, for example, so they can be printed at as high a resolution as the printer can print. Macromedia's Flash technology is an excellent example of vector graphics working at their finest - whatever the window size, vector elements of the Flash movie appear crisply anti-aliased, and individual frames can even be printed in high resolution due to the vector-based nature.

post-32224-1133451151.gif

Popular raster graphics programs

Popular vector graphics programs

Popular vector graphics animation programs

post-32224-1133451173.gif

A good question. At first glance, vector graphics seem to overcome all the difficulties of raster graphics. They can be resized to any size without loss of quality, and pixelation just doesn't occur. File size is also greatly reduced. However, each format has an individual purpose. A photograph cannot be expressed as a vector graphic because it simply isn't vector data. A sunset cannot be defined mathematically, at the risk of starting a philosophical argument on the world around us. The real world is not vector-based. The table in front of you has an infinite pixel depth, infinite variations in colours, infinite variations in relief and texture. Vector graphics are reserved for images such as typefaces, lines, curves. Complex vector images can be created but they have been created specifically IN vectors. Photographs and complex raster effects like lens flares are defined with pixel-by-pixel lighting and colour effects, not with vectors.

Of course, this isn't to say that attempting to express real-world objects as vectors won't make excellent images artistically...

post-32224-1133451232.gif

A good example to illustrate a collaboration between the two is in Pixar animated films. Let's take Sully.

post-32224-1133451215.gif

The character of Sully is created as a 3D mesh in a 3D vector graphics application. It can be made to any size because of its vector nature. When it comes to rendering the final film, however, things like fur effects, scene lighting and other special effects are added as raster filters to the image. The collaboration of the two creates the blend between computer editability (vector) and realistic visuals (raster).

Logos for businesses should always be created as a vector. Why? For maximum usage. It's all very well creating a great raster logo with lens flares and bevels and gradients but what happens when it needs to be on a huge banner in a hall? Or, at the other extreme, printed on headed notepaper. Raster effects just are not practical when it comes to corporate identities. With vector-based logos, the image will scale to any size and any application; raster graphics would require re-rendering each time a new size was required, not to mention problems with transparency across print and computer platforms.

Edited by Rob
Link to comment
https://www.neowin.net/forum/topic/353159-vector-vs-raster/
Share on other sites

Recommended Posts

  • 0

Many thanks for all the kind comments, and for AgEnTsMiTh for realising its potential - now it's the job of you guys to give some suggestions on improvements, any graphic-related issues that need explaining with a couple of choice screenshots. Had to edit out some of the pretty smileys I used when writing it due to the limit of images per post, I wonder if that's removable if I end up reaching it with additions?

  • 0
Thanks for the warm welcome :D  :D

Rob may I ask you what kind of software you are using for vector drawing?

I have some experience with CorelDRAW, what do you think of it?

586320855[/snapback]

I used CorelDRAW from version 2 way back in... whenever that was released. Great program, I highly recommend it personally, but professionals generally use Adobe Illustrator or Macromedia Freehand for vector graphics.

Me, I'm a web designer as opposed to a designer in the traditional sense and as such I use Macromedia Fireworks. There's very few features that I've needed that it hasn't had and I've had to resort to Photoshop.

  • 0
Finally! Another Fireworks nut, it's all I've used for a long time - when doing web design, it's so much easier than using PS. The 'live effects' are a life saver  :yes:

586324956[/snapback]

Too true - Fireworks is a superb program, I find it easier to use than PS without much loss in functionality (taking into consideration the differing intentions of the program anyway). And live effects... love 'em!

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • Bulk Crap Uninstaller 6.2 by Razvan Serea Bulk Crap Uninstaller is a free (as in speech) program uninstaller. It excels at removing large amounts of applications with minimal user input. It can clean up leftovers, detect orphaned applications, run uninstallers according to premade lists, and much more. Even though BCU was made with IT pros in mind, by default it is so straight-forward that anyone can use it effortlessly! Bulk Crap Uninstaller features: Detect and uninstall Windows Store apps Uninstall multiple items at once to speed up the process (with collision prevention) Uninstall any number of applications in a single batch Minimal user input is required during uninstallation Can find and remove leftovers after uninstallation Can uninstall some apps even if they don't have any uninstallers Detects applications with damaged or missing uninstallers Adds quiet uninstall options to some uninstallers, even if they do not support them by default Uninstall lists for automation Startup manager Verification of uninstaller certificates Fully portable, settings are saved to a single file Bulk Crap Uninstaller 6.2 changelog: Features Add invalid-uninstaller view preset by @breshinotestachegira in #903 Add certificate and integrity columns to app list by @breshinotestachegira in #894 Improve Scoop custom path detection by @breshinotestachegira in #892 Fixes Improve uninstall list load error handling by @breshinotestachegira in #895 Fix tweak visibility filtering by @breshinotestachegira in #898 Fix orphaned-only view preset by @breshinotestachegira in #899 Stabilize icon handle ownership by @breshinotestachegira in #902 Fix: Use Directory.GetLastWriteTime for install date fallback by @AniketDeshmane in #908 Do not offer to send "no way to uninstall" error messages by @Klocman in #922 Ignore ERROR_BAD_CONFIGURATION when listing MSI components by @Klocman in #924 Eat InvalidOperationException coming from ListViewGroupAccessibleObject by @Klocman in #925 Harden BCU console export and size detection - Fix BCU-console export failures by @breshinotestachegira in #897 Harden registry factory parsing by @breshinotestachegira in #893 Guard startup uninstall list loading by @breshinotestachegira in #927 Clean generated files on uninstall by @One-Simon in #928 Translations Updated Hungarian translation by @titanicbobo in #875 Updated Vietnamese translations by @wanwanvxt in #918 Fix : Swedish translation causes UI overflow in some windows by @Leise-Shadow in #865 Other Fix publish script after v6.1 by @tsiakoulias in #868 Updated the localization pack Repository Moved the repository under a new BCUninstaller organization (old links still work) Added two maintainers: @hazeliscoding and @One-Simon Added PR merge rules (require up-to-date approval and CI to pass) Updated CI script to also build the launcher (only for testing, not included in artifacts) Download: Bulk Crap Uninstaller 6.2 | 8.8 MB (Open Source) Download: Bulk Crap Uninstaller Portable | 11.6 MB View: Bulk Crap Uninstaller Home Page | GitHub | Screenshot Get alerted to all of our Software updates on Twitter at @NeowinSoftware
    • If built properly, swapping out the backend should be an easy task, but as the article points out, it's just Apple not wanting to do this.
    • Microsoft's new Xbox Shutdown change promises massive power efficiency gains by Pulasthi Ariyasinghe Microsoft has been delivering a lot of changes for Xbox Insiders to test in recent weeks, and today, another wave of changes aimed at consoles was announced. The latest drop is testing features that let users find mutual friends easier, customize their UI, and streamline wishlisting. When looking at an Xbox friend's profile, an option will appear to see mutual friends, perhaps to get a refresher on how you know that person. This will depend on the privacy settings. The same applies to when checking the profile of a person who is not in the friends list, offering a quick way to find out if this is a known connection. Next, Microsoft is giving the option to change how the 'Home' and 'Games & Apps' sections show off available games. There is a new poster style that users can enable for an "immersive library experience." "We’ve also made personalization settings easier to navigate and customize by separating Home and My Games & apps into separate sections," adds the company. "And to make personalization even more accessible, we’ve added new shortcuts throughout menus, so you can quickly jump in and tailor your XBOX experience the way you want." Moreover, heading to the store page of an unreleased game will now offer players the option to wishlist directly from the game card. Lastly, Microsoft is making a change to Xbox One and Xbox Series X|S consoles that are in Sleep mode, making them use the more energy-saving 'Shutdown' mode instead automatically. The company says this can increase power savings by up to 20 times without impacting "performance, gameplay, or your ability to receive system, games or apps updates overnight." The only down side seems to be a longer startup time that can take up to 45 seconds. The setting was originally introduced in 2023, and this is only the latest update to it. The power option can be changed from the console settings at any time. This Xbox Insider update is rolling out today to select members of the program. As usual, Microsoft aims to bring it to more Insiders over time before they reach all Xbox owners. Head here to find out how to join the Xbox Insider Program to get a chance to test these features and upcoming ones on both consoles and PC.
    • 2 was a fun game but felt a bit shallow, like not enough there. I hope this expansion fixes that.
  • Popular Contributors

    1. 1
      +primortal
      507
    2. 2
      PsYcHoKiLLa
      211
    3. 3
      +Edouard
      145
    4. 4
      Steven P.
      88
    5. 5
      ATLien_0
      80
  • Tell a friend

    Love Neowin? Tell a friend!