Inkscape.org
Beyond the Basics Make DPI independent from export scale?
  1. #1
    Alex Ronke Alex Ronke @NoPunIn10Did
    *

    When exporting a PNG image, the DPI changes when one specifies a non-default export resolution for the given image.

    However, as the DPI ultimately only impacts image metadata, rather than the image itself, this should be made independent from the resolution of the export.  Some programs, like MS Word, do use that metadata to determine the default sizing of an image.

    For instance, say the coordinate system for my page is 600 by 600.  The default DPI is 96, but I want to export it at 300 DPI and be 2 inches on each side. I don't want to have to reformat my entire page and perform transforms to do so.

    Is there a way to do this that I'm missing somewhere?

  2. #2
    Tyler Durden Tyler Durden @TylerDurden
    *

    I'd probably reset the size in the export dialog:

    (image removed)

    Have a nice day.

    TD

  3. #3
    Alex Ronke Alex Ronke @NoPunIn10Did

    That doesn't actually work.  Notice that when you change your width and height, your x1 and y1 coordinates for the export range change.  You're experimenting with a solid-colored square, so the export is going to look the same.

  4. #4
    Tyler Durden Tyler Durden @TylerDurden
    *

    Right you are. Sorry for the noise.

     

    Have a nice day.

    TD

  5. #5
    Maren Hachmann Maren Hachmann @Moini

    You could create rectangles for the correct section of the drawing ('selection' tab) and use opacity to have them not show up in the exported image. Or there's the Guillotine extension. Here's one that allows you to enter a dpi value: https://inkscape.org/~Bootta/%E2%98%85guillotine-plus

    (not curated, not tested, use at own risk)

  6. #6
    Alex Ronke Alex Ronke @NoPunIn10Did
    *

    I’m not sure that actually solves the issue. What I’d like is to be able to take a single selection (like “Page”) and be able to export it to any resolution (preserving aspect ratio if needed), with a setting for DPI that doesn’t impact that resolution. 

    When an image is exported from Inkscape currently, it sets the “Pixels per Meter” metadata on the image based on the DPI selected in the export pane. However, that value should be able to be overridden somehow, since Inkscape currently uses “DPI” as a synonym for “coordinate:pixel ratio”, which isn’t actually the same thing at all.  

    Example: I have an image whose default dimensions are 1200x1200 pixels. Now let’s say I want to export multiple exact copies of that image, each at a 1200x1200 resolution, but I want the Pixels per Meter metadata to differ and correspond to 96 DPI, 300 DPI, and 400 DPI. In order to reliably do so, I need a separate metadata editor.

    Ultimately the coordinate system set up in Inkscape (or any SVG editor) should be arbitrary, and the DPI should not be required as a scaling ratio for image exports. I’m fine with it being available as a default guideline, but it should be changeable without altering the export resolution. 

  7. #7
    Maren Hachmann Maren Hachmann @Moini

    Feature requests need to go here: https://inkscape.org/report

  8. #8
    Alex Ronke Alex Ronke @NoPunIn10Did

    Thanks.  Feature request filed.

  9. #9
    Damo.B Damo.B @Damo.B

    This does not answer your question but it will help others to do what I've been googling for a while ( and end up here a lot)

    ...and that is to export at 300 dpi

    But I do not know what happens at the other end when sent to the printer. I use POD so have ordered samples and waiting their delivery.

    In photoshop you can do the following so it seems to me the same thing: File >  Export > Export for screens > Formats (right section),  in the Scale box type 4.17.

     

     

    Inkscape I do the following:


    Create document size as "pt" (file > Document Properties)

    1000 pt = 4.167 px
    so
    ‭0.2399808015358771‬ px = 1 pt
    ‭4.167‬ pt = 1 px

    Divide px required by ‭0.2399808015358771

    eg. I want 2875 x 3900 @ 300 dpi
    2875 px = 689.9448044156467pts
    3900 px=  935.9251259899207‬pts

    I create my document size as 689.94480 X 935.925125 pts

    It exports as 2875 x 3900 @ 300 dpi

  10. #10
    acal acal @acal

    I too want this. I needed to make a 300px W x 250px H graphic in 72dpi. THis forces a 96dpi resolution in the Export tool. What I could tell is that it outputs this in 32-bit color depth. I think the hack is to allow for 24-bit color depth which I can not figure out in InkScape. Illustrator just lets you choose with any new file. Much trickier in InkScape and I still am not sure how to change this.

  11. #11
    JLDoty JLDoty @JLDoty

    I agree completely with Alex.  The dpi spec should be independently specifiable.  Because of the non-intuitive way it's handled in Inkscape, I long ago abandoned all the scaling in Inkscape, and work exclusively with pixels for everything.  Then I export, ignoring the dpi specification altogether.  Then I import the image into Gimp, where it's trivial to specify dpi.  In the Gimp menu select Image>Scale Image..., and in the dialog box specify X and Y resolution, then click Scale. Then File>Export As..., and overwrite the original file.  It's a pain in the ass having to do that, but Gimp is far superior at manipulating images.

    BTW: you can independently specify different X and Y resolutions, and you can specify in px/in, px/mm, px/ft, and about 15 other choices.

  12. #12
    Xav Xav @Xav👹

    Note that v1.0 has an "Advanced" section in the Export PNG dialog which exposes a "pHYs dpi" field that may help, depending on whether or not the receiving software reads and uses it. In practice the only thing that matters for a raster image is the dimension in pixels - the dpi value makes no real sense because Inkscape doesn't know what the final output device is.

  13. #13
    Jean Amoni Jean Amoni @datalot
    @datalot | https://chat.inkscape.org/channel/inkscape_user?msg=ikNSsRfyh4LBfByar:


    Ok I'm figuring out that Inkscape has no ways to change document's PPI.

    @datalot | https://chat.inkscape.org/channel/inkscape_user?msg=KaxCMK7NnT5P8WWDE

     If you make a `10 cm` square in GIMP at `300 PPI` you will get a `~1181 px` square.

     Now, if you import that `1181 px` square to Inkscape, select it, and change units to cm you will notice that you square measures `31.25 cm` >  Inkscape ever calculates units at `96 PPI`.
     
     A workaround when working with physical units on Inkscape is going to the `Document Properties` dialog and in the `Scale` input set an > equivalent that can be obtained from the formula:

     `my_desired_ppi / 96`
     
     — In the case of a desired 300 PPI, the obtained resoult will be `3.25`.
     — If you select the square again, you will notice it measures `10 cm`, but you should avoid working with any kind of non-physical unit.
     — You need to set `my_desired_ppi` in the `PNG Export` dialog *OR* set the `Scale` to `1.000000` again. This will recover all your pixels again.

    @datalot | https://chat.inkscape.org/channel/inkscape_user?msg=iT3qmFvWGkFbANrP3

    The desired behavior is to have a `PPI` input in the `Document Properties` dialog which define the base of the Inkscape's units calculations.

    serp | https://chat.inkscape.org/channel/inkscape_user?msg=iT3qmFvWGkFbANrP3

    you can change the default dpi in Edit > Preferences > Imported Images

    (In response to serp) @datalot | https://chat.inkscape.org/channel/inkscape_user?msg=oup3JkTnQg8ryztj5

    This is not useful. If you want to create a 10 cm @ 300 PPI square in Inkscape, you need to make calcs or this workaround.

Inkscape Inkscape.org Inkscape Forum Beyond the Basics Make DPI independent from export scale?