tiff.js
tiff.js copied to clipboard
How to create multipage tif using tiff.js
How to create multipage tiff file using tiff.js at client side.?
This port of libtiff was only made to read a tiff file and not meant to create multi-page tiff file. If you want to create tiff file in js you need to do another port of lib tiff by adding the function you needed.
@Aleanar I don't get you on you above point. Could you elaborate more on that. So that I could start with implementation.
I asked chat.openai.com how to make a html page that reads a TIFF file, makes some modifications, and creates a result. the AI told me to use libtiff.js from https://github.com/seikichi/libtiff.js. That URL gives an error, so I guess it means https://github.com/seikichi/tiff.js. It suggested this code, which does not seem to work:
// Create new TIFF page
var newTiff = new Tiff({buffer: new ArrayBuffer(0)});
newTiff.setField(Tiff.Tag.IMAGEWIDTH, width);
newTiff.setField(Tiff.Tag.IMAGELENGTH, height);
newTiff.setField(Tiff.Tag.IMAGEDESCRIPTION, metadata);
newTiff.writeRGBAImage(imageData);
Constructing a new Tiff from new ArrayBuffer(0) does not seem to work. Is the AI misleading me?