ag-psd 32.0.0 → 34.0.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/.v8-cache/v24.7.0-x64-ef5a0af0/03e19709 +0 -0
- package/.v8-cache/v24.7.0-x64-ef5a0af0/05135617 +0 -0
- package/.v8-cache/v24.7.0-x64-ef5a0af0/1130885f +0 -0
- package/.v8-cache/v24.7.0-x64-ef5a0af0/226e2801 +0 -0
- package/.v8-cache/v24.7.0-x64-ef5a0af0/2a19133e +0 -0
- package/.v8-cache/v24.7.0-x64-ef5a0af0/4511bacf +0 -0
- package/.v8-cache/v24.7.0-x64-ef5a0af0/68416cb2 +0 -0
- package/.v8-cache/v24.7.0-x64-ef5a0af0/71df9cb3 +0 -0
- package/.v8-cache/v24.7.0-x64-ef5a0af0/7ea06cea +0 -0
- package/.v8-cache/v24.7.0-x64-ef5a0af0/87cf2209 +0 -0
- package/.v8-cache/v24.7.0-x64-ef5a0af0/932f0770 +0 -0
- package/.v8-cache/v24.7.0-x64-ef5a0af0/acc36e66 +0 -0
- package/.v8-cache/v24.7.0-x64-ef5a0af0/b3c2fab7 +0 -0
- package/.v8-cache/v24.7.0-x64-ef5a0af0/c0b789d2 +0 -0
- package/.v8-cache/v24.7.0-x64-ef5a0af0/c314aece +0 -0
- package/.v8-cache/v24.7.0-x64-ef5a0af0/cfc49f4f +0 -0
- package/.v8-cache/v24.7.0-x64-ef5a0af0/cff9434a +0 -0
- package/.v8-cache/v24.7.0-x64-ef5a0af0/d13d7610 +0 -0
- package/.v8-cache/v24.7.0-x64-ef5a0af0/dc86f000 +0 -0
- package/.v8-cache/v24.7.0-x64-ef5a0af0/e03e2acd +0 -0
- package/.v8-cache/v24.7.0-x64-ef5a0af0/e6745c2b +0 -0
- package/.v8-cache/v24.7.0-x64-ef5a0af0/e6b99945 +0 -0
- package/.v8-cache/v24.7.0-x64-ef5a0af0/eeeebdfe +0 -0
- package/.v8-cache/v24.7.0-x64-ef5a0af0/f6fd8125 +0 -0
- package/CHANGELOG.md +100 -0
- package/LICENSE +5 -0
- package/README.md +4 -7
- package/README_PSD.md +261 -84
- package/TODO.md +13 -84
- package/dist/abr.d.ts +11 -4
- package/dist/abr.js +362 -230
- package/dist/abr.js.map +1 -1
- package/dist/additionalInfo.d.ts +56 -2
- package/dist/additionalInfo.js +828 -361
- package/dist/additionalInfo.js.map +1 -1
- package/dist/ase.d.ts +6 -1
- package/dist/ase.js +61 -61
- package/dist/ase.js.map +1 -1
- package/dist/bundle.js +3321 -1364
- package/dist/descriptor.d.ts +28 -13
- package/dist/descriptor.js +295 -241
- package/dist/descriptor.js.map +1 -1
- package/dist/helpers.d.ts +7 -1
- package/dist/helpers.js +246 -4
- package/dist/helpers.js.map +1 -1
- package/dist/imageResources.d.ts +15 -3
- package/dist/imageResources.js +586 -144
- package/dist/imageResources.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/jpeg.js +8 -8
- package/dist/jpeg.js.map +1 -1
- package/dist/psd.d.ts +292 -19
- package/dist/psd.js.map +1 -1
- package/dist/psdReader.d.ts +10 -0
- package/dist/psdReader.js +424 -216
- package/dist/psdReader.js.map +1 -1
- package/dist/psdWriter.d.ts +2 -0
- package/dist/psdWriter.js +373 -113
- package/dist/psdWriter.js.map +1 -1
- package/dist/text.d.ts +32 -1
- package/dist/text.js +75 -6
- package/dist/text.js.map +1 -1
- package/dist/utf8.js +0 -3
- package/dist/utf8.js.map +1 -1
- package/dist-es/abr.d.ts +11 -4
- package/dist-es/abr.js +362 -230
- package/dist-es/abr.js.map +1 -1
- package/dist-es/additionalInfo.d.ts +56 -2
- package/dist-es/additionalInfo.js +828 -361
- package/dist-es/additionalInfo.js.map +1 -1
- package/dist-es/ase.d.ts +6 -1
- package/dist-es/ase.js +61 -61
- package/dist-es/ase.js.map +1 -1
- package/dist-es/descriptor.d.ts +28 -13
- package/dist-es/descriptor.js +295 -241
- package/dist-es/descriptor.js.map +1 -1
- package/dist-es/helpers.d.ts +7 -1
- package/dist-es/helpers.js +246 -4
- package/dist-es/helpers.js.map +1 -1
- package/dist-es/imageResources.d.ts +15 -3
- package/dist-es/imageResources.js +586 -144
- package/dist-es/imageResources.js.map +1 -1
- package/dist-es/index.d.ts +1 -0
- package/dist-es/index.js +1 -0
- package/dist-es/index.js.map +1 -1
- package/dist-es/jpeg.js +8 -8
- package/dist-es/jpeg.js.map +1 -1
- package/dist-es/psd.d.ts +292 -19
- package/dist-es/psd.js.map +1 -1
- package/dist-es/psdReader.d.ts +10 -0
- package/dist-es/psdReader.js +424 -216
- package/dist-es/psdReader.js.map +1 -1
- package/dist-es/psdWriter.d.ts +2 -0
- package/dist-es/psdWriter.js +373 -113
- package/dist-es/psdWriter.js.map +1 -1
- package/dist-es/text.d.ts +32 -1
- package/dist-es/text.js +75 -6
- package/dist-es/text.js.map +1 -1
- package/dist-es/utf8.js +0 -3
- package/dist-es/utf8.js.map +1 -1
- package/package.json +2 -2
- package/perf.js +312 -9
- package/src/abr.ts +382 -235
- package/src/additionalInfo.ts +1071 -482
- package/src/ase.ts +66 -61
- package/src/descriptor.ts +291 -242
- package/src/helpers.ts +266 -3
- package/src/imageResources.ts +736 -169
- package/src/index.ts +1 -0
- package/src/jpeg.ts +8 -8
- package/src/psd.ts +271 -32
- package/src/psdReader.ts +440 -221
- package/src/psdWriter.ts +402 -110
- package/src/text.ts +93 -7
- package/src/utf8.ts +0 -4
package/dist-es/ase.d.ts
CHANGED
|
@@ -29,4 +29,9 @@ export interface AseGroup {
|
|
|
29
29
|
export interface Ase {
|
|
30
30
|
colors: (AseGroup | AseColor)[];
|
|
31
31
|
}
|
|
32
|
-
export
|
|
32
|
+
export interface ReadAseOptions {
|
|
33
|
+
logMissingFeatures?: boolean;
|
|
34
|
+
/** Throw on unsupported or invalid blocks instead of skipping them */
|
|
35
|
+
throwForMissingFeatures?: boolean;
|
|
36
|
+
}
|
|
37
|
+
export declare function readAse(buffer: ArrayBufferView, options?: ReadAseOptions): Ase;
|
package/dist-es/ase.js
CHANGED
|
@@ -2,83 +2,83 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.readAse = readAse;
|
|
4
4
|
const psdReader_1 = require("./psdReader");
|
|
5
|
-
function readAse(buffer) {
|
|
5
|
+
function readAse(buffer, options = {}) {
|
|
6
6
|
const reader = (0, psdReader_1.createReader)(buffer.buffer, buffer.byteOffset, buffer.byteLength);
|
|
7
7
|
const signature = (0, psdReader_1.readSignature)(reader); // ASEF
|
|
8
8
|
if (signature !== 'ASEF')
|
|
9
9
|
throw new Error('Invalid signature');
|
|
10
10
|
const versionMajor = (0, psdReader_1.readUint16)(reader); // 1
|
|
11
|
-
|
|
12
|
-
if (versionMajor !== 1
|
|
11
|
+
(0, psdReader_1.readUint16)(reader); // minor version: 0
|
|
12
|
+
if (versionMajor !== 1)
|
|
13
13
|
throw new Error('Invalid version');
|
|
14
14
|
const blocksCount = (0, psdReader_1.readUint32)(reader);
|
|
15
|
-
const colorTypes = ['global', 'spot', 'normal'];
|
|
16
15
|
const ase = { colors: [] };
|
|
17
16
|
let group = ase;
|
|
18
|
-
for (let i = 0; i < blocksCount; i++) {
|
|
17
|
+
for (let i = 0; i < blocksCount && reader.offset + 6 <= reader.view.byteLength; i++) {
|
|
19
18
|
const type = (0, psdReader_1.readUint16)(reader);
|
|
20
19
|
const length = (0, psdReader_1.readUint32)(reader);
|
|
21
|
-
const end = reader.offset + length;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
case 'CMYK':
|
|
38
|
-
color = {
|
|
39
|
-
c: (0, psdReader_1.readFloat32)(reader),
|
|
40
|
-
m: (0, psdReader_1.readFloat32)(reader),
|
|
41
|
-
y: (0, psdReader_1.readFloat32)(reader),
|
|
42
|
-
k: (0, psdReader_1.readFloat32)(reader),
|
|
43
|
-
type: colorTypes[(0, psdReader_1.readUint16)(reader)],
|
|
44
|
-
};
|
|
45
|
-
break;
|
|
46
|
-
case 'Gray':
|
|
47
|
-
color = {
|
|
48
|
-
k: (0, psdReader_1.readFloat32)(reader),
|
|
49
|
-
type: colorTypes[(0, psdReader_1.readUint16)(reader)],
|
|
50
|
-
};
|
|
51
|
-
break;
|
|
52
|
-
case 'LAB ':
|
|
53
|
-
color = {
|
|
54
|
-
l: (0, psdReader_1.readFloat32)(reader),
|
|
55
|
-
a: (0, psdReader_1.readFloat32)(reader),
|
|
56
|
-
b: (0, psdReader_1.readFloat32)(reader),
|
|
57
|
-
type: colorTypes[(0, psdReader_1.readUint16)(reader)],
|
|
58
|
-
};
|
|
59
|
-
break;
|
|
60
|
-
default:
|
|
61
|
-
throw new Error('Invalid color mode');
|
|
20
|
+
const end = Math.min(reader.offset + length, reader.view.byteLength);
|
|
21
|
+
// block reader, so invalid lengths can't make us read data of following blocks
|
|
22
|
+
const block = (0, psdReader_1.createReader)(reader.view.buffer, reader.view.byteOffset + reader.offset, end - reader.offset);
|
|
23
|
+
try {
|
|
24
|
+
switch (type) {
|
|
25
|
+
case 0x0001: { // color
|
|
26
|
+
const color = readAseColor(block);
|
|
27
|
+
if (color) {
|
|
28
|
+
group.colors.push(color);
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
if (options.throwForMissingFeatures)
|
|
32
|
+
throw new Error('Unsupported color mode');
|
|
33
|
+
options.logMissingFeatures && reader.log('Skipped color with unsupported color mode');
|
|
34
|
+
}
|
|
35
|
+
break;
|
|
62
36
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
37
|
+
case 0xC001: { // group start
|
|
38
|
+
const nameLength = (0, psdReader_1.readUint16)(block);
|
|
39
|
+
const name = (0, psdReader_1.readUnicodeStringWithLength)(block, nameLength);
|
|
40
|
+
ase.colors.push(group = { name, colors: [] });
|
|
41
|
+
break;
|
|
42
|
+
}
|
|
43
|
+
case 0xC002: // group end
|
|
44
|
+
group = ase;
|
|
45
|
+
break;
|
|
46
|
+
default:
|
|
47
|
+
if (options.throwForMissingFeatures)
|
|
48
|
+
throw new Error(`Invalid block type: ${type}`);
|
|
49
|
+
options.logMissingFeatures && reader.log(`Skipped unknown block type: ${type}`);
|
|
73
50
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
51
|
+
}
|
|
52
|
+
catch (e) {
|
|
53
|
+
if (options.throwForMissingFeatures)
|
|
54
|
+
throw e;
|
|
55
|
+
options.logMissingFeatures && reader.log(`Skipped invalid block: ${e.message}`);
|
|
79
56
|
}
|
|
80
57
|
reader.offset = end;
|
|
81
58
|
}
|
|
82
59
|
return ase;
|
|
83
60
|
}
|
|
61
|
+
function readAseColor(reader) {
|
|
62
|
+
const nameLength = (0, psdReader_1.readUint16)(reader);
|
|
63
|
+
const name = (0, psdReader_1.readUnicodeStringWithLength)(reader, nameLength);
|
|
64
|
+
const colorMode = (0, psdReader_1.readSignature)(reader);
|
|
65
|
+
// NaN and infinite values are replaced with 0
|
|
66
|
+
const value = () => {
|
|
67
|
+
const v = (0, psdReader_1.readFloat32)(reader);
|
|
68
|
+
return isFinite(v) ? v : 0;
|
|
69
|
+
};
|
|
70
|
+
// color type is sometimes missing, unknown types are treated as process (normal) colors
|
|
71
|
+
const colorType = () => {
|
|
72
|
+
const index = reader.offset + 2 <= reader.view.byteLength ? (0, psdReader_1.readUint16)(reader) : 2;
|
|
73
|
+
return colorTypes[index] || 'normal';
|
|
74
|
+
};
|
|
75
|
+
switch (colorMode) {
|
|
76
|
+
case 'RGB ': return { name, color: { r: value(), g: value(), b: value(), type: colorType() } };
|
|
77
|
+
case 'CMYK': return { name, color: { c: value(), m: value(), y: value(), k: value(), type: colorType() } };
|
|
78
|
+
case 'Gray': return { name, color: { k: value(), type: colorType() } };
|
|
79
|
+
case 'LAB ': return { name, color: { l: value(), a: value(), b: value(), type: colorType() } };
|
|
80
|
+
default: return undefined;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
const colorTypes = ['global', 'spot', 'normal'];
|
|
84
84
|
//# sourceMappingURL=ase.js.map
|
package/dist-es/ase.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ase.js","sourceRoot":"../src/","sources":["ase.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"ase.js","sourceRoot":"../src/","sources":["ase.ts"],"names":[],"mappings":";;AA2CA,0BAoDC;AA/FD,2CAAuI;AA2CvI,SAAgB,OAAO,CAAC,MAAuB,EAAE,UAA0B,EAAE;IAC3E,MAAM,MAAM,GAAG,IAAA,wBAAY,EAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,UAAU,CAAC,CAAC;IACjF,MAAM,SAAS,GAAG,IAAA,yBAAa,EAAC,MAAM,CAAC,CAAC,CAAC,OAAO;IAChD,IAAI,SAAS,KAAK,MAAM;QAAE,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;IAC/D,MAAM,YAAY,GAAG,IAAA,sBAAU,EAAC,MAAM,CAAC,CAAC,CAAC,IAAI;IAC7C,IAAA,sBAAU,EAAC,MAAM,CAAC,CAAC,CAAC,mBAAmB;IACvC,IAAI,YAAY,KAAK,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;IAC3D,MAAM,WAAW,GAAG,IAAA,sBAAU,EAAC,MAAM,CAAC,CAAC;IACvC,MAAM,GAAG,GAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;IAChC,IAAI,KAAK,GAAmB,GAAG,CAAC;IAEhC,KAAK,I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descriptor.d.ts
CHANGED
|
@@ -1,22 +1,26 @@
|
|
|
1
1
|
import { AntiAlias, BevelDirection, BevelStyle, BevelTechnique, BlendMode, Color, GlowSource, GlowTechnique, GradientStyle, InterpolationMethod, LayerEffectsInfo, LineAlignment, LineCapType, LineJoinType, Orientation, TextGridding, TimelineKeyInterpolation, TimelineTrack, TimelineTrackType, Units, UnitsBounds, UnitsValue, VectorContent, WarpStyle } from './psd';
|
|
2
2
|
import { PsdReader } from './psdReader';
|
|
3
3
|
import { PsdWriter } from './psdWriter';
|
|
4
|
-
|
|
4
|
+
interface Dict {
|
|
5
|
+
[key: string]: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const cameraRawFilterClassID = "Adobe Camera Raw Filter";
|
|
8
|
+
export declare const cameraRawFilterKeyTypes: Dict;
|
|
5
9
|
export declare function readAsciiStringOrClassId(reader: PsdReader): string;
|
|
6
10
|
export declare function writeAsciiStringOrClassId(writer: PsdWriter, value: string): void;
|
|
7
11
|
export declare function readDescriptorStructure(reader: PsdReader, includeClass: boolean): any;
|
|
12
|
+
export declare const outputSettingsRoot = "outputSettings";
|
|
8
13
|
export declare function writeDescriptorStructure(writer: PsdWriter, name: string, classId: string, value: any, root: string): void;
|
|
9
14
|
export interface DescriptorReferenceItem {
|
|
10
15
|
type: 'prop' | 'Clss' | 'Enmr' | 'rele' | 'Idnt' | 'indx' | 'name';
|
|
11
|
-
|
|
12
|
-
|
|
16
|
+
_name?: string;
|
|
17
|
+
_classID?: string;
|
|
13
18
|
keyID?: string;
|
|
14
19
|
typeID?: string;
|
|
15
20
|
enumValue?: string;
|
|
16
21
|
value?: string | number;
|
|
17
22
|
}
|
|
18
|
-
export declare function
|
|
19
|
-
export declare function pathSelectionStateToReference(items: string[]): any[];
|
|
23
|
+
export declare function pathSelectionStateToReference(items: string[]): DescriptorReferenceItem[];
|
|
20
24
|
export declare function writeClassStructure(writer: PsdWriter, name: string, classID: string): void;
|
|
21
25
|
export declare function readVersionAndDescriptor(reader: PsdReader, includeClass?: boolean): any;
|
|
22
26
|
export declare function writeVersionAndDescriptor(writer: PsdWriter, name: string, classID: string, descriptor: any, root?: string): void;
|
|
@@ -70,8 +74,8 @@ export type DesciptorGradient = {
|
|
|
70
74
|
GrdF: 'GrdF.CstS';
|
|
71
75
|
Intr: number;
|
|
72
76
|
Clrs: {
|
|
73
|
-
'Clr '
|
|
74
|
-
Type
|
|
77
|
+
'Clr '?: DescriptorColor;
|
|
78
|
+
Type?: string;
|
|
75
79
|
Lctn: number;
|
|
76
80
|
Mdpn: number;
|
|
77
81
|
}[];
|
|
@@ -112,9 +116,11 @@ export interface DescriptorPatternContent {
|
|
|
112
116
|
Ptrn: DesciptorPattern;
|
|
113
117
|
Lnkd?: boolean;
|
|
114
118
|
phase?: {
|
|
115
|
-
Hrzn: number;
|
|
116
|
-
Vrtc: number;
|
|
119
|
+
Hrzn: number | DescriptorUnitsValue;
|
|
120
|
+
Vrtc: number | DescriptorUnitsValue;
|
|
117
121
|
};
|
|
122
|
+
'Scl '?: DescriptorUnitsValue;
|
|
123
|
+
Angl?: DescriptorUnitsValue;
|
|
118
124
|
}
|
|
119
125
|
export type DescriptorVectorContent = DescriptorColorContent | DescriptorGradientContent | DescriptorPatternContent;
|
|
120
126
|
export interface StrokeDescriptor {
|
|
@@ -375,10 +381,10 @@ export interface LmfxDescriptor {
|
|
|
375
381
|
ChFX?: EffectDescriptor;
|
|
376
382
|
numModifyingFX?: number;
|
|
377
383
|
}
|
|
378
|
-
export declare function serializeEffects(e: LayerEffectsInfo,
|
|
379
|
-
export declare function parseEffects(info: Lfx2Descriptor & LmfxDescriptor,
|
|
380
|
-
export declare function parseTrackList(trackList: TimelineTrackDescriptor[],
|
|
381
|
-
export declare function serializeTrackList(tracks: TimelineTrack[]): TimelineTrackDescriptor[];
|
|
384
|
+
export declare function serializeEffects(e: LayerEffectsInfo, writer: PsdWriter, multi: boolean): Lfx2Descriptor & LmfxDescriptor;
|
|
385
|
+
export declare function parseEffects(info: Lfx2Descriptor & LmfxDescriptor, reader: PsdReader): LayerEffectsInfo;
|
|
386
|
+
export declare function parseTrackList(trackList: TimelineTrackDescriptor[], reader: PsdReader): TimelineTrack[];
|
|
387
|
+
export declare function serializeTrackList(tracks: TimelineTrack[], writer: PsdWriter): TimelineTrackDescriptor[];
|
|
382
388
|
export declare function parseVectorContent(descriptor: DescriptorVectorContent): VectorContent;
|
|
383
389
|
export declare function serializeVectorContent(content: VectorContent): {
|
|
384
390
|
descriptor: DescriptorVectorContent;
|
|
@@ -456,6 +462,10 @@ export declare const gradientInterpolationMethodType: {
|
|
|
456
462
|
decode: (val: string) => InterpolationMethod;
|
|
457
463
|
encode: (val: InterpolationMethod | undefined) => string;
|
|
458
464
|
};
|
|
465
|
+
export declare const Clry: {
|
|
466
|
+
decode: (val: string) => "background" | "user" | "foreground";
|
|
467
|
+
encode: (val: "background" | "user" | "foreground" | undefined) => string;
|
|
468
|
+
};
|
|
459
469
|
export declare const ClrS: {
|
|
460
470
|
decode: (val: string) => "rgb" | "hsb" | "lab" | "hsl";
|
|
461
471
|
encode: (val: "rgb" | "hsb" | "lab" | "hsl" | undefined) => string;
|
|
@@ -612,3 +622,8 @@ export declare const presetKindType: {
|
|
|
612
622
|
decode: (val: string) => "default" | "custom";
|
|
613
623
|
encode: (val: "default" | "custom" | undefined) => string;
|
|
614
624
|
};
|
|
625
|
+
export declare const patternColorHandling: {
|
|
626
|
+
decode: (val: string) => "convert" | "avoid conversion" | "luminance only";
|
|
627
|
+
encode: (val: "convert" | "avoid conversion" | "luminance only" | undefined) => string;
|
|
628
|
+
};
|
|
629
|
+
export {};
|