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

sharp / libvips #155

Open
magicdawn opened this issue Mar 14, 2023 · 2 comments
Open

sharp / libvips #155

magicdawn opened this issue Mar 14, 2023 · 2 comments

Comments

@magicdawn
Copy link
Owner

No description provided.

@magicdawn
Copy link
Owner Author

sharp VipsJpeg: Corrupt JPEG data: extraneous bytes before marker 0xda

这种情况可以使用 imagemagick mogrify 移除损坏的数据
https://stackoverflow.com/questions/24805500/can-i-fix-photos-with-corrupt-jpeg-data

不用设置 comment, 直接 mogrify ./local.jpg 会覆盖掉 local.jpg


sharp 有个 failOn option, 取值 https://sharp.pixelplumbing.com/api-constructor

'none' | 'truncated' | 'error' | 'warning'

默认 warning, 表示 sharp 在 libvips 发出 warning 就会直接抛出异常
改成 failOn: error, 在 libvips 无法处理时才主动 abort.

@magicdawn
Copy link
Owner Author

magicdawn commented Mar 14, 2023

sharp 并发

解释

sharp.concurrency

  • 控制的是 libvips 使用 glib 管理的线程池大小, 默认 cpu-core-count
  • 表示的是使用多少个线程处理一张图片

UV_THREADPOOL_SIZE

关于 size 的讨论

说法1: > cpu core count, 会导致 context switching 影响性能
说法2: 没有 context switching, 只是 RAM 的开销

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

1 participant