Using the SVG pattern will solve your problem.
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"> <defs> <pattern id="image" x="0" y="0" patternUnits="userSpaceOnUse" height="200" width="200"> <image x="0" y="0" width="200" height="200" xlink:href="http://cdn.sstatic.net/stackexchange/img/logos/so/so-logo.png"/> </pattern> </defs> <rect width="200" height="200" fill="url(#image)"/> <circle cx="100" cy="100" r="50"/> </svg>
The script is available here .
I pulled the SVG higher through the batik's ratifier, and it was correctly rasterized.
Update
As noted in the comments, you can simply include the image directly in your SVG without using a template.
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"> <image x="0" y="0" width="200" height="200" xlink:href="http://cdn.sstatic.net/stackexchange/img/logos/so/so-logo.png"/> <circle cx="100" cy="100" r="50"/> </svg>
The script is available here .
Robby cornelissen
source share