diff --git a/layouts/partials/picture.html b/layouts/partials/picture.html
index 207f5d07..98a10a47 100644
--- a/layouts/partials/picture.html
+++ b/layouts/partials/picture.html
@@ -40,13 +40,33 @@
type="image/webp"
/>
{{ end }}
+ {{ $width := ""}}
+ {{ $height := ""}}
+ {{ if eq .MediaType.SubType "svg" }}
+ {{ $svgContent := $resource.Content }}
+ {{ range (findRESubmatch `width=["']?(\d*)` $svgContent 1) }}
+ {{ $width = index . 1 }}
+ {{ end }}
+ {{ range (findRESubmatch `height=["']?(\d*)` $svgContent 1) }}
+ {{ $height = index . 1 }}
+ {{ end }}
+ {{ if (eq "" $width $height) }}
+ {{ range (findRESubmatch `viewBox=["']?(\d*) (\d*) (\d*) (\d*)` $svgContent 1) }}
+ {{ $width = index . 3 }}
+ {{ $height = index . 4 }}
+ {{ end }}
+ {{ end }}
+ {{ else }}
+ {{ $width = .Width }}
+ {{ $height = .Height }}
+ {{ end}}