GNOME Bugzilla – Bug 329411
SVG Render Dialog Ignores Resolution
Last modified: 2017-12-13 17:26:42 UTC
Please describe the problem: If you import an SVG file, GIMP doesn't seem to rasterize using the correct resolution specified. No matter what resolution you specify, the layer will be generated with the proper dimensions, but the SVG image remains a fixed size regardless of the specified resolution. For instance, say you import an image at 90 ppi and it gets rasterized as 744x1052. Now if you import the image again into the same file, but this time specify 300 ppi, it gets rasterized at 2480x3507, but the actual image in the new layer is the same size as the previous import. Only the layer sizes are different. Steps to reproduce: 1. Open an SVG file several times. 2. Specify a different resolution for each import. 3. Notice the rasterized images are all identical in dimension despite the different resolutions. Actual results: Expected results: Does this happen every time? Yes. Other information:
Please make available an example SVG file (if possible attach a small one to this bug report). And please let us know what version of librsvg you are using since the error is most likely in librsvg. And please specify the operating system. Or did you check that this happens on "All" operating systems?
Hm, both pixels size and resolution are correctly transferred to the resulting image on my system. Neither of them influences the other setting, maybe there is some misunderstanding here?
Created attachment 58515 [details] Sample svg file.
Created attachment 58516 [details] Result of star.svg being rasterized at 400ppi.
Created attachment 58517 [details] Result of star.svg being rasterized at 72ppi.
The problem doesn't seem specific to any particular svg file, although I've attached the sample star.svg. I then created a new 400ppi canvas in the GIMP. Star-400.jpg is the result of importing star.svg onto this canvas at 400ppi. Star-72.jpg is the similar result at 72ppi. Notice the images are basically identical, when the 400ppi should be noticably larger. My OS is Fedora Core 4. I'm using librsvg2 2.9.5-2. If width/height and resolution do not effect each other, then what should the effect of resolution be? No matter what resolution I specify, the result is the same.
Well, both influence the result. Let's think about some examples (assuming square images to keep it simple): - image size: 300 px - resolution: 300 ppi => 300 px image with a physical (e.g. printed) size of one inch - image size: 300 px - resolution: 600 ppi => 300 px image with a physical size of half an inch - image size: 2 inch - resolution: 300 ppi => 600 px image with a physical size of 2 inch
If the SVG specifies a pixel size, changing the resolution does of course not have any effect. For that reason the dialog offers the possibility to scale the SVG. If the SVG specifies its size in physical dimensions, then the resolution is what determines the resulting image size. This definitely used to work correctly but it appears to be broken now. Since we didn't change the SVG plug-in, the problem appears to be in librsvg. Someone will have to find an old version that works and reassign this bug-report to librsvg.
confirming on the basis of comment #8.
I have added some debug output to the SVG plug-in and I can definitely tell that the problem is somewhere in librsvg. The plug-in uses rsvg_handle_set_size_callback() to determine the size of the SVG. This used to work, but with 2.16.1 (and perhaps earlier versions), the callback is never called. Without the callback being called, the plug-in can't do its job properly.
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/librsvg/issues/4.