From the course: Learning SVG
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Add an external image to an SVG - SVG Tutorial
From the course: Learning SVG
Add an external image to an SVG
- [Instructor] When you get to this point, you need to start thinking of SVGs as meta containers for graphics. We make a viewBox then draw graphics and text and images inside that viewBox. Yes, I said images. You see, web documents can display images and, since SVG is a web document, an SVG can display images as well, both other SVGs and bitmap images. To display an image inside an SVG, we use the image element. The image element has six main properties, x and y, which set the co-ordinates for the top left hand corner of the image, width and height, which set the width and height of the image inside the SVG relative to the SVG's viewBox, xlink:href which points at the url for the image file and preserveAspectRatio which allows us to control whether the image aspect ratio can be changed or not. In the exercise files for this movie, I've added an image to the SVG. That image sits in the project as a separate file and that file has a physical width of something like 700 and something…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
SVG shapes overview2m 31s
-
(Locked)
Draw a line2m 52s
-
(Locked)
Draw a rectangle4m 24s
-
(Locked)
Draw a circle1m 27s
-
(Locked)
Draw an ellipse1m 59s
-
(Locked)
Draw a polyline2m 44s
-
(Locked)
Draw a polygon2m 12s
-
(Locked)
Draw a path3m 59s
-
(Locked)
Add text to an SVG9m 4s
-
(Locked)
Convert text to outlines4m 42s
-
(Locked)
Add an external image to an SVG4m 4s
-
(Locked)
Rotate SVG shapes5m 18s
-
-
-
-