Raster v/s Vector Primer

Purpose

Creating, editing and using graphics can be quite a daunting and confusing task for the beginning sandcarver if they don’t have a computer graphics background. The purpose of this primer is to help the user to understand the difference between Raster and Vector graphics, how they’re created, when they are used and how to convert them from one to the other.

 

Overview

Raster graphics are probably the most easily obtainable graphic type to obtain, and the least flexible. Raster graphics can be easily generated through a digital camera, scanner or paint program, but trying to make changes to one, or use one at a different size than the size that it was created can be problematic. Raster file sizes can be extremely large and take extended time to transfer across the internet.

Vector graphics take time and effort to produce. They can not be created by simply taking a photo with a digital camera or scanning a paper drawing, however with effort a digital photo or scanned image can be CONVERTED to a vector image. Vector images can be significantly smaller than a corresponding raster image (depending upon how “clean” the vector file is) resulting in quicker file transfers across the internet and vector files have the added advantage of being able to be used to drive a vinyl cutter for creating vinyl or Hartco/Anchor stencils.

 

Raster Files

Raster File Description

In simplest terms, a raster image is nothing more than a series of dots or pixels (picture elements) in an X,Y matrix, nothing more. A raster image is basically a large grid – think of a huge checkerboard, or a screen door, or any grid with a lot of little squares. If you put a different color in each little square, you can build an image square by square. When you stand far enough away from the grid, the individual grid squares blend together and you see a complete photographic image. A good example of a raster image would be your TV or computer monitor picture. Look closely at your screen and you will see the individual dots that make up the image.

 

A raster image is a grid or matrix of individual dots or pixels Assign a color to each separate pixel in the grid …and you’ll have a raster image or digital picture/photo.

There is some minor overhead data contained in the raster file which defines the file format being used so it can be interpreted correctly. This overhead data can include the X and Y pixel count and Resolution (number of pixels per inch), the color palate being used which determines how colors are stored and how many colors are available for use; and any encryption or encoding/compression being used. Color palates can be 1-bit, 8-bit, 16-bit, 24-bit, 32-bit or 48-bit palates depending upon the file type the raster image is saved in. The greater the color palate, the larger the file size is (normally). Computer information is stored in Bits and Bytes. A Bit is a binary digit that is either a 1 or a 0, On or Off. A Byte is a series of 8 Bits. A Byte is a collection of Bits. In a 1-Bit color palate the image will be Black & White, as a bit stores either a 1 or a 0, it defines only 2 colors. An 8-Bit color palate uses 8 bits to define each and every pixel in the image, and with 8 bits can define 256 levels of gray or 256 distinct colors. As you can see, the greater the color palate, the larger the potential file size. Some raster file formats use different types of file compression to reduce the storage requirements somewhat. For example, some use RLE (Run Length Encoding) compression to compare the pixels on each side of the current pixel, if the color is identical, instead of storing an additional 24-bits of data for each consecutive pixel, it stores the first pixel data and then says “repeat X times”. Some file formats are “Lossy” while other file formats are “Lossless”. A “Lossy” file format means depending upon the quality setting you set when saving it will combine pixels that are CLOSE to the same color but not exactly the same color to achieve compression. The lower the quality setting, the less close the colors have to be before the file will make the output the same color. The table below gives you an indication of the different color palates available.

 

Color Palate Information

Palate Depth Maximum Color Count Good For Use On…
1-Bit Black / White Transparencies To Expose Photo Emulsion
8-Bit 256 Shades of Gray Web Graphics Source For Halftones
8-Bit 256 Color Web Graphics Animated Web Graphics Web Graphics With Transparent Background
24-Bit 16.7 Million Colors Digital Photography Web Graphics
32-Bit 4,2 Billion Colors Professional Digital Photography
48-Bit Ridiculous amount… Professional Digital Photography

 

Due to the fact that raster files are made up of nothing put independent pixels (or dots), editing raster images can be time consuming and difficult. After entering text into a raster image, the text become nothing more than pixels also, and changing the font, size or spelling is impossible. You would have to take an image eraser or paint brush, and paint over the existing text and then re-enter the text from scratch. Lines, circles, polygons and other graphic primitives operate the same. After drawing a line for example, it is impossible to edit the end point of that line and lengthen or shorten the line, or change it’s angle.

