@bb-studio/exr 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -129,7 +129,7 @@ declare function isExrError(value: unknown): value is ExrError;
129
129
  declare function parseExrStructure(bufferInput: ExrBinaryInput, options?: ParseExrOptions): ExrStructure;
130
130
  declare const parseExr: typeof parseExrStructure;
131
131
 
132
- declare function decodeExrPart(bufferInput: ExrBinaryInput, structure: ExrStructure, options: DecodeExrPartOptions): DecodedPart;
132
+ declare function decodeExrPart(buffer: ExrBinaryInput, structure: ExrStructure, options: DecodeExrPartOptions): DecodedPart;
133
133
 
134
134
  /** A byte source. Return up to length bytes, with a short read only at EOF. */
135
135
  interface ExrRandomAccessSource {
@@ -204,21 +204,38 @@ declare function inspectExrImage(buffer: ExrBinaryInput, options?: InspectExrIma
204
204
  declare function expandSampledChannel(width: number, height: number, xMin: number, yMin: number, channel: DecodedChannel): Float32Array;
205
205
  declare function expandDecodedPartChannels(decoded: DecodedPart, dataWindow: ExrWindow): Record<string, Float32Array>;
206
206
 
207
+ type ExrRgbaStoragePrecision = 'float16' | 'float32';
208
+ /** HALF storage is lossless only when every selected physical RGBA channel
209
+ * is HALF. Unselected technical channels do not determine RGB storage. */
210
+ declare function getExrRgbaStoragePrecision(channels: readonly ExrChannel[], channelNames?: readonly string[]): ExrRgbaStoragePrecision;
211
+
207
212
  interface DecodeExrRgbaOptions extends ParseExrOptions {
208
213
  partId?: number;
209
214
  decode?: Omit<DecodeExrPartOptions, 'partId' | 'onEvent'>;
210
215
  }
211
- interface DecodedExrRgbaImage {
216
+ interface ExrRgbaImageMetadata {
212
217
  width: number;
213
218
  height: number;
214
- rgba: Float32Array;
215
219
  partId: number;
216
220
  dataWindow: ExrWindow;
217
221
  displayWindow?: ExrWindow;
218
222
  channels: readonly ExrChannel[];
219
223
  attributes: Readonly<Record<string, unknown>>;
220
224
  }
225
+ interface DecodedExrRgbaImage extends ExrRgbaImageMetadata {
226
+ rgba: Float32Array;
227
+ }
228
+ type DecodedExrNativeRgbaImage = ExrRgbaImageMetadata & ({
229
+ storagePrecision: 'float16';
230
+ rgba: Uint16Array;
231
+ } | {
232
+ storagePrecision: 'float32';
233
+ rgba: Float32Array;
234
+ });
221
235
  declare function decodeExrRgba(buffer: ExrBinaryInput, options?: DecodeExrRgbaOptions): DecodedExrRgbaImage;
236
+ /** Decode directly into lossless native RGBA storage. HALF output contains
237
+ * binary16 bits, not integer-valued samples; FLOAT/UINT selections use Float32. */
238
+ declare function decodeExrNativeRgba(buffer: ExrBinaryInput, options?: DecodeExrRgbaOptions): DecodedExrNativeRgbaImage;
222
239
 
223
240
  declare function writeExr(input: WriteExrInput, options?: WriteExrOptions): Uint8Array;
224
241
 
@@ -247,4 +264,4 @@ interface EncodeExrRgbaOptions {
247
264
  }
248
265
  declare function encodeExrRgba(image: EncodeExrRgbaImage, options: EncodeExrRgbaOptions): Uint8Array;
249
266
 
250
- export { type DecodeExrPartOptions, type DecodeExrRgbaOptions, type DecodedChannel, type DecodedExrRgbaImage, type DecodedPart, EXR_EVENT_CODES, type EncodeExrRgbaImage, type EncodeExrRgbaOptions, type EventCapableOptions, type ExrBinaryInput, type ExrChannel, type ExrChromaticities, type ExrChunk, type ExrCompression, type ExrDecodeOptions, type ExrDecodedRegion, ExrError, type ExrErrorCode, type ExrEvent, type ExrEventCallback, type ExrEventCode, type ExrEventLevel, type ExrEventPhase, type ExrImageInfo, type ExrNamedChannelPrecision, type ExrPart, type ExrPixelType, type ExrRandomAccessSource, type ExrReader, type ExrRgbaNamedChannel, type ExrRgbaPrecision, type ExrStructure, type ExrWindow, type InspectExrImageOptions, type OpenExrOptions, type ParseExrOptions, type ReadExrOptions, type ReadExrResult, type WriteExrAttribute, type WriteExrChannelInput, type WriteExrInput, type WriteExrOptions, type WriteExrPartInput, bufferExrSource, decodeExrPart, decodeExrRgba, encodeExrRgba, expandDecodedPartChannels, expandSampledChannel, inspectExrImage, isExrError, openExr, parseExr, parseExrStructure, readExr, toArrayBuffer, writeExr };
267
+ export { type DecodeExrPartOptions, type DecodeExrRgbaOptions, type DecodedChannel, type DecodedExrNativeRgbaImage, type DecodedExrRgbaImage, type DecodedPart, EXR_EVENT_CODES, type EncodeExrRgbaImage, type EncodeExrRgbaOptions, type EventCapableOptions, type ExrBinaryInput, type ExrChannel, type ExrChromaticities, type ExrChunk, type ExrCompression, type ExrDecodeOptions, type ExrDecodedRegion, ExrError, type ExrErrorCode, type ExrEvent, type ExrEventCallback, type ExrEventCode, type ExrEventLevel, type ExrEventPhase, type ExrImageInfo, type ExrNamedChannelPrecision, type ExrPart, type ExrPixelType, type ExrRandomAccessSource, type ExrReader, type ExrRgbaNamedChannel, type ExrRgbaPrecision, type ExrRgbaStoragePrecision, type ExrStructure, type ExrWindow, type InspectExrImageOptions, type OpenExrOptions, type ParseExrOptions, type ReadExrOptions, type ReadExrResult, type WriteExrAttribute, type WriteExrChannelInput, type WriteExrInput, type WriteExrOptions, type WriteExrPartInput, bufferExrSource, decodeExrNativeRgba, decodeExrPart, decodeExrRgba, encodeExrRgba, expandDecodedPartChannels, expandSampledChannel, getExrRgbaStoragePrecision, inspectExrImage, isExrError, openExr, parseExr, parseExrStructure, readExr, toArrayBuffer, writeExr };
package/dist/index.d.ts CHANGED
@@ -129,7 +129,7 @@ declare function isExrError(value: unknown): value is ExrError;
129
129
  declare function parseExrStructure(bufferInput: ExrBinaryInput, options?: ParseExrOptions): ExrStructure;
130
130
  declare const parseExr: typeof parseExrStructure;
131
131
 
132
- declare function decodeExrPart(bufferInput: ExrBinaryInput, structure: ExrStructure, options: DecodeExrPartOptions): DecodedPart;
132
+ declare function decodeExrPart(buffer: ExrBinaryInput, structure: ExrStructure, options: DecodeExrPartOptions): DecodedPart;
133
133
 
134
134
  /** A byte source. Return up to length bytes, with a short read only at EOF. */
135
135
  interface ExrRandomAccessSource {
@@ -204,21 +204,38 @@ declare function inspectExrImage(buffer: ExrBinaryInput, options?: InspectExrIma
204
204
  declare function expandSampledChannel(width: number, height: number, xMin: number, yMin: number, channel: DecodedChannel): Float32Array;
205
205
  declare function expandDecodedPartChannels(decoded: DecodedPart, dataWindow: ExrWindow): Record<string, Float32Array>;
206
206
 
207
+ type ExrRgbaStoragePrecision = 'float16' | 'float32';
208
+ /** HALF storage is lossless only when every selected physical RGBA channel
209
+ * is HALF. Unselected technical channels do not determine RGB storage. */
210
+ declare function getExrRgbaStoragePrecision(channels: readonly ExrChannel[], channelNames?: readonly string[]): ExrRgbaStoragePrecision;
211
+
207
212
  interface DecodeExrRgbaOptions extends ParseExrOptions {
208
213
  partId?: number;
209
214
  decode?: Omit<DecodeExrPartOptions, 'partId' | 'onEvent'>;
210
215
  }
211
- interface DecodedExrRgbaImage {
216
+ interface ExrRgbaImageMetadata {
212
217
  width: number;
213
218
  height: number;
214
- rgba: Float32Array;
215
219
  partId: number;
216
220
  dataWindow: ExrWindow;
217
221
  displayWindow?: ExrWindow;
218
222
  channels: readonly ExrChannel[];
219
223
  attributes: Readonly<Record<string, unknown>>;
220
224
  }
225
+ interface DecodedExrRgbaImage extends ExrRgbaImageMetadata {
226
+ rgba: Float32Array;
227
+ }
228
+ type DecodedExrNativeRgbaImage = ExrRgbaImageMetadata & ({
229
+ storagePrecision: 'float16';
230
+ rgba: Uint16Array;
231
+ } | {
232
+ storagePrecision: 'float32';
233
+ rgba: Float32Array;
234
+ });
221
235
  declare function decodeExrRgba(buffer: ExrBinaryInput, options?: DecodeExrRgbaOptions): DecodedExrRgbaImage;
236
+ /** Decode directly into lossless native RGBA storage. HALF output contains
237
+ * binary16 bits, not integer-valued samples; FLOAT/UINT selections use Float32. */
238
+ declare function decodeExrNativeRgba(buffer: ExrBinaryInput, options?: DecodeExrRgbaOptions): DecodedExrNativeRgbaImage;
222
239
 
223
240
  declare function writeExr(input: WriteExrInput, options?: WriteExrOptions): Uint8Array;
224
241
 
@@ -247,4 +264,4 @@ interface EncodeExrRgbaOptions {
247
264
  }
248
265
  declare function encodeExrRgba(image: EncodeExrRgbaImage, options: EncodeExrRgbaOptions): Uint8Array;
249
266
 
250
- export { type DecodeExrPartOptions, type DecodeExrRgbaOptions, type DecodedChannel, type DecodedExrRgbaImage, type DecodedPart, EXR_EVENT_CODES, type EncodeExrRgbaImage, type EncodeExrRgbaOptions, type EventCapableOptions, type ExrBinaryInput, type ExrChannel, type ExrChromaticities, type ExrChunk, type ExrCompression, type ExrDecodeOptions, type ExrDecodedRegion, ExrError, type ExrErrorCode, type ExrEvent, type ExrEventCallback, type ExrEventCode, type ExrEventLevel, type ExrEventPhase, type ExrImageInfo, type ExrNamedChannelPrecision, type ExrPart, type ExrPixelType, type ExrRandomAccessSource, type ExrReader, type ExrRgbaNamedChannel, type ExrRgbaPrecision, type ExrStructure, type ExrWindow, type InspectExrImageOptions, type OpenExrOptions, type ParseExrOptions, type ReadExrOptions, type ReadExrResult, type WriteExrAttribute, type WriteExrChannelInput, type WriteExrInput, type WriteExrOptions, type WriteExrPartInput, bufferExrSource, decodeExrPart, decodeExrRgba, encodeExrRgba, expandDecodedPartChannels, expandSampledChannel, inspectExrImage, isExrError, openExr, parseExr, parseExrStructure, readExr, toArrayBuffer, writeExr };
267
+ export { type DecodeExrPartOptions, type DecodeExrRgbaOptions, type DecodedChannel, type DecodedExrNativeRgbaImage, type DecodedExrRgbaImage, type DecodedPart, EXR_EVENT_CODES, type EncodeExrRgbaImage, type EncodeExrRgbaOptions, type EventCapableOptions, type ExrBinaryInput, type ExrChannel, type ExrChromaticities, type ExrChunk, type ExrCompression, type ExrDecodeOptions, type ExrDecodedRegion, ExrError, type ExrErrorCode, type ExrEvent, type ExrEventCallback, type ExrEventCode, type ExrEventLevel, type ExrEventPhase, type ExrImageInfo, type ExrNamedChannelPrecision, type ExrPart, type ExrPixelType, type ExrRandomAccessSource, type ExrReader, type ExrRgbaNamedChannel, type ExrRgbaPrecision, type ExrRgbaStoragePrecision, type ExrStructure, type ExrWindow, type InspectExrImageOptions, type OpenExrOptions, type ParseExrOptions, type ReadExrOptions, type ReadExrResult, type WriteExrAttribute, type WriteExrChannelInput, type WriteExrInput, type WriteExrOptions, type WriteExrPartInput, bufferExrSource, decodeExrNativeRgba, decodeExrPart, decodeExrRgba, encodeExrRgba, expandDecodedPartChannels, expandSampledChannel, getExrRgbaStoragePrecision, inspectExrImage, isExrError, openExr, parseExr, parseExrStructure, readExr, toArrayBuffer, writeExr };