ag-psd 28.1.1 → 28.2.1
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/.v8-cache/v22.13.1-x64-00250a7c/b3c2fab7 +0 -0
- package/dist/additionalInfo.js +29 -14
- package/dist/additionalInfo.js.map +1 -1
- package/dist/bundle.js +2176 -38
- package/dist/psd.d.ts +10 -1
- package/dist/psd.js.map +1 -1
- package/dist-es/additionalInfo.js +29 -14
- package/dist-es/additionalInfo.js.map +1 -1
- package/dist-es/psd.d.ts +10 -1
- package/dist-es/psd.js.map +1 -1
- package/package.json +1 -1
- package/src/additionalInfo.ts +76 -37
- package/src/psd.ts +10 -1
package/dist-es/psd.d.ts
CHANGED
|
@@ -1147,7 +1147,7 @@ type FilterVariant = {
|
|
|
1147
1147
|
type: 'curves';
|
|
1148
1148
|
filter: {
|
|
1149
1149
|
presetKind: 'custom' | 'default';
|
|
1150
|
-
adjustments
|
|
1150
|
+
adjustments?: ({
|
|
1151
1151
|
channels: ('composite' | 'red' | 'green' | 'blue')[];
|
|
1152
1152
|
curve: {
|
|
1153
1153
|
x: number;
|
|
@@ -1159,6 +1159,15 @@ type FilterVariant = {
|
|
|
1159
1159
|
values: number[];
|
|
1160
1160
|
})[];
|
|
1161
1161
|
};
|
|
1162
|
+
} | {
|
|
1163
|
+
type: 'invert';
|
|
1164
|
+
} | {
|
|
1165
|
+
type: 'brightness/contrast';
|
|
1166
|
+
filter: {
|
|
1167
|
+
brightness: number;
|
|
1168
|
+
contrast: number;
|
|
1169
|
+
useLegacy: boolean;
|
|
1170
|
+
};
|
|
1162
1171
|
};
|
|
1163
1172
|
export type Filter = FilterVariant & {
|
|
1164
1173
|
name: string;
|
package/dist-es/psd.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"psd.js","sourceRoot":"../src/","sources":["psd.ts"],"names":[],"mappings":"AAMA,MAAM,CAAN,IAAkB,SASjB;AATD,WAAkB,SAAS;IAC1B,6CAAU,CAAA;IACV,mDAAa,CAAA;IACb,+CAAW,CAAA;IACX,uCAAO,CAAA;IACP,yCAAQ,CAAA;IACR,yDAAgB,CAAA;IAChB,+CAAW,CAAA;IACX,uCAAO,CAAA;AACR,CAAC,EATiB,SAAS,KAAT,SAAS,QAS1B;AAED,MAAM,CAAN,IAAkB,kBAKjB;AALD,WAAkB,kBAAkB;IACnC,6DAAS,CAAA;IACT,uEAAc,CAAA;IACd,2EAAgB,CAAA;IAChB,+FAA0B,CAAA;AAC3B,CAAC,EALiB,kBAAkB,KAAlB,kBAAkB,QAKnC;
|
|
1
|
+
{"version":3,"file":"psd.js","sourceRoot":"../src/","sources":["psd.ts"],"names":[],"mappings":"AAMA,MAAM,CAAN,IAAkB,SASjB;AATD,WAAkB,SAAS;IAC1B,6CAAU,CAAA;IACV,mDAAa,CAAA;IACb,+CAAW,CAAA;IACX,uCAAO,CAAA;IACP,yCAAQ,CAAA;IACR,yDAAgB,CAAA;IAChB,+CAAW,CAAA;IACX,uCAAO,CAAA;AACR,CAAC,EATiB,SAAS,KAAT,SAAS,QAS1B;AAED,MAAM,CAAN,IAAkB,kBAKjB;AALD,WAAkB,kBAAkB;IACnC,6DAAS,CAAA;IACT,uEAAc,CAAA;IACd,2EAAgB,CAAA;IAChB,+FAA0B,CAAA;AAC3B,CAAC,EALiB,kBAAkB,KAAlB,kBAAkB,QAKnC;AAk8CD,MAAM,CAAN,IAAY,qBAKX;AALD,WAAY,qBAAqB;IAChC,iEAAQ,CAAA;IACR,6EAAc,CAAA;IACd,yEAAY,CAAA;IACZ,6EAAc,CAAA;AACf,CAAC,EALW,qBAAqB,KAArB,qBAAqB,QAKhC"}
|
package/package.json
CHANGED
package/src/additionalInfo.ts
CHANGED
|
@@ -1939,7 +1939,7 @@ type SoLdDescriptorFilterItem = {
|
|
|
1939
1939
|
_name: 'Curves';
|
|
1940
1940
|
_classID: 'Crvs';
|
|
1941
1941
|
presetKind: string; // 'presetKindType.presetKindCustom';
|
|
1942
|
-
Adjs
|
|
1942
|
+
Adjs?: {
|
|
1943
1943
|
_name: '';
|
|
1944
1944
|
_classID: 'CrvA';
|
|
1945
1945
|
Chnl: string[]; // 'Chnl.Cmps' | 'Chnl.Rd ' | 'Chnl.Grn ' | 'Chnl.Bl '
|
|
@@ -1947,6 +1947,17 @@ type SoLdDescriptorFilterItem = {
|
|
|
1947
1947
|
Mpng?: number[];
|
|
1948
1948
|
}[];
|
|
1949
1949
|
};
|
|
1950
|
+
} | {
|
|
1951
|
+
filterID: 1231976050;
|
|
1952
|
+
} | {
|
|
1953
|
+
filterID: 1114793795;
|
|
1954
|
+
Fltr: {
|
|
1955
|
+
_name: 'Brightness/Contrast';
|
|
1956
|
+
_classID: 'BrgC';
|
|
1957
|
+
Brgh: number;
|
|
1958
|
+
Cntr: number;
|
|
1959
|
+
useLegacy: boolean;
|
|
1960
|
+
};
|
|
1950
1961
|
});
|
|
1951
1962
|
|
|
1952
1963
|
interface FilterCurvesCurvePoint {
|
|
@@ -2205,7 +2216,7 @@ function parseFilterFXItem(f: SoLdDescriptorFilterItem, options: ReadOptions): F
|
|
|
2205
2216
|
reduceColorNoise: parsePercent(f.Fltr.ClNs),
|
|
2206
2217
|
sharpenDetails: parsePercent(f.Fltr.Shrp),
|
|
2207
2218
|
channelDenoise: f.Fltr.channelDenoise.map(c => ({
|
|
2208
|
-
channels: c.Chnl.map(
|
|
2219
|
+
channels: c.Chnl.map(Chnl.decode),
|
|
2209
2220
|
amount: c.Amnt,
|
|
2210
2221
|
...(c.EdgF ? { preserveDetails: c.EdgF } : {}),
|
|
2211
2222
|
})),
|
|
@@ -2554,29 +2565,42 @@ function parseFilterFXItem(f: SoLdDescriptorFilterItem, options: ReadOptions): F
|
|
|
2554
2565
|
type: 'curves',
|
|
2555
2566
|
filter: {
|
|
2556
2567
|
presetKind: presetKindType.decode(f.Fltr.presetKind),
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2568
|
+
...(f.Fltr.Adjs ? {
|
|
2569
|
+
adjustments: f.Fltr.Adjs.map(a => {
|
|
2570
|
+
const channels = a.Chnl.map(Chnl.decode);
|
|
2571
|
+
if (a['Crv ']) {
|
|
2572
|
+
return {
|
|
2573
|
+
channels,
|
|
2574
|
+
curve: a['Crv '].map(c => {
|
|
2575
|
+
const point: { x: number; y: number; curved?: boolean; } = { x: c.Hrzn, y: c.Vrtc };
|
|
2576
|
+
if (c.Cnty) point.curved = true;
|
|
2577
|
+
return point;
|
|
2578
|
+
}),
|
|
2579
|
+
};
|
|
2580
|
+
} else if (a.Mpng) {
|
|
2581
|
+
return { channels, values: a.Mpng };
|
|
2582
|
+
} else {
|
|
2583
|
+
throw new Error(`Unknown curve adjustment`);
|
|
2584
|
+
}
|
|
2585
|
+
})
|
|
2586
|
+
} : {}),
|
|
2587
|
+
},
|
|
2588
|
+
};
|
|
2589
|
+
};
|
|
2590
|
+
case 'BrgC': {
|
|
2591
|
+
return {
|
|
2592
|
+
...base,
|
|
2593
|
+
type: 'brightness/contrast',
|
|
2594
|
+
filter: {
|
|
2595
|
+
brightness: f.Fltr.Brgh,
|
|
2596
|
+
contrast: f.Fltr.Cntr,
|
|
2597
|
+
useLegacy: !!f.Fltr.useLegacy,
|
|
2575
2598
|
},
|
|
2576
2599
|
};
|
|
2577
2600
|
};
|
|
2578
2601
|
default:
|
|
2579
2602
|
if (options.throwForMissingFeatures) {
|
|
2603
|
+
console.log('FILTER', require('util').inspect(f, false, 99, true));
|
|
2580
2604
|
throw new Error(`Unknown filter classId: ${(f as any).Fltr._classID}`);
|
|
2581
2605
|
}
|
|
2582
2606
|
return undefined;
|
|
@@ -2595,9 +2619,10 @@ function parseFilterFXItem(f: SoLdDescriptorFilterItem, options: ReadOptions): F
|
|
|
2595
2619
|
case 1181639749: return { ...base, type: 'find edges' };
|
|
2596
2620
|
case 1399616122: return { ...base, type: 'solarize' };
|
|
2597
2621
|
case 1314149187: return { ...base, type: 'ntsc colors' };
|
|
2622
|
+
case 1231976050: return { ...base, type: 'invert' }
|
|
2598
2623
|
default:
|
|
2599
2624
|
if (options.throwForMissingFeatures) {
|
|
2600
|
-
|
|
2625
|
+
console.log('FILTER', require('util').inspect(f, false, 99, true));
|
|
2601
2626
|
throw new Error(`Unknown filterID: ${(f as any).filterID}`);
|
|
2602
2627
|
}
|
|
2603
2628
|
}
|
|
@@ -3095,6 +3120,7 @@ function serializeFilterFXItem(f: Filter): SoLdDescriptorFilterItem {
|
|
|
3095
3120
|
filterID: 1148089458,
|
|
3096
3121
|
};
|
|
3097
3122
|
case 'ntsc colors': return { ...base, filterID: 1314149187 };
|
|
3123
|
+
case 'invert': return { ...base, filterID: 1231976050 };
|
|
3098
3124
|
case 'custom': return {
|
|
3099
3125
|
...base,
|
|
3100
3126
|
Fltr: {
|
|
@@ -3272,26 +3298,39 @@ function serializeFilterFXItem(f: Filter): SoLdDescriptorFilterItem {
|
|
|
3272
3298
|
_name: 'Curves',
|
|
3273
3299
|
_classID: 'Crvs',
|
|
3274
3300
|
presetKind: presetKindType.encode(f.filter.presetKind),
|
|
3275
|
-
|
|
3276
|
-
|
|
3277
|
-
_classID: 'CrvA',
|
|
3278
|
-
Chnl: a.channels.map(c => Chnl.encode(c)),
|
|
3279
|
-
'Crv ': a.curve.map(c => ({
|
|
3301
|
+
...(f.filter.adjustments ? {
|
|
3302
|
+
Adjs: f.filter.adjustments.map(a => 'curve' in a ? {
|
|
3280
3303
|
_name: '',
|
|
3281
|
-
_classID: '
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3304
|
+
_classID: 'CrvA',
|
|
3305
|
+
Chnl: a.channels.map(Chnl.encode),
|
|
3306
|
+
'Crv ': a.curve.map(c => ({
|
|
3307
|
+
_name: '',
|
|
3308
|
+
_classID: 'Pnt ',
|
|
3309
|
+
Hrzn: c.x,
|
|
3310
|
+
Vrtc: c.y,
|
|
3311
|
+
...(c.curved ? { Cnty: true } : {}),
|
|
3312
|
+
}) as FilterCurvesCurvePoint),
|
|
3313
|
+
} : {
|
|
3314
|
+
_name: '',
|
|
3315
|
+
_classID: 'CrvA',
|
|
3316
|
+
Chnl: a.channels.map(Chnl.encode),
|
|
3317
|
+
Mpng: a.values,
|
|
3318
|
+
})
|
|
3319
|
+
} : {}),
|
|
3292
3320
|
},
|
|
3293
3321
|
filterID: 1131574899,
|
|
3294
3322
|
};
|
|
3323
|
+
case 'brightness/contrast': return {
|
|
3324
|
+
...base,
|
|
3325
|
+
Fltr: {
|
|
3326
|
+
_name: 'Brightness/Contrast',
|
|
3327
|
+
_classID: 'BrgC',
|
|
3328
|
+
Brgh: f.filter.brightness,
|
|
3329
|
+
Cntr: f.filter.contrast,
|
|
3330
|
+
useLegacy: !!f.filter.useLegacy,
|
|
3331
|
+
},
|
|
3332
|
+
filterID: 1114793795,
|
|
3333
|
+
};
|
|
3295
3334
|
// case 'hsb/hsl': return {
|
|
3296
3335
|
// TODO: ...
|
|
3297
3336
|
// };
|
package/src/psd.ts
CHANGED
|
@@ -1161,7 +1161,7 @@ type FilterVariant = {
|
|
|
1161
1161
|
type: 'curves';
|
|
1162
1162
|
filter: {
|
|
1163
1163
|
presetKind: 'custom' | 'default';
|
|
1164
|
-
adjustments
|
|
1164
|
+
adjustments?: ({
|
|
1165
1165
|
channels: ('composite' | 'red' | 'green' | 'blue')[];
|
|
1166
1166
|
curve: { x: number; y: number; curved?: boolean; }[];
|
|
1167
1167
|
} | {
|
|
@@ -1169,6 +1169,15 @@ type FilterVariant = {
|
|
|
1169
1169
|
values: number[];
|
|
1170
1170
|
})[];
|
|
1171
1171
|
};
|
|
1172
|
+
} | {
|
|
1173
|
+
type: 'invert';
|
|
1174
|
+
} | {
|
|
1175
|
+
type: 'brightness/contrast';
|
|
1176
|
+
filter: {
|
|
1177
|
+
brightness: number;
|
|
1178
|
+
contrast: number;
|
|
1179
|
+
useLegacy: boolean;
|
|
1180
|
+
};
|
|
1172
1181
|
};
|
|
1173
1182
|
|
|
1174
1183
|
/*
|