Inkscape.org
Beginners' Questions Exporting to .png at 300 dpi
  1. #1
    tecnohall tecnohall @tecnohall

    Hello guys, I'm working with Inkscape 0.92.3 (2405546, 2018-03-11). When I send it to .png at 300 dpi, it theoretically does everything right, but when I see the file's property, it doesn't have 300 dpi , it has 299 dpi. In this way, the POD platforms that I work on do not accept, because the file needs to have 300 dpi. To solve this, I have to open the file in PhotoShop and put 300 dpi and export again, because even when I open the file in photoshop it shows 299 dpi. Has anyone had this problem and can help with the solution? I'm waiting.

  2. #2
    Freezr Freezr @freezr
    *

    I think this happens because it is rounded toward 300 dpi. Check this link out: https://gitlab.com/inkscape/inbox/issues/820

    Gimp and Inkscape apply a mathematical proportion hence you can't have an image for X pixel at 300 dpi if the proportion produce a different value, while probably others software apply some compensation in order to have integer resolution.

    For example I had a composition of 200 x 200 mm that in pixel is 755.906x755.906. As the svg standard output is 96 dpi my ratio will be: 755.906 px / 96 dpi = 7.874 in. Now if I want export at 200 x 200 at 300 DPI, it calculates that my pixel will increase up to 2362 x 2362 px and if I divide this size for my ratio the result is: 2362 px / 7.874 in = 299.9746 dpi, not 300 dpi.

    Now I want rounded my sizes at 756 dpi and my ratio will be 756 px / 96 dpi = 7.875 in. If I do a proportion 756 px : 96 dpi = X px : 300 dpi ; the result is X = 2362.5 px. And since one pixel is indivisible you can have this PNG at 299 or 301 dpi, that's why you havetoΒ  resize it through Photoshop, or Gimp, that will just modify the metadata not the real pixel. What the program you use is reading is probably the metadata rather than the actual resolution.

    Check this box, GIMP does not want allowing me to have a picture at 200 x 200 mm for 300 dpi, and you know that if I export from Inkscape at 2362x2362 px my resolution will be of 299,999 dpi. That is the reason why I think other software like Fotosciop adopt some pixel compensation rather than appling simple and pure math.

  3. #3
    brynn brynn @brynn

    Welcome to the forum!

    Hhmm, this is the first time I've heard this.Β  Unfortunately, I can't decipher that bug report (too technical for me).

    I wonder if you could use 301 for the dpi?Β  Maybe that would trick it into showing 300?

  4. #4
    tecnohall tecnohall @tecnohall

    Thanks for the attention. It really seems to be the problem, but as the POD platform requires 300 dpi, I had to resize it in photoshop.

    I had already tried 301, but it didn't work. Thanks for the personal help.

  5. #5
    Freezr Freezr @freezr
    *

    Actually the software I tested (Inkscape, Gimp & imagemagick) do not handle fractional pixel, it is likely probable that Fotosciop uses some compensation somewhere. I did a test and 200 x 200 mm (2362 x 2362 px) in Fotosciop keeps the size but GIMP reconverts it into 199.98 px @ 299,99.

    Inkscape uses imagemagick to export in PNG, I mean if all of those share the same underlying technology I see pretty hard having integer DPI resolution. You should ask to this system if they can fix their system in order to accept fractional dpi 299,999 is practically the same.

    And as you can see Fotsciop behaves almost the same:

    Whether you are using Fotosciop or GIMP you have to resample your image to fit the size you need at the resolution you need.

  6. #6
    kaiami kaiami @kaiami

    Were you able to figure out how to do this in Inkscape or are you having to use Photoshop to get the 300 dpi?