Raster image sizes are defined when created, and are defined as the length and height of the image and the resolution of the image. The resolution defines how many pixels make up an inch in the image. For reference, a PC monitor display is normally 72 Pixels per inch resolution. A “standard” laser printer is 300 pixels resolution.  When creating a raster image, it should be output at the resolution for the desired usage.  For example, if the graphic is designed to be used on a web graphic you would output to 72dpi resolution, if you were to print the graphic you would output to 300dpi (or greater).  The larger the image area, the larger the file size, as shown below:

Sample Graphic To Be Output

Image Dimensions Vector File Raster File
1″ x 2″ 23Kb 31Kb
2″ x 4″ 23Kb 73Kb
3″ x 6″ 23Kb 130Kb
4″ x 8″ 23Kb 203Kb

NOTE

Vector output file used was Adobe Illustrator AI file version 3.0 Raster output file used was a 300dpi JPG file using a 24-Bit color palate.

If a raster image is reduced to a smaller size or expanded to a larger size simply by stretching the image, loss of quality can/will result. If you have a raster image that is 100 pixels x 100 pixels in size, and enlarge it to 3-times it’s size, it doesn’t create an image of 300 pixels x 300 pixels, it is still 100 x 100 pixels but each pixel is now 3-times the size of the original. This is why when you start scaling raster images up you start seeing curves turning into “Stair-Steps”.

This helps explain why capturing screen images on a computer monitor and trying to use them as a source of graphics for sandcarving produces marginal results. Common screen resolutions are 1024×768 pixels, or 1280×1024 pixels, etc. If you take that image and try to print it on a laser / inkjet printer at 300dpi, you get an image somewhere between 3″x2″ to 4″x3″ (assuming your original image filled the entire screen). Trying to scale that graphic up to fit an 8″x 10″ or larger image makes your effective resolution 100dpi or less. The results are jagged and fuzzy lines and a poorly defined image as shown below:

Original artwork at 1″ high and 300dpi resolution, there are 300 rows of pixels in the graphic to define the image. Same artwork stretched to 4″ high.  Still using the same 300 rows of  pixels to define the image, the artwork now becomes grainy as each pixel is now 4-times as large as it was originally.
Raster File Formats
File Format Proprietary/Industry Standard Owning Application Color Palate Lossy/Lossless
BMP Proprietary Windows Paint 1, 8, 24 Lossless
CPT Proprietary Corel PhotoPaint 1, 8, 24, 32, 48 Lossless
GIF Industry Exchange Standard Graphics Interchange Format 1, 8 Lossless
JPG, JPEG, JP2 Industry Exchange Standard Joint Photographics Expert Group 8, 24, 32 Lossy
MAC Proprietary MacPaint 1 Lossless
PCD Proprietary Kodak PhotoCD 32 Lossless
PCX Proprietary PaintBrush 1, 8, 24
PNG Industry Exchange Standard Portable Network Graphic 1, 8, 24 Lossless
PSD Proprietary Adobe PhotoShop 1, 8, 24, 32, 48 Lossless
RAW Industry Exchange Standard Digital Camera Raw Image 32 Lossless
TIF, TIFF Industry Exchange Standard Tagged Image Format File 1, 8, 24, 32, 48 Lossless
TGA Proprietary Truevision TARGA 8, 24 Lossless

Vector Files

Vector File Description

Vector file formats started in the CAD domain and were used in manufacturing to design and manufacture parts in industry. The file format of a vector file is completely different than that of a raster file. If you look closely at a raster image of a line, it is made up of a series of pixels or dots. If the line is not perfectly horizontal or vertical, but at an angle, looking closely at the line you will see “stair steps” in the pixels defining the line. With a vector image, think of that line as being defined like a push-pin or thumbtack at the starting point and ending point of the line, and a rubber band stretched between the thumbtacks. No matter if the thumb tacks are in perfect horizontal or vertical alignment or if they are angled, the rubber band always stretches perfectly straight between them. To edit or change the length or angle of the line, if you move one thumb tack, the rubber band automatically stretches between the two thumb tacks and adjusts it’s length and/or angle to fit.

