cutcutcodec.core.io.read_svg.ContainerInputSVG
- class cutcutcodec.core.io.read_svg.ContainerInputSVG(filename: str | bytes | Path, *, unsafe=False)[source]
Decode an svg image to a matricial image of any dimension.
Attributes
- filenamepathlib.Path
The path to the physical file that contains the svg data (readonly).
Examples
>>> from cutcutcodec.core.io.read_svg import ContainerInputSVG >>> (stream,) = ContainerInputSVG.default().out_streams >>> stream.snapshot(0, (12, 12))[..., 3] tensor([[ 0, 0, 7, 110, 200, 244, 244, 200, 109, 7, 0, 0], [ 0, 27, 208, 255, 255, 255, 255, 255, 255, 207, 27, 0], [ 7, 208, 255, 255, 255, 255, 255, 255, 255, 255, 207, 7], [110, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 108], [201, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 199], [243, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 243], [243, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 241], [201, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 199], [109, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 108], [ 7, 207, 255, 255, 255, 255, 255, 255, 255, 255, 207, 6], [ 0, 27, 207, 255, 255, 255, 255, 255, 255, 207, 27, 0], [ 0, 0, 6, 108, 199, 243, 243, 198, 108, 6, 0, 0]], dtype=torch.uint8) >>>
Initialise and create the class.
Parameters
- filenamepathlike
Path to the file to be decoded.
- unsafebool
Transmitted to
cairosvg.svg2png.
Raises
- cutcutcodec.core.exceptions.DecodeError
If it fail to extract any multimedia stream from the provided file.
- property filename: Path
Return the path to the physical file that contains the svg data.