cortico-world-ellen-voice 0.2.0 → 0.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/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.1
4
+
5
+ - PNG 解码补齐灰度+透明(colorType 4),之前这类截图会直接报「不支持的颜色类型 4」。
6
+ - 修正 0.2.0 教程里没提到的导出建议:Photoshop「导出为 PNG-24」或「另存为 PNG」都可,不要用 8 位索引色+透明。
7
+
3
8
  ## 0.2.0
4
9
 
5
10
  - 新增 `ellen_install_figure`:把一张透明底 PNG 立绘装成 Coopanion 形象包(自动生成 figure.json、
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cortico-world-ellen-voice",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "type": "module",
5
5
  "description": "Ellen Joe voice world for Coopanion: speak through a local GPT-SoVITS service, deliver voice bars to QQ, and install a figure pack from your own PNG",
6
6
  "author": "deepseek study",
package/src/png.ts CHANGED
@@ -83,7 +83,7 @@ export function decodePng(input: Uint8Array): RgbaImage {
83
83
  if (interlace !== 0) throw new Error('不支持隔行 PNG(Adam7),请用普通模式重新导出');
84
84
  if (bitDepth !== 8 && bitDepth !== 16) throw new Error(`不支持的位深 ${bitDepth}`);
85
85
 
86
- const channels = colorType === 6 ? 4 : colorType === 2 ? 3 : colorType === 0 ? 1 : colorType === 3 ? 1 : 0;
86
+ const channels = colorType === 6 ? 4 : colorType === 2 ? 3 : colorType === 4 ? 2 : colorType === 0 ? 1 : colorType === 3 ? 1 : 0;
87
87
  if (!channels) throw new Error(`不支持的颜色类型 ${colorType}`);
88
88
 
89
89
  const bytesPerSample = bitDepth / 8;
@@ -125,6 +125,8 @@ export function decodePng(input: Uint8Array): RgbaImage {
125
125
  r = line[src]; g = line[src + bytesPerSample]; b = line[src + bytesPerSample * 2];
126
126
  } else if (colorType === 0) {
127
127
  r = line[src]; g = r; b = r;
128
+ } else if (colorType === 4) {
129
+ r = line[src]; g = r; b = r; alpha = line[src + bytesPerSample];
128
130
  } else if (colorType === 3 && palette) {
129
131
  const index = line[src];
130
132
  r = palette[index * 3] ?? 0;