resizeImage, pixel dimensions, resolution and size

Anyone, especially newbies, asking for help with Photoshop Scripting and Photoshop Automation - as opposed to those contributing to discussion about an aspect of Photoshop Scripting

Moderators: Tom, Kukurykus

mia

resizeImage, pixel dimensions, resolution and size

Post by mia »

Hi,

I programed a JS script to batch resize pictures to JPG. It's based on:
Code: Select allpicture.resizeImage(UnitValue(newWidth, exportUnit), UnitValue(newHeight, exportUnit), resolution, resamplemethod);
All my calculations of newWidth, newHeight are based on pixels (i mainly export for web), so exportUnit is usually px and resolution is usually 72.

However, recently, on some 'exotic' applications (including geek tool), i've noticed that the DPI/PPI value instead of the pixel dimensions is used. Consequently, the pictures are displayed very small because the PPI/DPI value was set very high (around 1500) during post-processing (explaining why would be too long here )

While debugging this in my script, i noticed that the script correctly sets the PPI value during resize, but for some reason it's not saved in the final picture. I suppose the final PPI saved in the JPG is not the one set during resizeImage, but recalculated by photoshop using pixel_dimensions / document_size - and document_size was not change during resize as i was working with pixels .

Is there any way to avoid this ? I need to be able to resize pictures based on width + height (in pixels) plus resolution (usually 72/92 dpi). I would prefer not to get into any inch/cm document size dimension calculations.

Thanks for your comments !
MiA