Hi, I'm trying to set the SVG attribute 'preserveAspectRatio' in my Inkscape compressed file. I can edit the SVG file in NetBeans and then I can control the height and width of the SVG but NetBeans will not open a binary file nor could I edit it if it did. Anyone have any ideas on how I might enter preserveAspectRatio equals none in an SVGZ file created using Inkscape?
Thanks.
TC
Setting preserveAspectRatio=none in SVGZ file?
Re: Setting preserveAspectRatio=none in SVGZ file?
Do you need to add the attribute to <image> elements, or to the top-level <svg> node?
- For <image> elements, you could consider installing the extension from #1357808, open the SVGZ file in Inkscape, and adjust the 'preserveAspectRatio' attribute for all, or for selected images as needed (the extension will be included in the next stable release, it installs as 'Extensions > Images > Set Image Attributes...').
- For the top-level <svg> element, you can use Inkscape too, and manually add the attribute with Inkscape's built-in XML Editor (menu 'Edit > XML Editor').
- If you need to edit the SVGZ file externally (outside of Inkscape) - SVGZ are just gzip'ed SVG files ("gzip compressed data") ... you can rename it e.g. to *.svg.gz and gunzip it, or use whatever tools your OS/platform offers to handle gzip'ed files.
Re: Setting preserveAspectRatio=none in SVGZ file?
Thanks for the reply ~suv,
I saw the XML Editor in Inkscape but I saw no way to add the attribute "preserveAspectRatio". I'll look again. I'll also try to install and use the extension (#1357808).
Thanks much,
TC
I saw the XML Editor in Inkscape but I saw no way to add the attribute "preserveAspectRatio". I'll look again. I'll also try to install and use the extension (#1357808).
Thanks much,
TC
Re: Setting preserveAspectRatio=none in SVGZ file?
throwcode wrote:I saw the XML Editor in Inkscape but I saw no way to add the attribute "preserveAspectRatio".
Steps:
- open SVGZ file in Inkscape
- open menu 'Edit > XML Editor'
- select the <svg:svg ...> node at the top of the treeview on the left
- inspect the list of attributes already in use (upper right pane)
- if 'preserveAspectRatio' already exists, but has a different value:
- select the attribute in the list
- in the 'Attribute value' textbox at the bottom right, overwrite the existing value with 'none'
- click on 'Set'
- if 'preserveAspectRatio' does not yet exist:
- enter 'preserveAspectRatio' (without quotes) into 'Attribute name' text entry below the attribute list (see also tooltips)
- enter value 'none' (without quotes) into 'Attribute value' text box at the bottom right
- click on 'Set'
- Attachments
-
- xml-editor-add-attribute-with-value-1.png (45.2 KiB) Viewed 2108 times
Re: Setting preserveAspectRatio=none in SVGZ file?
Hi ~suv,
Thanks that worked for both SVG and SVGZ.
TC
Thanks that worked for both SVG and SVGZ.
TC