question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

how to get metadata width and height after trim

See original GitHub issue

Is there a way to get width and height metadata after trim?

let transform = sharp()
    .trim()
    .metadata()
    .then(function(metadata) {
        console.log(metadata)
    })

return readableStream
            .pipe(transform)

This doesn’t seem to work

Thanks

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
lovellcommented, Oct 19, 2017

Thank you for even more context. In the above example, padding_width has a value of 0 when extend() is called on transformer3.

You’ll probably want to defer this assignment, something like:

const transformer3 = sharp()
  .background(background)

const transformer2 = sharp()
  .trim()
  .on('info', trimmed_metadata => {
    ...
    transformer3.extend({ ... })
  })
1reaction
jaekunchoicommented, Oct 19, 2017

thank you it works beautifully!

Read more comments on GitHub >

github_iconTop Results From Across the Web

can i get image file width and height from uri in android?
For folks having content uri (starting with content:// ), open an InputStream & decode that stream to avoid getting 0 width and height....
Read more >
Resize, crop and other common transformations
In the pad resize crop strategy, the output image's dimension (height and width) is the same as requested, no cropping takes place, and...
Read more >
Usage — Thumbor 7.2.0 documentation
-Ex-F means resize the image to be ExF of width per height size. The minus signs mean flip horizontally and vertically;; HALIGN is...
Read more >
Working with the ImageView | CodePath Android Cliffnotes
Fixing the width and height however means that the proportions of the width and height of the original image, known as the aspect...
Read more >
PART 4: SCALES AND SIZING · Fiji Basics
To find the calibration in the metadata, ensure Display Metadata is selected in the ... Under width enter the size you'd like the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found