ag-psd 28.1.1 → 28.2.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-es/psd.d.ts CHANGED
@@ -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;
@@ -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;AAy7CD,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"}
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ag-psd",
3
- "version": "28.1.1",
3
+ "version": "28.2.0",
4
4
  "description": "Library for reading and writing PSD files",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist-es/index.js",
@@ -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 {
@@ -2575,8 +2586,20 @@ function parseFilterFXItem(f: SoLdDescriptorFilterItem, options: ReadOptions): F
2575
2586
  },
2576
2587
  };
2577
2588
  };
2589
+ case 'BrgC': {
2590
+ return {
2591
+ ...base,
2592
+ type: 'brightness/contrast',
2593
+ filter: {
2594
+ brightness: f.Fltr.Brgh,
2595
+ contrast: f.Fltr.Cntr,
2596
+ useLegacy: !!f.Fltr.useLegacy,
2597
+ },
2598
+ };
2599
+ };
2578
2600
  default:
2579
2601
  if (options.throwForMissingFeatures) {
2602
+ console.log('FILTER', require('util').inspect(f, false, 99, true));
2580
2603
  throw new Error(`Unknown filter classId: ${(f as any).Fltr._classID}`);
2581
2604
  }
2582
2605
  return undefined;
@@ -2595,9 +2618,10 @@ function parseFilterFXItem(f: SoLdDescriptorFilterItem, options: ReadOptions): F
2595
2618
  case 1181639749: return { ...base, type: 'find edges' };
2596
2619
  case 1399616122: return { ...base, type: 'solarize' };
2597
2620
  case 1314149187: return { ...base, type: 'ntsc colors' };
2621
+ case 1231976050: return { ...base, type: 'invert' }
2598
2622
  default:
2599
2623
  if (options.throwForMissingFeatures) {
2600
- // console.log('FILTER', require('util').inspect(f, false, 99, true));
2624
+ console.log('FILTER', require('util').inspect(f, false, 99, true));
2601
2625
  throw new Error(`Unknown filterID: ${(f as any).filterID}`);
2602
2626
  }
2603
2627
  }
@@ -3095,6 +3119,7 @@ function serializeFilterFXItem(f: Filter): SoLdDescriptorFilterItem {
3095
3119
  filterID: 1148089458,
3096
3120
  };
3097
3121
  case 'ntsc colors': return { ...base, filterID: 1314149187 };
3122
+ case 'invert': return { ...base, filterID: 1231976050 };
3098
3123
  case 'custom': return {
3099
3124
  ...base,
3100
3125
  Fltr: {
@@ -3292,6 +3317,17 @@ function serializeFilterFXItem(f: Filter): SoLdDescriptorFilterItem {
3292
3317
  },
3293
3318
  filterID: 1131574899,
3294
3319
  };
3320
+ case 'brightness/contrast': return {
3321
+ ...base,
3322
+ Fltr: {
3323
+ _name: 'Brightness/Contrast',
3324
+ _classID: 'BrgC',
3325
+ Brgh: f.filter.brightness,
3326
+ Cntr: f.filter.contrast,
3327
+ useLegacy: !!f.filter.useLegacy,
3328
+ },
3329
+ filterID: 1114793795,
3330
+ };
3295
3331
  // case 'hsb/hsl': return {
3296
3332
  // TODO: ...
3297
3333
  // };
package/src/psd.ts CHANGED
@@ -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
  /*