Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

HTML SVG Basics Introduction to SVG Vector Graphics

Samuel Rueby
Samuel Rueby
22,538 Points

SVG basics - Why photographs aren't saved as vector images.

Trying not to nit-pick here, but I don't think the reason cameras don't save photographs as vector images is due to space requirements, it's because it's incredibly difficult or impossible to save them as vector. Edge detection algorithms are good but they're not that good!

2 Answers

Maciej Sularz
Maciej Sularz
15,088 Points

It comes from a massive difference in the way those two standards are and how the camera operates.

Pictures taken using a camera are saved as a raster graphic - which simply put is a rectangular grid of pixels - the camera takes the image in the front of it and 'translates' it to such grid. Pictures like that, depending on their resolution and color mode are normally very heavy in terms of their size, that's because each of those pixels has to be saved separately in a file. For that example standard HD resolution (1920×1080 pixels) consists of 2,073,600 pixels.

In case of vector graphics to make up an image geometrical primitives are being used such as points, lines, curves, and shapes or polygons. Files like that are much smaller in size as opposed to the raster graphics files. That comes from the fact that to draw an HD size square shape only four points would be necessary (each corner) they would be connected by a line between each of them and saved as a mathematical expression in XML format. That means that only few lines of text would be enough to describe such shape as opposed to over 2 millions pixels in case of raster graphics. The advantage of such format is that in can be infinitely scaled and it will preserve exactly the same quality in each size. Where raster graphics will lose its quality.

A vector graphic normally consists of a set of shapes stacked on top of each other (simply put). Cameras can only reflect a flat image and save it as the mentioned grid of pixels.

I recommend reading a bit more about those standards on wikipedia:

http://en.wikipedia.org/wiki/Raster_graphics

http://en.wikipedia.org/wiki/Vector_graphics

Hope that helps...

Samuel Rueby
Samuel Rueby
22,538 Points

@Maciej your in-depth response is agreeing with me!