My First Handmade SVG Image: A Person Icon With A Transparent Background...
An SVG file is just a text file that describes how to draw whatever it it that you want to draw. In this case, a circle and a closed rounded path (arc). I wanted my person to be just an outline, so, fill is set to none. The stroke value controls the color of the lines and the thickness of the lines is controlled with the stroke-width value. I have the line width somewhat heavy because I intend to scale the image down to 32x32. Within the bounds of my SVG file, all of the measurements assume an image size of 512x512 -- that's the viewbox setting, but, when I display the SVG on this page, I set the width and height to 200x200. Feel free to use this as you see fit.
The circle is centered at 256x130 and its radius is 100. The path starts at the lower left corner at (M) 30x492, the arc (A) goes from (M) and passes through a point in the middle of my drawing box at 256x350 and continues on to a point on the opposite side (lower right) at 482x492. The drawing box is 512x512, but, because my lines are thick, I moved the starting and ending points away from the edges a bit. The (Z) at the end indicates that the two end points should be connected by a straight line. If you want an open body, just remove the (Z). In the arc (A) section, 0 0 1, influence the shape of the arc -- lopsided, flat, inverted, etc... I didn't need anything fancy, so I left it at 0 0 1. I wanted the ends of the arc to be rounded rather than pointy, so, I added stroke-linecap:round; and stroke-linejoin:round; to the inline style.<svg width="200" height="200" xmlns="http://www.w3.org/2000/svg" viewbox="0 0 512 512"> <circle cx="256" cy="130" r="100" style="fill:none;stroke-width:40px;stroke:black;"><circle /> <path d="M 30 492 A 256 350 0 0 1 482 492 Z" style="fill:none;stroke-width:40px;stroke-linecap:round;stroke-linejoin:round;stroke:black;"></path> </svg>
Copy and paste the code above either as raw HTML in your posts (must be in HTML view rather than Compose view) or copy and paste to a plain text file and change the extension to SVG. Then, you can use it as you would any other image. Not all photo editors can view or edit SVG files directly. Use at your own discretion.
Note that I've closed the circle and path with explicit closing tags. That's not strictly necessary as long as the tag itself is closed and there are no child elements within either, but, the Blogger editor insisted that I do it that way or it would threaten to mangle my code. Also, although the SVG image displays in a browser, the Blogger editor doesn't display the image in Compose mode -- you'll need to use Preview to see the rendered SVG.
Comments
Post a Comment
Note: Anonymous posts are allowed, but, all comments are subject to moderation by the content manager. Comments may be rejected, edited or deleted at the sole discretion of the content manager.