lovell / lovell/sharp

TIFF output, bitdepth of 1 with LZW compression, should ignore predictor

Open
#3,486 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

blocked-upstream-dependency enhancement
Dominant language
JavaScript
Stars
32.7k
Forks
1.4k
Avg merge
1d 14h
Merged PRs (30d)
5

Description

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.
  • I am using the latest version of sharp as reported by npm view sharp dist-tags.latest.
What is the output of running npx envinfo --binaries --system --npmPackages=sharp --npmGlobalPackages=sharp?

System:
OS: Windows 10 10.0.22621
CPU: (6) x64 Intel(R) Core(TM) i5-8600K CPU @ 3.60GHz
Memory: 20.28 GB / 63.95 GB
Binaries:
Node: 19.2.0 - C:\Program Files\nodejs\node.EXE
npm: 9.1.3 - C:\Program Files\nodejs\npm.CMD

(tried also node 16.x and npm 8.x)

What are the steps to reproduce?
image.toColorspace('b-w').toFormat('tiff', { bitdepth: 1 }) // works, exports a 1-bit tiff file
image.toColorspace('b-w').toFormat('tiff', { bitdepth: 1, compression: 'lzw' }) // works, but exports a 24-bit file.
What is the expected behaviour?

the second row will export a 1-bit (or 2 or 4) bit TIFF file.

Thanks for all ! I like the package and it works good and fast.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the two image.toColorspace('b-w').toFormat('tiff', ...) examples from the issue and compare their output bit depth. Trace the TIFF conversion path used by sharp for bitdepth 1 with LZW compression, then verify that the resulting 1-, 2-, or 4-bit TIFF behavior matches the expected result.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs
Domain
computer-graphics
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.