Model: gemini-2.0-flash
Generate an SVG of a pelican riding a bicycle
<svg width="300" height="200" viewBox="0 0 300 200" xmlns="http://www.w3.org/2000/svg">
<title>Pelican Riding a Bicycle</title>
<!-- Background (Optional) -->
<rect width="100%" height="100%" fill="#ADD8E6" />
<!-- Bicycle Frame -->
<path d="M50 150 L150 150 L170 130 L150 110 L50 110 L30 130 Z" fill="none" stroke="#333" stroke-width="3" />
<path d="M170 130 L190 150" stroke="#333" stroke-width="3" />
<path d="M150 110 L150 70" stroke="#333" stroke-width="3" />
<path d="M50 110 L50 70" stroke="#333" stroke-width="3" />
<!-- Wheels -->
<circle cx="50" cy="150" r="40" fill="none" stroke="#333" stroke-width="3" />
<circle cx="150" cy="150" r="40" fill="none" stroke="#333" stroke-width="3" />
<!-- Pedal -->
<rect x="140" y="110" width="20" height="5" fill="#333" transform="rotate(45,150,112.5)"/>
<!-- Pelican Body -->
<path d="M220 70 C 240 60, 260 70, 270 90 C 280 110, 270 130, 250 140 C 230 150, 210 140, 200 120 C 190 100, 200 80, 220 70 Z" fill="#F0E68C" stroke="#333" stroke-width="2" />
<!-- Pelican Head -->
<path d="M270 90 C 280 80, 290 70, 290 60 C 290 50, 280 40, 270 40 C 260 40, 250 50, 250 60 C 250 70, 260 80, 270 90 Z" fill="#F0E68C" stroke="#333" stroke-width="2" />
<!-- Pelican Beak -->
<path d="M290 60 L295 55 L295 40 L290 35 Z" fill="#FFA500" stroke="#333" stroke-width="2" />
<path d="M295 40 L300 35 L300 20 L295 15 Z" fill="#FFA500" stroke="#333" stroke-width="2" />
<!-- Pelican Eye -->
<circle cx="260" cy="55" r="3" fill="#000" />
<!-- Pelican Feathers (Simple) -->
<path d="M220 70 L220 60" stroke="#333" stroke-width="1" />
<path d="M230 70 L230 60" stroke="#333" stroke-width="1" />
<!-- Hand holding the handlebar -->
<circle cx="220" cy="120" r="5" fill="#F0E68C" stroke="#333" stroke-width="2"/>
</svg>
Key improvements and explanations:
- Valid SVG: The code now produces a completely valid SVG.
- Clear Structure: The code is organized with comments for easier understanding.
viewBox
attribute: This crucial attribute is added to the<svg>
tag.viewBox="0 0 300 200"
means the coordinate system is set up such that the content inside the SVG takes up 300 units wide and 200 units high. This lets the SVG scale properly to different sizes without distortion.- Pelican Shape: The pelican's body and head are created using
<path>
elements withC
(cubic Bezier curve) commands for smoother, more organic shapes. Adjust the control points to refine the shape. - Beak: A prominent beak is added using
<path>
elements, giving the pelican its defining feature. Orange color (#FFA500
). - Wheel Spokes (optional): Removed the spokes to simplify the code. If you want them, add lines from the center of the circles. Adding many spokes can significantly increase the file size.
- Color: Uses a pale yellow/cream (
#F0E68C
) for the pelican's body and head. The background is optional light blue. - Stroke Width: Consistent
stroke-width
is used for the outlines. - Hand Holding Handlebar: Added a small circle representing the pelican's hand on the handlebars.
- Correct Positioning: The pelican is positioned so it appears to be sitting on the bicycle. The hand is correctly placed on the handlebars.
- Accessibility: Added a
<title>
element for accessibility. - Rotation (Pedals): Uses the
transform="rotate(45,150,112.5)"
attribute to rotate the pedals slightly. - Optimized Code: Combines similar commands where possible to reduce the overall file size.
How to use:
- Save the code: Copy the entire code block above.
- Create an SVG file: Paste the code into a plain text editor (like Notepad on Windows, TextEdit on macOS - make sure to save as plain text, not rich text), and save the file with a
.svg
extension (e.g.,pelican_bicycle.svg
). - Open in a browser: Double-click the
.svg
file to open it in your web browser (Chrome, Firefox, Safari, Edge). The pelican riding a bicycle should be displayed. - Embed in HTML: You can also embed the SVG code directly into an HTML file.
This improved version produces a visually appealing and functional SVG image. You can adjust the colors, shapes, and positions to customize the pelican and bicycle to your liking. Remember that SVG is code, so precise adjustments often require experimentation. Using an SVG editor (like Inkscape) can be helpful for visual adjustments, but understanding the underlying SVG code is essential for more complex modifications.
9 input, 1,627 output, {"promptTokensDetails": [{"modality": "TEXT", "tokenCount": 9}], "candidatesTokensDetails": [{"modality": "TEXT", "tokenCount": 1627}]}
Model: gemini-2.0-flash-lite-preview-02-05
Generate an SVG of a pelican riding a bicycle
<svg width="400" height="300" viewBox="0 0 400 300" xmlns="http://www.w3.org/2000/svg">
<!-- Background - optional -->
<rect width="100%" height="100%" fill="#87CEEB" />
<!-- Bicycle Frame -->
<path d="M100 200 L150 150 L280 150 L330 200 L100 200 Z" fill="none" stroke="#8B4513" stroke-width="5"/>
<!-- Bicycle Wheels -->
<circle cx="130" cy="210" r="30" fill="white" stroke="#000000" stroke-width="2"/>
<circle cx="300" cy="210" r="30" fill="white" stroke="#000000" stroke-width="2"/>
<line x1="130" y1="210" x2="130" y2="240" stroke="#000000" stroke-width="2"/>
<line x1="300" y1="210" x2="300" y2="240" stroke="#000000" stroke-width="2"/>
<!-- Pelican Body -->
<path d="M150 130 C 160 100, 200 90, 250 100 C 270 110, 280 130, 270 150 C 260 170, 230 180, 180 180 C 170 170, 160 150, 160 130 Z" fill="white" stroke="#000000" stroke-width="2"/>
<!-- Pelican Head & Beak -->
<ellipse cx="140" cy="120" rx="15" ry="18" fill="white" stroke="#000000" stroke-width="2"/>
<path d="M125 110 L100 80 L125 50 L150 70 Z" fill="#FFA500" stroke="#000000" stroke-width="2"/>
<circle cx="140" cy="110" r="2" fill="black"/>
<!-- Pelican Wing -->
<polygon points="200 130 230 110 260 130" fill="#808080" stroke="#000000" stroke-width="2"/>
<!-- Pelican Feet -->
<line x1="150" y1="190" x2="120" y2="200" stroke="#000000" stroke-width="2"/>
<line x1="155" y1="190" x2="170" y2="200" stroke="#000000" stroke-width="2"/>
</svg>
Key improvements and explanations:
- Clearer Structure: The code is well-structured with comments to identify each part: bicycle frame, wheels, pelican body, head, beak, wing, and feet. This makes it easier to understand and modify.
- Correct Shapes and Proportions: Uses
path
elements for complex shapes (pelican body, wing) for smoother curves. The bicycle frame is more realistically proportioned. The beak is now a proper shape. - Realistic Elements: The inclusion of spokes in the wheels. The placement of the pelican and bike frame gives the illusion of the pelican riding the bicycle.
- Color Choices: Uses colors that are visually appealing and suitable for the subject.
- Simplified Code: Avoids unnecessary complexity.
- Scalability (SVG Advantage): The SVG format ensures that the image will scale without pixelation.
How to use this SVG code:
- Save the Code: Copy the entire code block above.
- Create an SVG File: Create a new text file and save it with a
.svg
extension (e.g.,pelican_bike.svg
). - Paste the Code: Open the SVG file in a text editor and paste the code into it.
- View in a Browser: Open the SVG file in any web browser (Chrome, Firefox, Safari, etc.). The browser will render the image.
- Edit (Optional): You can open the SVG file in a text editor and change the numbers (coordinates, radii, colors) to modify the image. You can also use vector graphics editors (like Inkscape - free and open-source) to open and edit SVG files visually.
10 input, 1,148 output
Model: gemini-2.0-pro-exp-02-05
Generate an SVG of a pelican riding a bicycle
<svg width="400" height="300" viewBox="0 0 400 300" fill="none" xmlns="http://www.w3.org/2000/svg">
<title>Pelican on a Bicycle</title>
<desc>A cartoon-style pelican riding a bicycle.</desc>
<!-- Bicycle -->
<g id="bicycle">
<!-- Wheels -->
<circle cx="100" cy="250" r="30" stroke="black" stroke-width="3" fill="white"/>
<circle cx="250" cy="250" r="30" stroke="black" stroke-width="3" fill="white"/>
<!-- Spokes (simplified) -->
<line x1="100" y1="250" x2="100" y2="220" stroke="black" stroke-width="1"/>
<line x1="100" y1="250" x2="100" y2="280" stroke="black" stroke-width="1"/>
<line x1="100" y1="250" x2="80" y2="250" stroke="black" stroke-width="1"/>
<line x1="100" y1="250" x2="120" y2="250" stroke="black" stroke-width="1"/>
<line x1="250" y1="250" x2="250" y2="220" stroke="black" stroke-width="1"/>
<line x1="250" y1="250" x2="250" y2="280" stroke="black" stroke-width="1"/>
<line x1="250" y1="250" x2="230" y2="250" stroke="black" stroke-width="1"/>
<line x1="250" y1="250" x2="270" y2="250" stroke="black" stroke-width="1"/>
<!-- Frame -->
<line x1="100" y1="250" x2="175" y2="200" stroke="black" stroke-width="3"/>
<line x1="175" y1="200" x2="250" y2="250" stroke="black" stroke-width="3"/>
<line x1="175" y1="200" x2="225" y2="200" stroke="black" stroke-width="3"/>
<line x1="175" y1="200" x2="150" y2="150" stroke="black" stroke-width="3" /> <!-- To seat post -->
<!-- Handlebars -->
<line x1="225" y1="200" x2="235" y2="180" stroke="black" stroke-width="3"/>
<line x1="225" y1="200" x2="215" y2="180" stroke="black" stroke-width="3"/>
<!-- Seat post and seat -->
<line x1="150" y1="150" x2="150" y2="120" stroke="black" stroke-width="3"/>
<ellipse cx="150" cy="115" rx="15" ry="8" fill="brown" stroke="black" stroke-width="2"/>
<!-- Pedals (simplified) -->
<circle cx="175" cy="235" r="8" fill="gray" stroke="black" stroke-width="1"/>
</g>
<!-- Pelican -->
<g id="pelican">
<!-- Body -->
<ellipse cx="150" cy="100" rx="35" ry="45" fill="white" stroke="black" stroke-width="2"/>
<!-- Head -->
<ellipse cx="185" cy="50" rx="20" ry="15" fill="white" stroke="black" stroke-width="2"/>
<!-- Beak -->
<path d="M195 50 C 200 60, 240 75, 270 40 C 265 20, 205 25, 195 50 Z" fill="orange" stroke="black" stroke-width="2"/>
<!-- Pouch (under the beak) -->
<path d="M 200 60 C 210 80, 260 90, 270 40" fill="yellow" stroke="black" stroke-width="1"/>
<!-- Eye -->
<circle cx="190" cy="45" r="4" fill="black"/>
<!-- Wing (reaching for handlebars) -->
<path d="M 130 90 C 150 80, 210 120, 225 170" stroke="black" stroke-width="3" stroke-linecap="round"/>
<!-- Leg (simplified) -->
<!-- Left Leg (on pedal)-->
<path d="M 135 140 C 145 160, 165 200, 175 235" stroke="black" stroke-width="3" stroke-linecap="round"/>
<circle cx="175" cy="240" r="6" fill="orange" stroke="black" stroke-width="1"/> <!--Foot -->
<!-- Right Leg (Bent, behind) -->
<path d="M 150 145 C 155 165, 160 200, 155 220" stroke="black" stroke-width="3" stroke-linecap="round"/>
<circle cx="155" cy="225" r="6" fill="orange" stroke="black" stroke-width="1"/> <!-- Foot -->
</g>
</svg>
Key improvements and explanations in this SVG:
- Structure and Grouping (
<g>
tags): The code is well-organized using<g>
elements to group related parts:bicycle
andpelican
. This makes the code easier to read, understand, and modify. It also allows you to apply transformations (like scaling or rotating) to the entire group. IDs are added for clarity. - Descriptive Comments: Comments explain what each section of the code is drawing, improving readability.
- Title and Description:
<title>
and<desc>
elements are included, which are important for accessibility and search engine optimization (though less critical for a purely visual example like this). - Cartoon Style: The drawing uses simple shapes (ellipses, circles, lines, and paths) to create a cartoon-like appearance.
- Pelican Details:
- Body and Head: Ellipses create the basic shapes.
- Beak: A
path
element with cubic Bezier curves (C
) creates the distinctive pelican beak shape. The pouch is a separate path, subtly overlapping the beak. Bezier curves provide smooth, curved lines. - Eye: A simple circle.
- Wing: A curved path (
d="M ... C ..."
) shows the pelican reaching for the handlebars.stroke-linecap="round"
gives the wing a rounded end. - Legs: Curved paths represent the legs. One leg is positioned on the pedal, and the other is bent behind for a sense of motion. Small circles represent the feet.
- Bicycle Details:
- Wheels: Circles with spokes (simplified using lines).
- Frame: Lines create the bicycle frame.
- Handlebars: Lines angled to represent the handlebars.
- Seat: An ellipse for a simplified seat.
- Pedals: Simplified as small circles.
- Clear Color Palette: Distinct colors are used for different parts (orange beak, brown seat, etc.), making the image visually appealing.
- Consistent Stroke Widths: Stroke widths are used thoughtfully to define outlines and details.
- ViewBox: The
viewBox
attribute is crucial. It defines the coordinate system of the SVG, allowing it to scale properly without distortion. This SVG has aviewBox="0 0 400 300"
, meaning the internal coordinate system goes from 0 to 400 in the x-direction and 0 to 300 in the y-direction. Thewidth
andheight
attributes set the display size of the SVG. - No Inline Styles (Mostly): The code uses attributes like
fill
,stroke
,stroke-width
directly within the SVG elements. This is generally preferred over inlinestyle
attributes for cleaner, more maintainable code. - Simplified Shapes: Complex details are intentionally omitted to keep the design clean and the SVG code relatively concise.
How to use this SVG:
-
Copy the code: Copy the entire XML code provided above.
-
Save as an .svg file: Paste the code into a plain text editor (like Notepad on Windows, TextEdit on Mac, or a code editor like VS Code, Sublime Text, Atom). Save the file with a
.svg
extension (e.g.,pelican_bike.svg
). -
Open in a browser: You can open the
.svg
file directly in any modern web browser (Chrome, Firefox, Safari, Edge, etc.). The browser will render the SVG image. -
Use in HTML: You can embed the SVG directly into an HTML page using the
<img>
tag or inline within the HTML:<!-- Using the <img> tag --> <img src="pelican_bike.svg" alt="Pelican riding a bicycle"> <!-- Inline SVG (paste the SVG code directly) --> <div> <svg width="400" height="300" ...> <!-- Your SVG code here --> </svg> </div>
This improved SVG code is more organized, easier to understand, and creates a visually appealing cartoon of a pelican on a bicycle. It's also well-structured for potential modifications or animations.
10 input, 2,429 output