HOWTO set Photometric Interpretation to min-is-white
I am using this piece of code
await sharp(./${file}.tif)
.toColourspace('b-w')
.tiff({ compression: 'ccittfax4', xres: size, yres: size, bitdepth: 1 })
.toFile(output_${dpi}.tif)
but I am getting Photometric Interpretation: min-is-black and I need it to be min-is-white
Any suggestion on how I can achieve the min-is-white?
Another term for this is Quantum Polarity. I too am interested in figuring out how to set this using this library.
In ImageMagick we can just do convert source.tif -define tiff:quantum:polarity=min-is-white dest.tif but that requires a dependency that I'd rather not have to install on server instances.
To support this we'll need to expose libvips' miniswhite setting as a property on tiff()
https://sharp.pixelplumbing.com/api-output#tiff
https://www.libvips.org/API/current/VipsForeignSave.html#vips-tiffsave
Happy to accept a PR, if you're able.
To support this we'll need to expose libvips'
miniswhitesetting as a property ontiff()https://sharp.pixelplumbing.com/api-output#tiff
https://www.libvips.org/API/current/VipsForeignSave.html#vips-tiffsave
Happy to accept a PR, if you're able.
Hey @lovell, I haven't worked on a project like this before, where should I be able find guidance so I can work on the PR? Tx.
@geabenitez Thank you for offering to take a look. Perhaps you could adopt a code path like that used with the existing pyramid boolean option of tiff(), as I would imagine adding miniswhite will be very similar.
https://github.com/lovell/sharp/blob/5b03579e5c29dc38e90b0c2bb685411ff89b570e/lib/output.js#L753-L755
https://github.com/lovell/sharp/search?q=tiffPyramid
v0.33.0 is now available with .tiff({ miniswhite: true }) property - see https://sharp.pixelplumbing.com/api-output#tiff