You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by Brigette Muller <br...@coxtarget.com> on 2001/07/16 17:30:11 UTC
Using URL rather than embedded PNG from SVGGraphics2D
Hi all,
Does anyone have an example of some code to create an SVG
document with an image referenced by a URL, rather than an embedded png?
I know the SVG fragment needs to look something like this:
<image x="0" y="0" width="570"
xlink:href="http://www.myimagelink.ishere..."
style="text-rendering:geometricPrecision;
shape-rendering:geometricPrecision;" height="216"/>
I am currently using the SVGGraphics2D, and reading the image into a
buffered image, and then using the draw() to draw the image out. This
creates the huge embedded png as so:
<image x="0" y="0" width="570"
xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKMAAADMCAYAAA
AfzhMPAAAgAElEQVR42tS9B5wl
Z3Uneqrq5s65J0ozoxlJo1FOCEkoEgQCG4yNgbUXh3V6bwEDxsJhLfwWv8W7+2Pt
XT8b+5m1CV7M2rDgJYkgkFDOGmlGo8mhp6d7Ot6cquqdc7766n63bsXuxv69md/9
dfcNdavqO9+J//M/2uLisq1pGtCD/tFPXdf5d9u2wfmVf1ffp/5Tn1OPo/6jz9PD
siz3d3oA6Mrv4PMdFn/G/zXgc1Wfo79TqZR7DfRTnrt8zu+fem78rZbVc67y++V7
.........
What I would like to do is on writing the image to the SVG, include the
URL as above, not the embedded png. Any suggestions where to look?
tia
Brigette
Using URL rather than embedded PNG from SVGGraphics2D
Posted by Thomas E Deweese <th...@kodak.com>.
>>>>> "BM" == Brigette Muller <br...@coxtarget.com> writes:
BM> Hi all,
BM> Does anyone have an example of some code to create an SVG
BM> document with an image referenced by a URL, rather than an
BM> embedded png?
[...]
BM> What I would like to do is on writing the image to the SVG,
BM> include the URL as above, not the embedded png. Any suggestions
BM> where to look? tia Brigette
You want to replace the default ImageHandlerBase64Encoder with
either ImageHandlerPNGEncoder or ImageHandlerJPEGEncoder. This can be
done most simply in the constructor for SVGGraphics2D:
public SVGGraphics2D(Document domFactory,
ImageHandler imageHandler,
ExtensionHandler extensionHandler,
boolean textAsShapes)
The interface and construction of the ImageHandlers is fairly
straight forward.
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org