1

The software Revit unfortunately only accepts PNG icons that have a resolution of 96. Now I make all my icons in Illustrator and export them using the 'Export for Screens' function. Unfortunately you can't choose a DPI when exporting, so I have to change the DPI for each individual icon by hand in Photoshop. which is a painful process since every time you change the resolution the dimensions also change, so you have to set them back each time.

enter image description here

I know resolution/DPI on images is nonsense, but I'm looking for a way to somehow automatize this. The idea is it that can be done for multiple images simultaneously. The only thing that needs to change for each image is the image resolution, so no change in dimension.

How can I achieve this?

  • PNG does not even have a DPI setting (so you cant set dpi but you can set pixels per meter). ;) – joojaa Apr 19 '18 at 15:01
  • Not sure about that, if I change the DPI on a PNG in Photoshop, save it and then import it again, the DPI stays the same. I believe this is stored somewhere in the metadata – Gerlof Leuhof Apr 19 '18 at 15:03
  • Obviously you can convert dpi to pixels per meter if you wish. Or you can use pixels per centimeter. However photoshop does not really use the pngs own tags to store this data. – joojaa Apr 19 '18 at 15:10
  • PNG ppi data it is in fact saved in the file. PNG can have pixels per inch. Here are two images, 1 has 150 ppi and the other has 300 ppi, you can see that in Phothosop > Image > Image size 150ppi: i.stack.imgur.com/xOJBH.png 300ppi: i.stack.imgur.com/B8kek.png If Photoshop does not use that data for something is another issue. – Rafael Apr 19 '18 at 17:25
  • @Rafael: I think that PNG does not have a tag or field for it in the standard. PNG does allow for custom fields which may not be understood by any reader(s). Photoshop for sure utilizes custom fields for its own purposes, sometimes duplicating standard ones. – Yorik Apr 19 '18 at 18:01
3

Imagemagic can do all of them in one go. Once installed you just go to the folder you want to change and type:

mogrify -units "PixelsPerInch" -density 96 *.png

All done. Note that since you can't set pixels per inch in a PNG this will always be a rounded value.

  • PNG can have pixels per inch. Here are two images, 1 has 150 ppi and the other has 300 ppi, you can see that in Phothosop > Image > Image size 150ppi: i.stack.imgur.com/xOJBH.png 300ppi: i.stack.imgur.com/B8kek.png – Rafael Apr 19 '18 at 17:23
  • This will probably work work, as it does not resample the image. Watch out though: (from docs) (1) it says If the standard supports it and (2) "Note that Photoshop stores and obtains image resolution from a proprietary embedded profile. If this profile is not stripped from the image, then Photoshop will continue to treat the image using its former resolution, ignoring the image resolution specified in the standard file header." ( imagemagick.org/script/command-line-options.php#density ) – Yorik Apr 19 '18 at 18:04
  • @Rafael no it does not. What Photoshop does is what YORIK comments uses a special tag. That is fine but its not in the standard. You can embed whatever you want in a tagged file, but taht does not mean its in the PNG. Its a bit like using a word form a different language and claiming its in your language. So photoshop supports DPI on PNG but its not a universal function and one should not rely on it. – joojaa Apr 19 '18 at 18:07
  • The standard is open so you can implement whatever you need and it still complies with the standard. Remember that Fireworks used a weird Frankenstein PNG format? It had layers, it had editable text... I asked Greg Roelofs about that file format and told me. "Yeap it is still a PNG file." Photoshop is not the only application that reads the PPI settings... I tested in different applications and they all read it. – Rafael Apr 19 '18 at 18:38
  • I am still testing on diferent aplications. 8 so far, each and every one reads the ppi settings... – Rafael Apr 19 '18 at 19:01
0

If you are a Windows user, IrfanView is a popular and simple image viewer that can make batch processes.

As always, a good recommendation is to make a copy of your files before you start.

  • File >Batch Conversion / Rename

  • Select your folder and the output folder

  • Select PNG as output format

  • And in advanced settings set the PPI value


Just a note. The correct term would be ppi, not dpi.

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.