I am a an Inkscape novice, but I believe this must be a beginner question. I am running in to an issue when I export my drawings as optimized SVGs. I have a drawing of some rectangles and paths which should be the same width as the document, and start at X = 0 px. However, when I export the image and then open it again in Inkscape, the objects have shifted and resized! For example, instead of being 348 px wide, it will now be 348,612 and possibly X will no longer be 0. Some will be 347,360 wide. Why is this happening? It is driving me mad! I am working with pixels and my scaling is 1,000. Preferably I'd only work in full pixels anyway, is that possible?
I have also noticed that gradients don't display correctly.
Windows 10 64 bit. Inkscape 1.2.2 (732a01da63, 2022-12-09)
At Inkscape Preferences->Tools we have 2 settings for "Bounding box to use". The "Visual bounding box" will add stroke width to the size. So maybe this is what you´re experiencing.
Doesn't seem to be the case, this is the default option and I had it selected. When editing the image I can see that the stroke is contained within the document boundaries, it is only after saving and loading it that the paths and rectangles have shifted.
I didn't see the attach button when I posted. Here are the two images, all objects should start at X = 0 and be 348 pixels wide. However this is not the case in the one saved as optimized.
Pixel snap doesn't seem to work for me because: "TR: Selection contains transformations with skew/rotation"...
Thank you for the support. Actually, if you zoom in on the right edge of the canvas, you will notice that both of your SVGs have rectangles which don't go all the way to the edge (only the rectangles with a stroke). This is not the case in the Inkscape SVG that I uploaded. So it seems the issue is still present in the files attached, even without groups.
I also tried removing the groups from my original Inkscape SVG but the issue persists in this case too, and not only for the rectangles with a stroke. I wonder why it is different in my case?
Which script do you mean? I will edit the colors of the gradient so that it is more visible.
I tried using 5 significant digits and this indeed yields better (albeit not perfect, 347,995 px) results, regardless of grouping. I guess this is an inaccuracy I can live with, but I still don't understand why it differs. Thanks!
Hello,
I am a an Inkscape novice, but I believe this must be a beginner question. I am running in to an issue when I export my drawings as optimized SVGs. I have a drawing of some rectangles and paths which should be the same width as the document, and start at X = 0 px. However, when I export the image and then open it again in Inkscape, the objects have shifted and resized! For example, instead of being 348 px wide, it will now be 348,612 and possibly X will no longer be 0. Some will be 347,360 wide. Why is this happening? It is driving me mad! I am working with pixels and my scaling is 1,000. Preferably I'd only work in full pixels anyway, is that possible?
I have also noticed that gradients don't display correctly.
Windows 10 64 bit. Inkscape 1.2.2 (732a01da63, 2022-12-09)
At Inkscape Preferences->Tools we have 2 settings for "Bounding box to use". The "Visual bounding box" will add stroke width to the size. So maybe this is what you´re experiencing.
Doesn't seem to be the case, this is the default option and I had it selected. When editing the image I can see that the stroke is contained within the document boundaries, it is only after saving and loading it that the paths and rectangles have shifted.
Please attach (not embed via external link) an example Inkscape svg file (original) and the resulting optimized svg file.
Menu: Extensions>Modify Path>Pixel Snap may be of use for you.
I didn't see the attach button when I posted. Here are the two images, all objects should start at X = 0 and be 348 pixels wide. However this is not the case in the one saved as optimized.
Pixel snap doesn't seem to work for me because: "TR: Selection contains transformations with skew/rotation"...
Here are some revised files.
I un-grouped the groups which removes the transforms. Transforms on groups can make strokes wonky and bring changes when optimizing.
I presume there are useful reasons for the script and the imperceptible radial gradient, so I didn't mess with those.
Thank you for the support. Actually, if you zoom in on the right edge of the canvas, you will notice that both of your SVGs have rectangles which don't go all the way to the edge (only the rectangles with a stroke). This is not the case in the Inkscape SVG that I uploaded. So it seems the issue is still present in the files attached, even without groups.
I also tried removing the groups from my original Inkscape SVG but the issue persists in this case too, and not only for the rectangles with a stroke. I wonder why it is different in my case?
Which script do you mean? I will edit the colors of the gradient so that it is more visible.
I'd adjust the Number of significant digits for coordinates from 3 to 5 in the Optimised Output settings.
I tried using 5 significant digits and this indeed yields better (albeit not perfect, 347,995 px) results, regardless of grouping. I guess this is an inaccuracy I can live with, but I still don't understand why it differs. Thanks!
It's easier to understand if you recreate your design with filled rectangles only. (No strokes at all.)
From the look here you have transformed a grouped element - which I´d call a "bad habit":