photopea / UTIF.js

Fast and advanced TIFF decoder
MIT License
426 stars 87 forks source link

PKZIP compression #105

Closed HeligPfleigh closed 2 years ago

HeligPfleigh commented 2 years ago

Thank you guys for this awesome library. I'm using this one for displaying tiff image on my app, but it seem doesn't support some kind of compression (in my case it is PKZIP), even that image could be opened on https://www.photopea.com/

This is the image I've used: zippedTiff.zip. The data on this._imageData[frameIndex] after executing UTIF.decodeImage(this.buffer, this._imageData[frameIndex]); is just an array with full of 0 values

Could I use other decompress method for decompressing the PKZIP one? And could you add the supported compression list on the README?

photopea commented 2 years ago

Are other TIFF files working? If not, you are using the library a wrong way.

Are you using the latest UTIF.js from this repository, or some random version you found elsewhere? Update your version with the lates one from this repository.

HeligPfleigh commented 2 years ago

Are other TIFF files working?

Yes, those other tiff files I have work as expected. And below is the version I'm using and the data from UTIF.decodeImage with above image.

Environment Version
utif 3.1.0
nodejs 14.15.0
{
  data: [0, 0], // Uint8Array with full of Os
  height: 685,
  isLE: true,
  t256: [704],
  t257: [685],
  t258: [8, 8, 8],
  t259: [32946],
  t262: [2],
  t273: [8, 2709, 104702, 246153, 272473],
  t274: [1],
  t277: [3],
  t278: [171],
  t279: [2701, 101993, 141451, 26320, 25],
  t282: [0],
  t283: [0],
  t284: [1],
  t296: [2],
  t305: ['IrfanView'],
  width: 704,
}
photopea commented 2 years ago

What is "utif 3.1.0" ? We never gave releases of UTIF.js any name or a number. Please, switch to the latest UTIF.js from this repository, and I think everything should work.

HeligPfleigh commented 2 years ago

What is "utif 3.1.0" ?

It's from npm as my package.json is

  "dependencies": {
    ....
    "utif": "^3.1.0"
  }

And I've tried to use the latest code in master branch by "utif": "git+https://github.com/photopea/UTIF.js.git", it returns the same result.

photopea commented 2 years ago

I still think you are using an old library. Can you open your library (JS file) in a notepad? Is there a number "32946" in it somewhere? This number is in the latest UTIF.js at the line 172: https://github.com/photopea/UTIF.js/blob/master/UTIF.js#L172

HeligPfleigh commented 2 years ago

@photopea , thank you for your supporting. You are right, it've been cached in my node_modules and that compression work with latest code in master. Could you publish a version to npm cause version 3.1.0 seem to still have this issue?

photopea commented 2 years ago

I have never used npm. Could you put it there maybe?

HeligPfleigh commented 2 years ago

oh, I can't, only author of that package could have that permission. Btw thank you 👍