Below is a detailed and realistic SVG code for a butterfly, inspired by a Monarch butterfly. I've aimed for realism by incorporating:
- Symmetrical wings: Using paths with Bezier curves to create smooth, natural shapes.
- Gradients and patterns: Radial and linear gradients for shading and color transitions on the wings to simulate light and texture.
- Veins and details: Thin paths for wing veins, spots, and edges to add intricacy.
- Body and antennae: Simple shapes with strokes for a 3D-like effect.
- Scalability: The SVG uses a viewBox, so it can be scaled without losing quality.
This SVG is self-contained and can be copied into an HTML file or viewed in a browser. I've kept it moderately complex to balance detail with simplicity, but for true photorealism, you might want to add more paths or use external tools like Adobe Illustrator.
SVG Code:
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 400 300" width="400" height="300">
<!-- Define gradients for realistic shading -->
<defs>
<radialGradient id="wingOrangeGradient" cx="50%" cy="50%" r="50%" fx="50%" fy="50%">
<stop offset="0%" stop-color="#FFA500" stop-opacity="1"/> <!-- Orange at center -->
<stop offset="70%" stop-color="#FF4500" stop-opacity="0.8"/> <!-- Darker orange -->
<stop offset="100%" stop-color="#8B4513" stop-opacity="0.5"/> <!-- Brownish edge -->
</radialGradient>
<linearGradient id="wingBlackGradient" x1="0%" y1="0%" x2="100%" y2="100%">
<stop offset="0%" stop-color="#000000" stop-opacity="0.8"/> <!-- Black veins/borders -->
<stop offset="100%" stop-color="#333333" stop-opacity="0.6"/>
</linearGradient>
<radialGradient id="bodyGradient" cx="50%" cy="50%" r="50%" fx="50%" fy="50%">
<stop offset="0%" stop-color="#696969" stop-opacity="1"/> <!-- Dark gray body -->
<stop offset="100%" stop-color="#A9A9A9" stop-opacity="0.7"/> <!-- Lighter highlight -->
</radialGradient>
</defs>
<!-- Group for the butterfly (for easier manipulation) -->
<g id="butterfly" transform="translate(200, 150)"> <!-- Center the butterfly in the viewBox -->
<!-- Body: Ellipse for thorax and abdomen with gradient for shading -->
<ellipse cx="0" cy="0" rx="5" ry="40" fill="url(#bodyGradient)" stroke="#000000" stroke-width="1" />
<!-- Head: Small circle on top of the body -->
<circle cx="0" cy="-38" r="5" fill="#696969" stroke="#000000" stroke-width="1" />
<!-- Antennae: Curved paths for realism -->
<path d="M-5,-40 Q-10,-50 -15,-40" fill="none" stroke="#000000" stroke-width="1" stroke-linecap="round" />
<path d="M5,-40 Q10,-50 15,-40" fill="none" stroke="#000000" stroke-width="1" stroke-linecap="round" />
<!-- Left Forewing: Detailed path with curves for shape -->
<path d="M-60,-20 C-100,-40 -120,20 -80,50 C-40,80 -20,40 -60,-20 Z"
fill="url(#wingOrangeGradient)"
stroke="url(#wingBlackGradient)"
stroke-width="2" />
<!-- Right Forewing: Mirrored for symmetry -->
<path d="M60,-20 C100,-40 120,20 80,50 C40,80 20,40 60,-20 Z"
fill="url(#wingOrangeGradient)"
stroke="url(#wingBlackGradient)"
stroke-width="2" />
<!-- Left Hindwing: Slightly lower and rounded -->
<path d="M-70,20 C-110,0 -130,60 -90,80 C-50,100 -30,60 -70,20 Z"
fill="url(#wingOrangeGradient)"
stroke="url(#wingBlackGradient)"
stroke-width="2" />
<!-- Right Hindwing: Mirrored -->
<path d="M70,20 C110,0 130,60 90,80 C50,100 30,60 70,20 Z"
fill="url(#wingOrangeGradient)"
stroke="url(#wingBlackGradient)"
stroke-width="2" />
<!-- Wing Veins: Add details with thin paths for realism -->
<g fill="none" stroke="#000000" stroke-width="1" stroke-opacity="0.7">
<!-- Left Forewing veins -->
<path d="M-70,-10 L-90,30" />
<path d="M-60,0 L-100,40" />
<path d="M-50,10 L-80,60" />
<!-- Right Forewing veins -->
<path d="M70,-10 L90,30" />
<path d="M60,0 L100,40" />
<path d="M50,10 L80,60" />
<!-- Left Hindwing veins -->
<path d="M-80,30 L-100,70" />
<path d="M-70,40 L-110,80" />
<!-- Right Hindwing veins -->
<path d="M80,30 L100,70" />
<path d="M70,40 L110,80" />
</g>
<!-- Spots on wings for added detail (e.g., Monarch's black spots) -->
<circle cx="-85" cy="10" r="5" fill="#000000" />
<circle cx="-95" cy="40" r="4" fill="#000000" />
<circle cx="85" cy="10" r="5" fill="#000000" />
<circle cx="95" cy="40" r="4" fill="#000000" />
<circle cx="-100" cy="70" r="6" fill="#000000" opacity="0.8" />
<circle cx="100" cy="70" r="6" fill="#000000" opacity="0.8" />
</g>
</svg>
How to Use This SVG:
- Copy and Paste: Save the code in a file with a
.svg extension (e.g., butterfly.svg) and open it in a web browser.
- Embed in HTML: Use it like this:
<embed src="butterfly.svg" type="image/svg+xml" /> or directly inline.
- Customization:
- Colors: Edit the gradients in the
<defs> section to change the butterfly's appearance (e.g., make it blue for a different species).
- Size: Adjust the
width and height attributes or scale via CSS.
- Details: Add more paths or circles for even finer details like finer veins or patterns.
- Why It's Realistic:
- Gradients create depth and shading, mimicking how light hits the wings.
- Symmetrical paths ensure the butterfly looks balanced.
- Veins and spots add texture, making it more than a simple shape.
If you'd like variations (e.g., a different butterfly species, animations, or more complexity), let me know!