Original Design Detail of Raster Format Detail of Vector Format

A raster image of a 1″ diameter circle at 300dpi would contain 90,000 pixels. Depending upon the color palate the required storage to store that 1″ diameter circle could be 90,000 bits (11,250 bytes) with a 1-bit color palate to 2,160,000 bits (270,000 bytes) if using a 24-bit color palate. A 2″ diameter circle in a 300dpi image would require 360,000 bits using a 1-bit color palate and 8,640,000 bits using a 24-bit color palate. That same 1″ circle in a vector file format could be stored with 2 pieces of information, the X,Y location of the center-point of the circle (two Bytes) and the radius distance of the circle (another 2 Bytes). No matter what size the image is, it still would take only the same 2 pieces of information to define that circle in a vector file. There ARE some additional properties of the circle that can be defined and stored, such as line width, line color and line type (dashed, solid, dotted, dash-dot, etc…) but again, that information is stored once per entity and increase the storage requirements minimally. A line is defined as the X,Y starting point and the X,Y ending point. An arc can be defined with 3 points. As you can see below, the potential for file size savings is significant.

 

A 1″ x 1″ raster image at 100dpi resolution depicting a line. This graphic is made up of 10,000 pixels, and using a 24-bit color palate would require 240,000 bits (30,000 Bytes or 30Kb) to store all the pixels in this graphic. A 1″ x 1″ vector image with the same line requires the following information to save and display the image:Starting Point: X,Y  Coordinate (2 Bytes) Ending Point: X,Y Coordinate (2 Bytes) Entity Type: Line (1 Byte) Line Width: 2pt (1 Byte) Line Font: Solid (1 Byte) Line Color: RGB Value (24 Bits, or 3 Bytes)

With the emergence of the PC, illustration software has been developed to take advantage of the vector file format also. With a vector file, existing primitives (lines, circles, arcs, text, etc….) can be scaled, rotated, skewed and edited without having to redraw from scratch, saving time and money. Vector graphics can be scaled up or down infinitely without degrading the quality of the graphic. Additionally, vector file formats can drive a vinyl cutter to cut your sandblasting masks.

Vector File Formats

File Format Proprietary/Industry Standard Owning Application

See Note

AI Proprietary Adobe Illustrator, Creative Suite 1
CDR Proprietary Corel Drawing 1
CGM Industry Exchange Standard Computer Graphics Metafile
DWG Proprietary AutoCAD Drawing
DXF Industry Exchange Standard AutoCAD Drawing Exchange Format
EMF Industry Exchange Standard Enhanced Windows Metafile
EPS Industry Exchange Standard Encapsulated Postscript File 2
PS Industry Exchange Standard Postscript File 2
PDF Industry Exchange Standard Portable Document Format 3
SVG Industry Exchange Standard Scalable Vector Graphics
SVGZ Industry Exchange Standard Compressed Scalable Vector Graphics
WMF Industry Exchange Standard Windows Metafile

NOTES

  1. Primarily a vector illustration file format but can contain embedded raster images also.
  2. Printer file format can contain either raster, vector or both file types.
  3. Document exchange file format can contain either raster, vector or both file types.

 

Hybrid Files

Hybrid File Description

Certain software applications allow using both raster and vector information in the same drawing. Obviously their file formats would have to support both raster and vector also.  Illustration packages such as Adobe Illustrator, CorelDRAW and Inkscape are examples of these types of applications.  Although all three of these applications are primarily vector illustration tools and Adobe and Corel both provide full raster drawing/editing applications, they all allow for the import and use of raster images within the illustration.  Industry Neutral Exchange standard files also allow for storage of raster or vector. In many instances, only importing the file into your illustration program will allow you to determine if there is raster or vector information contained in the file.   

