ag-psd 14.3.10 → 14.3.13
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/CHANGELOG.md +15 -0
- package/README.md +12 -2
- package/README_PSD.md +729 -0
- package/TODO +4 -0
- package/dist/additionalInfo.js +1 -3
- package/dist/bundle.js +26 -12
- package/dist/imageResources.js +12 -7
- package/dist/initializeCanvas.js +13 -5
- package/dist/jpeg.d.ts +1 -0
- package/dist/jpeg.js +1023 -0
- package/dist/psd.js +1 -1
- package/dist/psdReader.js +6 -1
- package/dist/psdWriter.js +11 -5
- package/dist-es/additionalInfo.js +1 -3
- package/dist-es/imageResources.js +12 -7
- package/dist-es/initializeCanvas.js +14 -6
- package/dist-es/jpeg.d.ts +1 -0
- package/dist-es/jpeg.js +1019 -0
- package/dist-es/psd.js +1 -1
- package/dist-es/psdReader.js +6 -1
- package/dist-es/psdWriter.js +11 -5
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## v14.3.13
|
|
4
|
+
- Fixed handling files with incorrect channel image data length
|
|
5
|
+
|
|
6
|
+
## v14.3.11
|
|
7
|
+
- Fixed corrupted file when passing non-integer values to `layer.left`, `.top`, `.right`, `.bottom`
|
|
8
|
+
|
|
9
|
+
## v14.3.9
|
|
10
|
+
- Fixed reading some corrupted files
|
|
11
|
+
|
|
12
|
+
## v14.3.8
|
|
13
|
+
- Fixed handling files with incorrect section sizes
|
|
14
|
+
|
|
15
|
+
## v14.3.6
|
|
16
|
+
- Fixed incorrect writing of `vogk` section in some cases resulting in a broken file
|
|
17
|
+
|
|
3
18
|
## v14.3.6
|
|
4
19
|
- Fixed incorrect writing of `vogk` section in some cases resulting in a broken file
|
|
5
20
|
|
package/README.md
CHANGED
|
@@ -34,6 +34,8 @@ npm install ag-psd
|
|
|
34
34
|
|
|
35
35
|
## Usage
|
|
36
36
|
|
|
37
|
+
Description of the structure of Psd object used by `readPsd` and `writePsd` functions can be found in our [PSD Readme document](/README_PSD.md)
|
|
38
|
+
|
|
37
39
|
### Functions
|
|
38
40
|
|
|
39
41
|
```ts
|
|
@@ -380,9 +382,11 @@ Below is a simple example of document structure returned from `readPsd`. You can
|
|
|
380
382
|
}
|
|
381
383
|
```
|
|
382
384
|
|
|
383
|
-
|
|
385
|
+
## Modifying documents
|
|
386
|
+
|
|
387
|
+
General approach with `ag-psd` to modifying documents is to read the document, apply the updates and write the document back.
|
|
384
388
|
|
|
385
|
-
If you read and write the same document, image data can get corrupted by automatic alpha channel pre-multiplication that happens when you load data into the canvas element. To avoid that use raw image data, set `useImageData` option to `true` in `ReadOptions`. You can also use `useRawThumbnail` option to
|
|
389
|
+
If you read and write the same document, image data can get corrupted by automatic alpha channel pre-multiplication that happens when you load data into the canvas element. To avoid that, use raw image data, set `useImageData` option to `true` in `ReadOptions`. You can also use `useRawThumbnail` option to avoid any changes to thumbnail image.
|
|
386
390
|
|
|
387
391
|
```js
|
|
388
392
|
const psd = readPsd(inputBuffer, { useImageData: true });
|
|
@@ -392,6 +396,12 @@ const psd = readPsd(inputBuffer, { useImageData: true });
|
|
|
392
396
|
const outuptBuffer = writePsd(psd);
|
|
393
397
|
```
|
|
394
398
|
|
|
399
|
+
Updating general properties that don't have visual impact on the canvas, like printing info or layer name will work correctly without any extra work.
|
|
400
|
+
|
|
401
|
+
This library does NOT generate new composite canvas based on the layer data, so changing layer order, adding or removing layers or changing layer canvas data, or blending mode, or any other property that has visual impact on the canvas will cause the composite image and thumbnail to not be valid anymore. If you need composite image or thumbnail to be correct you need to update them yourself by updating `psd.canvas` or `psd.imageData` and `psd.imageResources.thumbnail` or `psd.imageResources.thumbnailRaw` fields. Composite image data is not required for PSD file to be readble in Photoshop so leaving old version or removing it completely may be good option. Thumbnail is only necessary for file preview in programs like Adobe Bridge or File Explorer, if you don't need to support that you can skip thumbnail as well.
|
|
402
|
+
|
|
403
|
+
This library also does NOT generate new layer canvas based on layer settings, so if you're changing any layer properties, that impact layer bitmap, you also need to update `layer.canvas` or `layer.imageData`. This includes: text layer properties, vector layer properties, smart object, etc. (this does not include layer blending options)
|
|
404
|
+
|
|
395
405
|
### Writing text layers
|
|
396
406
|
|
|
397
407
|
```js
|