Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting image width/height #332

Closed
arronhunt opened this issue Aug 29, 2017 · 1 comment
Closed

Getting image width/height #332

arronhunt opened this issue Aug 29, 2017 · 1 comment

Comments

@arronhunt
Copy link

Hey guys,

Perhaps I skipped over this in the docs, but is there a way to capture the image's width and height? I'm trying to center text in the image and need the overall dimensions to calculate the positioning.

@kzonov
Copy link

kzonov commented Aug 29, 2017

I found for myself this way: image.bitmap.height
So f.e.:

Jimp.read(imagePath).then((image) => {
    image
    image.print(font, 10, 10, imageFirstWord, image.bitmap.height)
               .resize(Jimp.AUTO, 1920)
               .write(imagePath)
  }).catch((err) => {
    console.error(err)
  })

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants