1

I was creating a splashpage for an app I'm working on at work, using my personal laptop with Ubuntu (14.04) and Inkscape. We use a framework at work that requires precise dimensions, but I could not initially find those dimensions so I figured svg's would be ideal for me to keep my image in (as opposed to using GIMP.) I would export to a png with a specific size as I iteratively got closer to what I wanted.

I was using known working png's as a dimensional guide, and when viewed in MS Paint and Windows Photo Viewer, both the examples and my png looked exactly the same size and had the same properties, in both dimensions and DPI (as given by Paint).

However, when I opened my png with the app, my image would consistently pixelate and uglify, and be expanded some percentage (probably less than 10%) beyond the visible borders of the canvas.

After enough digging through the code, I found the specific dimensions (which one of my examples also had), defined in xaml, I think specifically denoted as

http://schemas.microsoft.com/winfx/2006/xaml

but I do not know much about xaml, except that it appears to be an xml.

I set my image to that specific size, but I still had the pixelation problem. Then I noticed that I was exporting at 90 DPI (dots per inch) but that Paint said I was at 96 DPI. I first tried adjusting my export DPI, but then my dimensions would grow larger. Sensing the problem was in the png metadata, I then tried to specify it on the command line with

inkscape image.svg -e image.png -d 96 -C -wXXX -hXXX

which should let me specify both width and height in pixels as well as the DPI. But that didn't work.

I finally managed a workaround by setting my SVG in a lower dimension that, when I expanded from 90 to 96 DPI on export, expanded the dimensions to that precisely required in the xaml.

My question is, was my workaround actually the right way to do this, is there some kind of bug in Inkscape that caused me to have to do this, is it that the metadata is somehow mispecified, or is it that the xaml is using (perhaps deprecated) metadata that the other applications in Windows ignored?

2

When Inkscape exports to bitmap formats it defaults to rasterising full size at 90dpi. As you ask Inkscape to increase the pixel dimensions of your export it will likewise increase the dpi setting.

If you want to export your svg at a specific pixel size you should scale your artwork to that size before exporting.

This isn't an Inkscape bug but appears to be a limitation if you're used to exporting from other illustration apps where you can specify both the dimensions and dpi.

Can't comment on the xaml parts of question but I think that when you're comfortable that Inkscape has a default 90dpi export resolution all of the other issues will fall away.

  • 1
    Yeah, it appears that pixels/image dimensions becomes locked to the DPI on export, which means you need to plan ahead with the sizing. But why did Paint and Picture Viewer not have a problem with it? – Aaron Hall Apr 23 '15 at 12:00
  • 1
    If you export a sample svg twice, one @ 90dpi and the other @ 180dpi, open them both in e.g. Gimp you'll see that the "Print Dimensions" are the same. I would guess that Paint is using these dimensions. There's more info in the 180dpi version but this can be expressed as "more resolution" for a certain dimensional size or a larger dimensional size at the same resolution. My answer assumes that from "Sensing the problem was in the png metadata..." onwards you're on the wrong track and over complicating the issue. [But I've been wrong before ;-)] – Matt Bracewell Apr 23 '15 at 12:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.