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

Enhancement: add pageHeight to response when generating multi-page output #3411

Closed
3 tasks done
ry0513 opened this issue Oct 18, 2022 · 3 comments
Closed
3 tasks done

Comments

@ry0513
Copy link

ry0513 commented Oct 18, 2022

Possible bug

Is this a possible bug in a feature of sharp, unrelated to installation?

  • Running npm install sharp completes without error.
  • Running node -e "require('sharp')" completes without error.

If you cannot confirm both of these, please open an installation issue instead.

Are you using the latest version of sharp?

  • I am using the latest version of sharp as reported by npm view sharp dist-tags.latest.

If you cannot confirm this, please upgrade to the latest version and try again before opening an issue.

If you are using another package which depends on a version of sharp that is not the latest, please open an issue against that package instead.

What is the output of running npx envinfo --binaries --system --npmPackages=sharp --npmGlobalPackages=sharp?

  System:
    OS: Windows 10 10.0.22000
    CPU: (8) x64 Intel(R) Core(TM) i7-9700K CPU @ 3.60GHz
    Memory: 7.28 GB / 15.87 GB
  Binaries:
    Node: 16.14.2 - C:\Program Files\nodejs\node.EXE
    npm: 8.5.0 - C:\Program Files\nodejs\npm.CMD
  npmPackages:
    sharp: ^0.31.1 => 0.31.1

What are the steps to reproduce?

see code example

What is the expected behaviour?

Please see the code example, can I get the height consistent

Please provide a minimal, standalone code sample, without other dependencies, that demonstrates this problem

const sharp = `require("sharp");`

sharp("./1.gif").toFile("./2.gif").then((info) => console.log(info));
// output:
// {
//     format: 'gif',
//     width: 550,
//     height: 400,
//     channels: 3,
//     premultiplied: false,
//     size: 14314
// }

sharp("./1.gif", { animated: true }).toFile("./3.gif").then((info) => console.log(info));
// output:
// {
//     format: 'gif',
//     width: 550,
//     height: 7200,
//     channels: 3,
//     premultiplied: false,
//     size: 562959
// }

Please provide sample image(s) that help explain this problem

1

@lovell
Copy link
Owner

lovell commented Oct 18, 2022

We should add pageHeight to the info response object when generating multi-page/animated output, to match the naming/behaviour of metadata(). I suspect also adding pages for the page count would be useful too.

https://sharp.pixelplumbing.com/api-input#metadata

@lovell lovell changed the title After GIF is turned on { animated: true }, the problem of getting the image height Enhancement: add pageHeight to response when generating multi-page output Oct 18, 2022
@ry0513
Copy link
Author

ry0513 commented Oct 19, 2022

Thank you, metadata() temporarily solved my problem, still looking forward to info.pageHeight, I wish you a happy day

lovell added a commit that referenced this issue Jun 17, 2024
@lovell lovell added this to the v0.33.5 milestone Jun 17, 2024
@lovell
Copy link
Owner

lovell commented Aug 16, 2024

v0.33.5 now available with pageHeight and pages properties.

@lovell lovell closed this as completed Aug 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants