Conversation
lpatiny
left a comment
There was a problem hiding this comment.
I could not see the meta information. Are they parsed ?
src/__tests__/test.js
Outdated
| ); | ||
| const read = readFile(arrayBuffer); | ||
| const image = createImage(read); | ||
| /* //uncomment to save files locally |
There was a problem hiding this comment.
Don't leave commented bloc of code in the code. You can however systematically save the image and this can be part of the test.
I guess to compare images you could use https://www.npmjs.com/package/jest-image-snapshot
There was a problem hiding this comment.
You could also add a test that compares part of the object (meta information like width, height but not the data itself).
It could be a to match snapshot but part of the test could also be done directly in the code using https://jestjs.io/docs/expect#tomatchobjectobject
There was a problem hiding this comment.
Metadata is contained in the header attribute of read in this instance.
| ); | ||
| hardScale = parseFloat(zScaleExec.groups.hardScale); | ||
| } | ||
| // ActualData = hardValue * softScale, hardValue = raw value * hardScale |
There was a problem hiding this comment.
I don't understand the following code because map creates a new array that is not used so this code seems useless (and apparently not tested).
'.map' is also quite slow so better to make a simple loop (and change the data inplace ???)
Strange also that you multiplay hardScale * softScale. Is this correct ? If yes there should be precalculated once for ever if they are constant.
There was a problem hiding this comment.
It is indeed correct and hardScale * softScale should be constant yes. I will replace map with a loop, thank you for the input.
|
There could be a new property 'metadata' that contains an object with all the meta information. |
|
I'm not sure this package should depend on image-js. For the other decoders, we added support inside image-js directly. |
|
Indeed image-js should be a dev dependency |
…ge map to loop, make scale constant
…ut the file format
No description provided.