Skip to content

Commit 06d4385

Browse files
committed
Replace index 277 with fieldTag.SamplesPerPixel
Resolves review comment from constantinius in #463 by pulling in the fieldTag object and using it to explicitly grab the SamplesPerPixel ifd.
1 parent 353c67a commit 06d4385

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/geotiffwriter.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
You can view that here:
55
https://github.com/photopea/UTIF.js/blob/master/LICENSE
66
*/
7-
import { fieldTagNames, fieldTagTypes, fieldTypeNames, geoKeyNames } from './globals.js';
7+
import { fieldTags, fieldTagNames, fieldTagTypes, fieldTypeNames, geoKeyNames } from './globals.js';
88
import { assign, endsWith, forEach, invert, times, typeMap,
99
isTypedUintArray, isTypedIntArray, isTypedFloatArray } from './utils.js';
1010

@@ -252,7 +252,7 @@ const encodeImage = (values, width, height, metadata) => {
252252
}
253253

254254
const prfx = new Uint8Array(encodeIfds([ifd]));
255-
const samplesPerPixel = ifd[277];
255+
const samplesPerPixel = ifd[fieldTags.SamplesPerPixel];
256256

257257
const dataType = values.constructor.name;
258258
const TypedArray = typeMap[dataType];

0 commit comments

Comments
 (0)