How to get image DPI?



  • I'm using ImageObject to load an image to drawBot, process it through some filters and then save it as a new image. Simple batch processing.

    Everything goes well when the images i input are 72dpi.
    If the input image is set to more than 72dpi then saved images is smaller (in absolute px value).

    I noticed there's an option to specify imageResolution for the saveImage() function so i'm assuming that i would need to match the dpi of the input and output image to keep the right size.

    But how can i get the input image dpi?


  • admin

    good question 🙂

    in drawBot there is not a api for this.

    I could consider imageResoltion(path) returning the dpi

    opening an issue: https://github.com/typemytype/drawbot/issues/215