cross-image 0.2.2 → 0.2.3
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/README.md +128 -7
- package/esm/src/formats/jpeg.d.ts +12 -1
- package/esm/src/formats/jpeg.js +633 -4
- package/esm/src/formats/png_base.d.ts +8 -0
- package/esm/src/formats/png_base.js +176 -3
- package/esm/src/formats/tiff.d.ts +6 -1
- package/esm/src/formats/tiff.js +31 -0
- package/esm/src/formats/webp.d.ts +9 -2
- package/esm/src/formats/webp.js +211 -62
- package/esm/src/image.d.ts +51 -0
- package/esm/src/image.js +225 -5
- package/esm/src/types.d.ts +41 -1
- package/esm/src/utils/image_processing.d.ts +55 -0
- package/esm/src/utils/image_processing.js +210 -0
- package/esm/src/utils/metadata/xmp.d.ts +52 -0
- package/esm/src/utils/metadata/xmp.js +325 -0
- package/esm/src/utils/resize.d.ts +4 -0
- package/esm/src/utils/resize.js +74 -0
- package/package.json +1 -1
- package/script/src/formats/jpeg.d.ts +12 -1
- package/script/src/formats/jpeg.js +633 -4
- package/script/src/formats/png_base.d.ts +8 -0
- package/script/src/formats/png_base.js +176 -3
- package/script/src/formats/tiff.d.ts +6 -1
- package/script/src/formats/tiff.js +31 -0
- package/script/src/formats/webp.d.ts +9 -2
- package/script/src/formats/webp.js +211 -62
- package/script/src/image.d.ts +51 -0
- package/script/src/image.js +223 -3
- package/script/src/types.d.ts +41 -1
- package/script/src/utils/image_processing.d.ts +55 -0
- package/script/src/utils/image_processing.js +216 -0
- package/script/src/utils/metadata/xmp.d.ts +52 -0
- package/script/src/utils/metadata/xmp.js +333 -0
- package/script/src/utils/resize.d.ts +4 -0
- package/script/src/utils/resize.js +75 -0
package/script/src/types.d.ts
CHANGED
|
@@ -24,6 +24,32 @@ export interface ImageMetadata {
|
|
|
24
24
|
copyright?: string;
|
|
25
25
|
/** Creation date */
|
|
26
26
|
creationDate?: Date;
|
|
27
|
+
/** Camera make/manufacturer (e.g., "Canon", "Nikon") */
|
|
28
|
+
cameraMake?: string;
|
|
29
|
+
/** Camera model (e.g., "Canon EOS 5D Mark IV") */
|
|
30
|
+
cameraModel?: string;
|
|
31
|
+
/** Lens make/manufacturer */
|
|
32
|
+
lensMake?: string;
|
|
33
|
+
/** Lens model */
|
|
34
|
+
lensModel?: string;
|
|
35
|
+
/** ISO speed rating (e.g., 100, 400, 3200) */
|
|
36
|
+
iso?: number;
|
|
37
|
+
/** Exposure time / Shutter speed in seconds (e.g., 0.0125 = 1/80s) */
|
|
38
|
+
exposureTime?: number;
|
|
39
|
+
/** F-number / Aperture (e.g., 2.8, 5.6, 16) */
|
|
40
|
+
fNumber?: number;
|
|
41
|
+
/** Focal length in millimeters (e.g., 50, 85, 200) */
|
|
42
|
+
focalLength?: number;
|
|
43
|
+
/** Flash mode (0 = no flash, 1 = flash fired) */
|
|
44
|
+
flash?: number;
|
|
45
|
+
/** White balance mode (0 = auto, 1 = manual) */
|
|
46
|
+
whiteBalance?: number;
|
|
47
|
+
/** Orientation (1 = normal, 3 = 180°, 6 = 90° CW, 8 = 90° CCW) */
|
|
48
|
+
orientation?: number;
|
|
49
|
+
/** Software used to create/edit the image */
|
|
50
|
+
software?: string;
|
|
51
|
+
/** User comment / notes */
|
|
52
|
+
userComment?: string;
|
|
27
53
|
/** Custom metadata fields */
|
|
28
54
|
custom?: Record<string, string | number | boolean>;
|
|
29
55
|
}
|
|
@@ -88,7 +114,16 @@ export interface ResizeOptions {
|
|
|
88
114
|
/** Target height in pixels */
|
|
89
115
|
height: number;
|
|
90
116
|
/** Resize method (default: "bilinear") */
|
|
91
|
-
method?: "nearest" | "bilinear";
|
|
117
|
+
method?: "nearest" | "bilinear" | "bicubic";
|
|
118
|
+
/**
|
|
119
|
+
* Fitting mode (default: "stretch")
|
|
120
|
+
* - "stretch": Stretch image to fill dimensions (may distort)
|
|
121
|
+
* - "fit": Fit image within dimensions maintaining aspect ratio (may have letterboxing)
|
|
122
|
+
* - "fill": Fill dimensions maintaining aspect ratio (may crop)
|
|
123
|
+
* - "cover": Alias for "fill"
|
|
124
|
+
* - "contain": Alias for "fit"
|
|
125
|
+
*/
|
|
126
|
+
fit?: "stretch" | "fit" | "fill" | "cover" | "contain";
|
|
92
127
|
}
|
|
93
128
|
/**
|
|
94
129
|
* Options for ASCII art encoding
|
|
@@ -163,5 +198,10 @@ export interface ImageFormat {
|
|
|
163
198
|
* Check if the format supports multiple frames
|
|
164
199
|
*/
|
|
165
200
|
supportsMultipleFrames?(): boolean;
|
|
201
|
+
/**
|
|
202
|
+
* Get the list of metadata fields supported by this format
|
|
203
|
+
* @returns Array of metadata field names that can be persisted
|
|
204
|
+
*/
|
|
205
|
+
getSupportedMetadata?(): Array<keyof ImageMetadata>;
|
|
166
206
|
}
|
|
167
207
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -44,6 +44,13 @@ export declare function adjustExposure(data: Uint8Array, amount: number): Uint8A
|
|
|
44
44
|
* @returns New image data with adjusted saturation
|
|
45
45
|
*/
|
|
46
46
|
export declare function adjustSaturation(data: Uint8Array, amount: number): Uint8Array;
|
|
47
|
+
/**
|
|
48
|
+
* Adjust hue of an image by rotating the hue wheel
|
|
49
|
+
* @param data Image data (RGBA)
|
|
50
|
+
* @param degrees Hue rotation in degrees (any value accepted, wraps at 360)
|
|
51
|
+
* @returns New image data with adjusted hue
|
|
52
|
+
*/
|
|
53
|
+
export declare function adjustHue(data: Uint8Array, degrees: number): Uint8Array;
|
|
47
54
|
/**
|
|
48
55
|
* Invert colors of an image
|
|
49
56
|
* @param data Image data (RGBA)
|
|
@@ -131,4 +138,52 @@ export declare function sepia(data: Uint8Array): Uint8Array;
|
|
|
131
138
|
* @returns New image data with median filter applied
|
|
132
139
|
*/
|
|
133
140
|
export declare function medianFilter(data: Uint8Array, width: number, height: number, radius?: number): Uint8Array;
|
|
141
|
+
/**
|
|
142
|
+
* Rotate image 90 degrees clockwise
|
|
143
|
+
* @param data Image data (RGBA)
|
|
144
|
+
* @param width Image width
|
|
145
|
+
* @param height Image height
|
|
146
|
+
* @returns Rotated image data with swapped dimensions
|
|
147
|
+
*/
|
|
148
|
+
export declare function rotate90(data: Uint8Array, width: number, height: number): {
|
|
149
|
+
data: Uint8Array;
|
|
150
|
+
width: number;
|
|
151
|
+
height: number;
|
|
152
|
+
};
|
|
153
|
+
/**
|
|
154
|
+
* Rotate image 180 degrees
|
|
155
|
+
* @param data Image data (RGBA)
|
|
156
|
+
* @param width Image width
|
|
157
|
+
* @param height Image height
|
|
158
|
+
* @returns Rotated image data with same dimensions
|
|
159
|
+
*/
|
|
160
|
+
export declare function rotate180(data: Uint8Array, width: number, height: number): Uint8Array;
|
|
161
|
+
/**
|
|
162
|
+
* Rotate image 270 degrees clockwise (or 90 degrees counter-clockwise)
|
|
163
|
+
* @param data Image data (RGBA)
|
|
164
|
+
* @param width Image width
|
|
165
|
+
* @param height Image height
|
|
166
|
+
* @returns Rotated image data with swapped dimensions
|
|
167
|
+
*/
|
|
168
|
+
export declare function rotate270(data: Uint8Array, width: number, height: number): {
|
|
169
|
+
data: Uint8Array;
|
|
170
|
+
width: number;
|
|
171
|
+
height: number;
|
|
172
|
+
};
|
|
173
|
+
/**
|
|
174
|
+
* Flip image horizontally (mirror)
|
|
175
|
+
* @param data Image data (RGBA)
|
|
176
|
+
* @param width Image width
|
|
177
|
+
* @param height Image height
|
|
178
|
+
* @returns Flipped image data
|
|
179
|
+
*/
|
|
180
|
+
export declare function flipHorizontal(data: Uint8Array, width: number, height: number): Uint8Array;
|
|
181
|
+
/**
|
|
182
|
+
* Flip image vertically
|
|
183
|
+
* @param data Image data (RGBA)
|
|
184
|
+
* @param width Image width
|
|
185
|
+
* @param height Image height
|
|
186
|
+
* @returns Flipped image data
|
|
187
|
+
*/
|
|
188
|
+
export declare function flipVertical(data: Uint8Array, width: number, height: number): Uint8Array;
|
|
134
189
|
//# sourceMappingURL=image_processing.d.ts.map
|
|
@@ -9,6 +9,7 @@ exports.adjustBrightness = adjustBrightness;
|
|
|
9
9
|
exports.adjustContrast = adjustContrast;
|
|
10
10
|
exports.adjustExposure = adjustExposure;
|
|
11
11
|
exports.adjustSaturation = adjustSaturation;
|
|
12
|
+
exports.adjustHue = adjustHue;
|
|
12
13
|
exports.invert = invert;
|
|
13
14
|
exports.grayscale = grayscale;
|
|
14
15
|
exports.fillRect = fillRect;
|
|
@@ -18,6 +19,11 @@ exports.gaussianBlur = gaussianBlur;
|
|
|
18
19
|
exports.sharpen = sharpen;
|
|
19
20
|
exports.sepia = sepia;
|
|
20
21
|
exports.medianFilter = medianFilter;
|
|
22
|
+
exports.rotate90 = rotate90;
|
|
23
|
+
exports.rotate180 = rotate180;
|
|
24
|
+
exports.rotate270 = rotate270;
|
|
25
|
+
exports.flipHorizontal = flipHorizontal;
|
|
26
|
+
exports.flipVertical = flipVertical;
|
|
21
27
|
/**
|
|
22
28
|
* Composite one image on top of another at a specified position
|
|
23
29
|
* @param base Base image data (RGBA)
|
|
@@ -147,6 +153,99 @@ function adjustSaturation(data, amount) {
|
|
|
147
153
|
}
|
|
148
154
|
return result;
|
|
149
155
|
}
|
|
156
|
+
/**
|
|
157
|
+
* Convert RGB to HSL color space
|
|
158
|
+
* @param r Red component (0-255)
|
|
159
|
+
* @param g Green component (0-255)
|
|
160
|
+
* @param b Blue component (0-255)
|
|
161
|
+
* @returns HSL values: [h (0-360), s (0-1), l (0-1)]
|
|
162
|
+
*/
|
|
163
|
+
function rgbToHsl(r, g, b) {
|
|
164
|
+
r /= 255;
|
|
165
|
+
g /= 255;
|
|
166
|
+
b /= 255;
|
|
167
|
+
const max = Math.max(r, g, b);
|
|
168
|
+
const min = Math.min(r, g, b);
|
|
169
|
+
const delta = max - min;
|
|
170
|
+
let h = 0;
|
|
171
|
+
let s = 0;
|
|
172
|
+
const l = (max + min) / 2;
|
|
173
|
+
if (delta !== 0) {
|
|
174
|
+
s = l > 0.5 ? delta / (2 - max - min) : delta / (max + min);
|
|
175
|
+
if (max === r) {
|
|
176
|
+
h = ((g - b) / delta + (g < b ? 6 : 0)) / 6;
|
|
177
|
+
}
|
|
178
|
+
else if (max === g) {
|
|
179
|
+
h = ((b - r) / delta + 2) / 6;
|
|
180
|
+
}
|
|
181
|
+
else {
|
|
182
|
+
h = ((r - g) / delta + 4) / 6;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
return [h * 360, s, l];
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Convert HSL to RGB color space
|
|
189
|
+
* @param h Hue (0-360)
|
|
190
|
+
* @param s Saturation (0-1)
|
|
191
|
+
* @param l Lightness (0-1)
|
|
192
|
+
* @returns RGB values: [r (0-255), g (0-255), b (0-255)]
|
|
193
|
+
*/
|
|
194
|
+
function hslToRgb(h, s, l) {
|
|
195
|
+
h = h / 360;
|
|
196
|
+
let r, g, b;
|
|
197
|
+
if (s === 0) {
|
|
198
|
+
r = g = b = l; // Achromatic
|
|
199
|
+
}
|
|
200
|
+
else {
|
|
201
|
+
const hue2rgb = (p, q, t) => {
|
|
202
|
+
if (t < 0)
|
|
203
|
+
t += 1;
|
|
204
|
+
if (t > 1)
|
|
205
|
+
t -= 1;
|
|
206
|
+
if (t < 1 / 6)
|
|
207
|
+
return p + (q - p) * 6 * t;
|
|
208
|
+
if (t < 1 / 2)
|
|
209
|
+
return q;
|
|
210
|
+
if (t < 2 / 3)
|
|
211
|
+
return p + (q - p) * (2 / 3 - t) * 6;
|
|
212
|
+
return p;
|
|
213
|
+
};
|
|
214
|
+
const q = l < 0.5 ? l * (1 + s) : l + s - l * s;
|
|
215
|
+
const p = 2 * l - q;
|
|
216
|
+
r = hue2rgb(p, q, h + 1 / 3);
|
|
217
|
+
g = hue2rgb(p, q, h);
|
|
218
|
+
b = hue2rgb(p, q, h - 1 / 3);
|
|
219
|
+
}
|
|
220
|
+
return [Math.round(r * 255), Math.round(g * 255), Math.round(b * 255)];
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Adjust hue of an image by rotating the hue wheel
|
|
224
|
+
* @param data Image data (RGBA)
|
|
225
|
+
* @param degrees Hue rotation in degrees (any value accepted, wraps at 360)
|
|
226
|
+
* @returns New image data with adjusted hue
|
|
227
|
+
*/
|
|
228
|
+
function adjustHue(data, degrees) {
|
|
229
|
+
const result = new Uint8Array(data.length);
|
|
230
|
+
// Normalize rotation to -180 to 180 range
|
|
231
|
+
const rotation = ((degrees % 360) + 360) % 360;
|
|
232
|
+
for (let i = 0; i < data.length; i += 4) {
|
|
233
|
+
const r = data[i];
|
|
234
|
+
const g = data[i + 1];
|
|
235
|
+
const b = data[i + 2];
|
|
236
|
+
// Convert to HSL
|
|
237
|
+
const [h, s, l] = rgbToHsl(r, g, b);
|
|
238
|
+
// Rotate hue
|
|
239
|
+
const newH = (h + rotation) % 360;
|
|
240
|
+
// Convert back to RGB
|
|
241
|
+
const [newR, newG, newB] = hslToRgb(newH, s, l);
|
|
242
|
+
result[i] = newR;
|
|
243
|
+
result[i + 1] = newG;
|
|
244
|
+
result[i + 2] = newB;
|
|
245
|
+
result[i + 3] = data[i + 3]; // Preserve alpha
|
|
246
|
+
}
|
|
247
|
+
return result;
|
|
248
|
+
}
|
|
150
249
|
/**
|
|
151
250
|
* Invert colors of an image
|
|
152
251
|
* @param data Image data (RGBA)
|
|
@@ -475,3 +574,120 @@ function medianFilter(data, width, height, radius = 1) {
|
|
|
475
574
|
}
|
|
476
575
|
return result;
|
|
477
576
|
}
|
|
577
|
+
/**
|
|
578
|
+
* Rotate image 90 degrees clockwise
|
|
579
|
+
* @param data Image data (RGBA)
|
|
580
|
+
* @param width Image width
|
|
581
|
+
* @param height Image height
|
|
582
|
+
* @returns Rotated image data with swapped dimensions
|
|
583
|
+
*/
|
|
584
|
+
function rotate90(data, width, height) {
|
|
585
|
+
const result = new Uint8Array(data.length);
|
|
586
|
+
const newWidth = height;
|
|
587
|
+
const newHeight = width;
|
|
588
|
+
for (let y = 0; y < height; y++) {
|
|
589
|
+
for (let x = 0; x < width; x++) {
|
|
590
|
+
const srcIdx = (y * width + x) * 4;
|
|
591
|
+
const dstX = height - 1 - y;
|
|
592
|
+
const dstY = x;
|
|
593
|
+
const dstIdx = (dstY * newWidth + dstX) * 4;
|
|
594
|
+
result[dstIdx] = data[srcIdx];
|
|
595
|
+
result[dstIdx + 1] = data[srcIdx + 1];
|
|
596
|
+
result[dstIdx + 2] = data[srcIdx + 2];
|
|
597
|
+
result[dstIdx + 3] = data[srcIdx + 3];
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
return { data: result, width: newWidth, height: newHeight };
|
|
601
|
+
}
|
|
602
|
+
/**
|
|
603
|
+
* Rotate image 180 degrees
|
|
604
|
+
* @param data Image data (RGBA)
|
|
605
|
+
* @param width Image width
|
|
606
|
+
* @param height Image height
|
|
607
|
+
* @returns Rotated image data with same dimensions
|
|
608
|
+
*/
|
|
609
|
+
function rotate180(data, width, height) {
|
|
610
|
+
const result = new Uint8Array(data.length);
|
|
611
|
+
for (let y = 0; y < height; y++) {
|
|
612
|
+
for (let x = 0; x < width; x++) {
|
|
613
|
+
const srcIdx = (y * width + x) * 4;
|
|
614
|
+
const dstX = width - 1 - x;
|
|
615
|
+
const dstY = height - 1 - y;
|
|
616
|
+
const dstIdx = (dstY * width + dstX) * 4;
|
|
617
|
+
result[dstIdx] = data[srcIdx];
|
|
618
|
+
result[dstIdx + 1] = data[srcIdx + 1];
|
|
619
|
+
result[dstIdx + 2] = data[srcIdx + 2];
|
|
620
|
+
result[dstIdx + 3] = data[srcIdx + 3];
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
return result;
|
|
624
|
+
}
|
|
625
|
+
/**
|
|
626
|
+
* Rotate image 270 degrees clockwise (or 90 degrees counter-clockwise)
|
|
627
|
+
* @param data Image data (RGBA)
|
|
628
|
+
* @param width Image width
|
|
629
|
+
* @param height Image height
|
|
630
|
+
* @returns Rotated image data with swapped dimensions
|
|
631
|
+
*/
|
|
632
|
+
function rotate270(data, width, height) {
|
|
633
|
+
const result = new Uint8Array(data.length);
|
|
634
|
+
const newWidth = height;
|
|
635
|
+
const newHeight = width;
|
|
636
|
+
for (let y = 0; y < height; y++) {
|
|
637
|
+
for (let x = 0; x < width; x++) {
|
|
638
|
+
const srcIdx = (y * width + x) * 4;
|
|
639
|
+
const dstX = y;
|
|
640
|
+
const dstY = width - 1 - x;
|
|
641
|
+
const dstIdx = (dstY * newWidth + dstX) * 4;
|
|
642
|
+
result[dstIdx] = data[srcIdx];
|
|
643
|
+
result[dstIdx + 1] = data[srcIdx + 1];
|
|
644
|
+
result[dstIdx + 2] = data[srcIdx + 2];
|
|
645
|
+
result[dstIdx + 3] = data[srcIdx + 3];
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
return { data: result, width: newWidth, height: newHeight };
|
|
649
|
+
}
|
|
650
|
+
/**
|
|
651
|
+
* Flip image horizontally (mirror)
|
|
652
|
+
* @param data Image data (RGBA)
|
|
653
|
+
* @param width Image width
|
|
654
|
+
* @param height Image height
|
|
655
|
+
* @returns Flipped image data
|
|
656
|
+
*/
|
|
657
|
+
function flipHorizontal(data, width, height) {
|
|
658
|
+
const result = new Uint8Array(data.length);
|
|
659
|
+
for (let y = 0; y < height; y++) {
|
|
660
|
+
for (let x = 0; x < width; x++) {
|
|
661
|
+
const srcIdx = (y * width + x) * 4;
|
|
662
|
+
const dstX = width - 1 - x;
|
|
663
|
+
const dstIdx = (y * width + dstX) * 4;
|
|
664
|
+
result[dstIdx] = data[srcIdx];
|
|
665
|
+
result[dstIdx + 1] = data[srcIdx + 1];
|
|
666
|
+
result[dstIdx + 2] = data[srcIdx + 2];
|
|
667
|
+
result[dstIdx + 3] = data[srcIdx + 3];
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
return result;
|
|
671
|
+
}
|
|
672
|
+
/**
|
|
673
|
+
* Flip image vertically
|
|
674
|
+
* @param data Image data (RGBA)
|
|
675
|
+
* @param width Image width
|
|
676
|
+
* @param height Image height
|
|
677
|
+
* @returns Flipped image data
|
|
678
|
+
*/
|
|
679
|
+
function flipVertical(data, width, height) {
|
|
680
|
+
const result = new Uint8Array(data.length);
|
|
681
|
+
for (let y = 0; y < height; y++) {
|
|
682
|
+
for (let x = 0; x < width; x++) {
|
|
683
|
+
const srcIdx = (y * width + x) * 4;
|
|
684
|
+
const dstY = height - 1 - y;
|
|
685
|
+
const dstIdx = (dstY * width + x) * 4;
|
|
686
|
+
result[dstIdx] = data[srcIdx];
|
|
687
|
+
result[dstIdx + 1] = data[srcIdx + 1];
|
|
688
|
+
result[dstIdx + 2] = data[srcIdx + 2];
|
|
689
|
+
result[dstIdx + 3] = data[srcIdx + 3];
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
return result;
|
|
693
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* XMP (Extensible Metadata Platform) parsing and writing utilities
|
|
3
|
+
*
|
|
4
|
+
* This module provides utilities for reading and writing XMP metadata in image files.
|
|
5
|
+
* It supports Dublin Core, EXIF, and Photoshop namespaces.
|
|
6
|
+
*/
|
|
7
|
+
import type { ImageMetadata } from "../../types.js";
|
|
8
|
+
/**
|
|
9
|
+
* XMP namespace URIs
|
|
10
|
+
*/
|
|
11
|
+
export declare const XMP_NAMESPACES: {
|
|
12
|
+
readonly RDF: "http://www.w3.org/1999/02/22-rdf-syntax-ns#";
|
|
13
|
+
readonly DC: "http://purl.org/dc/elements/1.1/";
|
|
14
|
+
readonly XMP: "http://ns.adobe.com/xap/1.0/";
|
|
15
|
+
readonly EXIF: "http://ns.adobe.com/exif/1.0/";
|
|
16
|
+
readonly TIFF: "http://ns.adobe.com/tiff/1.0/";
|
|
17
|
+
readonly PHOTOSHOP: "http://ns.adobe.com/photoshop/1.0/";
|
|
18
|
+
readonly XMP_RIGHTS: "http://ns.adobe.com/xap/1.0/rights/";
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* XMP Dublin Core field mapping to ImageMetadata
|
|
22
|
+
*/
|
|
23
|
+
export interface XMPFieldMapping {
|
|
24
|
+
xmpPath: string;
|
|
25
|
+
metadataKey: keyof ImageMetadata;
|
|
26
|
+
namespace: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Supported XMP fields and their mappings
|
|
30
|
+
*/
|
|
31
|
+
export declare const XMP_FIELD_MAPPINGS: XMPFieldMapping[];
|
|
32
|
+
/**
|
|
33
|
+
* Escape XML special characters
|
|
34
|
+
*/
|
|
35
|
+
export declare function escapeXML(str: string): string;
|
|
36
|
+
/**
|
|
37
|
+
* Unescape XML special characters
|
|
38
|
+
*/
|
|
39
|
+
export declare function unescapeXML(str: string): string;
|
|
40
|
+
/**
|
|
41
|
+
* Parse XMP metadata from XML string
|
|
42
|
+
*/
|
|
43
|
+
export declare function parseXMP(xmpStr: string): Partial<ImageMetadata>;
|
|
44
|
+
/**
|
|
45
|
+
* Create XMP packet from metadata
|
|
46
|
+
*/
|
|
47
|
+
export declare function createXMP(metadata: Partial<ImageMetadata>): string;
|
|
48
|
+
/**
|
|
49
|
+
* Get list of supported XMP metadata fields
|
|
50
|
+
*/
|
|
51
|
+
export declare function getSupportedXMPFields(): Array<keyof ImageMetadata>;
|
|
52
|
+
//# sourceMappingURL=xmp.d.ts.map
|