A third type of file which can contain either raster or vector data are printer files designed for a Postscript printer.  Postscript printers were first designed for high volume publishing applications. A Postscript printer has a small CPU imbedded in the printer which is used as a Raster Image Processor (RIP).  The RIP takes the page layout and determines which pixels in the page should be black and which pixels would be white to print that page.  By offloading the RIP processing from the computer to the printer directly with a RIP processor specifically designed for that purpose, the printer will print faster, and it reduces the CPU load on the PC, not bogging it down when you hit the PRINT button.  A Postscript file (PS) and an Encapsulated Postscript file (EPS) are basically the same file with one addition.  In early Desktop Publishing systems (DTP) illustrations or graphics could be added to a page of text by importing a postscript file into an area of the page.  At the time of printing, the postscript printer would take the information in the postscript image file and process it as well placing the graphic in the are designated for the image.  In order to assist publishers in formatting their pages, the EPS file format was developed.  In an EPS file, a low resolution TIFF raster image representation of the actual graphic is embedded (or encapsulated) in the file WITH the standard postscript data.  This low resolution TIFF image would display in the DTP software page layout to assist the publisher in the design of the page.  When the actual page was printed, the encapsulated TIFF image is ignored and the PS data is used to print the page.

 

File Format

Proprietary/Industry Exchange Standard Primary Use Internal File Data
AI Adobe Illustrator File Format (also defacto exchange standard) Storing Adobe Illustrator files and exchanging graphics with other applications that import AI files Primarily vector graphics but can contain raster.
CDR CorelDRAW File Format Storing CorelDRAW files and exhanging graphics with other applicatons that import CDR files Primarily vector graphics but can contain raster.
CGM Industry Exchange Standard Exchange of primarily vector graphics data Primarily vector graphics but can contain raster.
PDF Industry Standard Portable Document Format, exchange of page-formatted documents on the internet Can contain either raster or vector depending upon the source data
PS, EPS Industry Standard Postscript printer files, and exchange of graphics data Can contain either raster or vector depending upon the source data
SVG, SVGZ Industry Standard (also native file format for Inkscape) Exchange of primarily vector graphics data Primarily vector graphics but can contain raster.

File Format Conversions

Raster to Vector

There are many times you may need to convert a raster image into a vector image.  If the source graphic provided by the customer is a small representation and the item to be carved is large, and the image must be scaled up significantly it is better to scale a vector image than a raster image.  If you need to use cut vinyl or Hartco/Anchor masking, a vector file is required to drive the vinyl cutter.  

Raster images can be converted to vector in one of two methods, software driven auto-tracing and manual tracing/ redrawing.  Adobe Illustrator, CorelDRAW and Inkscape all provide an auto-trace function to automatically convert raster to vector images.  There is also an online vectorization service called VectorMagic. The size and quality of an auto-traced vector image is dependant upon a couple factors:

  • Resolution of the source raster image
  • Color palate of the source raster image
  • Settings and options of Auto-trace function

It should be noted that the output from an auto-trace will NEVER be as clean as as a vector file created from a manual redraw/trace, but in most instances they are work great and are MUCH faster to create.

Manual redraws are done by importing the raster image into your vector illustration tool of choice (Illustrator, CorelDRAW, Inkscape, etc) and manually drawing new vectors over the top of the raster image. After the vectors have been created, the raster image underneath can be deleted.

 

Vector to Raster

It is very seldom that you would need to convert a vector image to raster.  Transparencies for exposing wash-out resists can be printed from raster OR vector files, and cutting vinyl or Hartco/Anchor resist on a vinyl cutter can ONLY be accomplished with a vector file.  Periodically you may need to convert a vector (or hybrid) graphic to a raster representation to use in a web page or to e-mail a potential customer a copy of the illustration for review/approval.  In those instances, Adobe Illusrator, CorelDRAW and Inkscape all have Save-As or Export options where the application can save a copy of the vector image as a raster.

Popular Graphics Software Applications

Application Type of Application Commercial/Open-Source Platforms Supported
Adobe Illustrator Vector Commercial MAC O/S, Windows
Adobe PhotoShop Raster Commercial MAC O/S, Windows
CorelDRAW Vector Commercial Windows
Corel PhotoPaint Raster Commercial Windows
Debena Canvas Vector Commercial MAC O/S, Windows
Inkscape Vector Open Source MAC O/S, Windows, Linux
GIMP Raster Open Source MAC O/S, Windows, Linux

Copyright 2013 – Arizona Glass Classes

October 2017
S M T W T F S
« Aug    
1234567
891011121314
15161718192021
22232425262728
293031