Communitygithub.com

JantonioFC/skillsbank

photopea.js を使用して Photopea をウェブアプリに埋め込みます。埋め込み、ファイル入出力、スクリプト処理、エクスポート、レイヤー、テキスト、フィルター、Photoshop 互換のフル API をカバーします。

skillsbank とは?

このスキルは、photopea.js ライブラリを使用して Photopea 画像エディタをウェブアプリケーションに埋め込む方法を包括的に解説します。ブラウザベースの画像編集機能を製品に追加するための、実践的かつ完全な API リファレンスを提供します。スキルには、CDN または npm によるインストール手順、iframe の埋め込み(React の例を含む)、ファイルのオープン(ローカルファイル、リモート URL、Base64 データ URI)、JavaScript 文字列の実行による Photopea のプログラム制御、PNG/JPEG/WebP/PSD/SVG 形式での画像エクスポート、フォントやブラシなどのアセット読み込み、プラグインモードの設定が含まれます。対応プラットフォームとしては、Claude Code、Coder、Cursor、Copilot、Codex などの AI エージェントが想定されています。このスキールの核となるのは `photopea.js` ライブラリで、Photopea の postMessage ベースのライブメッセージング API を Promise ベースのインターフェースでラップし、生の postMessage を扱う複雑さを排除します。具体的なユースケースとしては、ファイルのオープンからエクスポートまでのUI、テキスト編集可能なテンプレート、透かしのバッチ処理などがあり、さらに Adobe Photoshop CC 2015 JavaScript スクリプティングインターフェースに準拠した、アプリケーションオブジェクト、ドキュメントオブジェクト、レイヤー、選択範囲、フィルターなどを含む完全なスクリプティング API リファレンスも提供します。手動で postMessage を配線するのではなく、常に `photopea.js` をラッパーとして使用することが強く推奨されています。

対応~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/JantonioFC/skillsbank/tree/HEAD/plugins/antigravity-awesome-skills-claude/skills/photopea-embedded-editor

お気に入りのAIに質問する

このエージェントスキルを事前に読み込んだ状態で新しいチャットを開きます。

ドキュメント

Photopea 埋め込みエディタースキル

ウェブサイトとアプリでの photopea.js (yikuansun/PhotopeaAPI) の使用


このスキルを使用するタイミング

このスキルは、以下を含むすべてのタスクに使用します:

  • Photopea を画像エディターとしてウェブページやウェブアプリに埋め込む
  • JavaScript コードから埋め込まれた Photopea インスタンスを制御する
  • ホストページからの画像編集ワークフローを自動化する(ファイルを開く、スクリプトを実行する、結果をエクスポートする)
  • Photopea をエンジンとして使用して、製品に画像編集機能を構築する
  • ドキュメント、レイヤー、テキスト、選択範囲、フィルター、色、パスを操作するスクリプトを作成する

生の postMessage を配線せず、必ず photopea.js をラッパーとして使用してください。


ライブラリ: photopea.js

photopea.js は、Photopea ライブメッセージング API をラップする Promise ベースの JavaScript ラッパーです。 リポジトリ: https://github.com/yikuansun/PhotopeaAPI npm パッケージ: https://www.npmjs.com/package/photopea

インストール

CDN(ビルドステップ不要)

<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/photopea.min.js"></script>

セルフホスト

<script src="./photopea.min.js"></script>

npm (Webpack / Vite / Rollup)

npm install photopea
import Photopea from "photopea";

コア API: Photopea クラス

メソッド説明
Photopea.createEmbed(container)iframe を作成して挿入し、準備ができたら解決する
new Photopea(window.parent)プラグインモード: 親ウィンドウをラップする
pea.runScript(script)Photopea 内で JS 文字列を実行し、出力配列を返す
pea.loadAsset(arrayBuffer)バイナリファイル(画像、フォント、ブラシなど)を読み込む
pea.openFromURL(url, asSmart)リモート URL を新しいドキュメントまたはスマートオブジェクトレイヤーとして開く
pea.exportImage(type)現在のドキュメントをエクスポートし、Blob("png" または "jpg")を返す

すべてのメソッドは Promise を返します。常に await または .then() を使用してください。


ステップ 1 — 埋め込み

コンテナ <div> は、createEmbed を呼び出す前に、固定の幅と高さを持っている必要があります。

<div id="editor" style="width:1000px; height:650px;"></div>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/photopea.min.js"></script>
<script>
  Photopea.createEmbed(document.getElementById("editor")).then(async (pea) => {
    // pea の準備完了
  });
</script>

React:

import { useEffect, useRef } from "react";
import Photopea from "photopea";

export default function Editor() {
  const containerRef = useRef(null);
  const peaRef       = useRef(null);

  useEffect(() => {
    if (!containerRef.current || peaRef.current) return;
    Photopea.createEmbed(containerRef.current).then((pea) => {
      peaRef.current = pea;
    });
  }, []);

  return <div ref={containerRef} style={{ width: "100%", height: "650px" }} />;
}

ステップ 2 — ファイルを開く

// リモート URL → 新しいドキュメント
await pea.openFromURL("https://example.com/design.psd", false);

// リモート URL → 現在のドキュメント内のスマートオブジェクトレイヤー
await pea.openFromURL("https://example.com/overlay.png", true);

// ローカルファイル(ユーザー入力 → ArrayBuffer → loadAsset)
document.getElementById("fileInput").addEventListener("change", async (e) => {
  const buf = await e.target.files[0].arrayBuffer();
  await pea.loadAsset(buf);
});

// runScript 経由の Base64 データ URI
await pea.runScript(`app.open("data:image/png;base64,iVBORw0...");`);

ステップ 3 — スクリプトの実行

runScript は JS 文字列を送信し、app.echoToOE(...) の値の配列と最後の "done" を返します。

const result = await pea.runScript(`app.echoToOE("hello");`);
// result → ["hello", "done"]

// 構造化データを返す
const out = await pea.runScript(`
  app.echoToOE(JSON.stringify({
    width:  app.activeDocument.width,
    height: app.activeDocument.height,
    layers: app.activeDocument.layers.length
  }));
`);
const info = JSON.parse(out[0]);

ステップ 4 — エクスポート

// PNG Blob (exportImage 経由)
const blob = await pea.exportImage("png");
document.getElementById("preview").src = URL.createObjectURL(blob);

// JPEG Blob
const blob = await pea.exportImage("jpg");

// saveToOE 経由の WebP / PSD / 品質指定 JPEG
const result = await pea.runScript(`app.activeDocument.saveToOE("webp:0.85");`);
const webpBlob = new Blob([result[0]], { type: "image/webp" });

const result = await pea.runScript(`app.activeDocument.saveToOE("psd:true");`);
const psdBlob  = new Blob([result[0]], { type: "application/octet-stream" });

// ダウンロードをトリガー
async function download(pea, filename = "export.png") {
  const blob = await pea.exportImage("png");
  const a    = Object.assign(document.createElement("a"), {
    href:     URL.createObjectURL(blob),
    download: filename
  });
  a.click();
}

saveToOE のエクスポート形式文字列:

文字列形式
"png"PNG ロスレス
"jpg"JPEG デフォルト
"jpg:0.8"JPEG 品質 0.0–1.0
"webp:0.7"WebP 品質 0.0–1.0
"psd"完全な PSD
"psd:true"最小化された PSD
"svg:true"SVG

ステップ 5 — アセットの読み込み

// フォント
const buf = await (await fetch("https://example.com/MyFont.otf")).arrayBuffer();
await pea.loadAsset(buf);
// これで textItem.font で使用可能

// ブラシ
await pea.loadAsset(await (await fetch("Nature.ABR")).arrayBuffer());

// グラデーション
await pea.loadAsset(await (await fetch("Gradients.GRD")).arrayBuffer());

ステップ 6 — プラグインモード

// あなたのページが Photopea のサイドバー iframe 内にある場合
const pea = new Photopea(window.parent);

const out = await pea.runScript(`app.echoToOE(app.activeDocument.width);`);
console.log("Width:", out[0]);

// プラグインからアセットを読み込む
const buf = await (await fetch("https://my-assets.com/sticker.png")).arrayBuffer();
await pea.loadAsset(buf);

プラグイン設定:

{
  "environment": {
    "plugins": [{
      "name": "My Plugin",
      "url":  "https://my-plugin.example.com",
      "icon": "===https://my-plugin.example.com/icon.png"
    }]
  }
}

ユーティリティパターン

addImageAndWait — 堅牢な非同期レイヤー挿入

async function addImageAndWait(pea, imgURI) {
  let count = "done";
  while (count === "done")
    count = (await pea.runScript(`app.echoToOE(app.activeDocument.layers.length)`))[0];
  count = parseInt(count);

  const imageUrlLiteral = JSON.stringify(imgURI);
  await pea.runScript(`app.open(${imageUrlLiteral}, null, true);`);

  return new Promise((resolve) => {
    const check = async () => {
      const n = parseInt((await pea.runScript(
        `app.echoToOE(app.activeDocument.layers.length)`
      ))[0]);
      n === count + 1 ? resolve() : setTimeout(check, 50);
    };
    check();
  });
}

getDocumentAsImage — <img> 要素を返す

async function getDocumentAsImage(pea) {
  const result = await pea.runScript(`app.activeDocument.saveToOE('png')`);
  return new Promise((resolve) => {
    const fr = new FileReader();
    fr.addEventListener("load", (e) => {
      const img = new Image(); img.src = e.target.result; resolve(img);
    });
    fr.readAsDataURL(new Blob([result[0]], { type: "image/png" }));
  });
}

実世界のパターン

パターン A — オープン + エクスポート UI

<input type="file" id="fileInput" accept="image/*,.psd">
<button id="exportBtn">PNG エクスポート</button>
<div id="editor" style="width:100%;height:600px;"></div>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/photopea.min.js"></script>
<script>
let pea;
Photopea.createEmbed(document.getElementById("editor")).then(p => pea = p);

document.getElementById("fileInput").addEventListener("change", async e => {
  await pea.loadAsset(await e.target.files[0].arrayBuffer());
});
document.getElementById("exportBtn").addEventListener("click", async () => {
  const blob = await pea.exportImage("png");
  const a = Object.assign(document.createElement("a"), {
    href: URL.createObjectURL(blob), download: "export.png"
  });
  a.click();
});
</script>

パターン B — テンプレート + テキスト編集 + エクスポート

async function generateCard(pea, name, tagline) {
  await pea.openFromURL("https://example.com/card.psd", false);
  const nameLiteral = JSON.stringify(name);
  const taglineLiteral = JSON.stringify(tagline);
  await pea.runScript(`
    app.activeDocument.layers.getByName("Name").textItem.contents    = ${nameLiteral};
    app.activeDocument.layers.getByName("Tagline").textItem.contents = ${taglineLiteral};
  `);
  return await pea.exportImage("png");
}

パターン C — バッチ透かし

async function batchWatermark(pea, imageURLs, watermarkURL) {
  const results = [];
  for (const url of imageURLs) {
    await pea.openFromURL(url, false);
    await pea.openFromURL(watermarkURL, true);
    await pea.runScript(`
      var doc = app.activeDocument, wm = doc.activeLayer;
      wm.translate(doc.width - wm.bounds[2] - 20, doc.height - wm.bounds[3] - 20);
      wm.opacity = 70;
    `);
    results.push(await pea.exportImage("png"));
    await pea.runScript(`app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);`);
  }
  return results;
}

完全なスクリプティング API リファレンス

このセクションのすべてのコードは、pea.runScript("...") 文字列内で実行されます。 Photopea は、Adobe Photoshop CC 2015 JavaScript スクリプティングインターフェースを実装しています。 そのバージョンをターゲットにした Photoshop スクリプトは、Photopea で動作するはずです。


app — アプリケーションオブジェクト

プロパティ

プロパティ型R/W説明
app.activeDocumentDocumentR/W現在アクティブなドキュメント
app.documentsDocumentsR開いているすべてのドキュメントのコレクション
app.documents.lengthnumberR開いているドキュメントの数
app.documents[i]DocumentR0 から始まるインデックスでアクセス
app.foregroundColorSolidColorR/W現在の前景色
app.backgroundColorSolidColorR/W現在の背景色
app.preferences.rulerUnitsUnitsR/WUnits.PIXELS, Units.CM, Units.INCHES, Units.MM, Units.PICAS, Units.POINTS, Units.PERCENT
app.preferences.typeUnitsTypeUnitsR/WTypeUnits.PIXELS, TypeUnits.MM, TypeUnits.POINTS
app.displayDialogsDialogModesR/WDialogModes.NO, DialogModes.ALL, DialogModes.ERROR

メソッド

メソッド説明
app.open(url)URL を新しいドキュメントとして開く
app.open(url, null, true)URL をアクティブなドキュメントのスマートオブジェクトレイヤーとして開く
app.echoToOE(string)Photopea 拡張 — ホストページに文字列を送信する(runScript でキャプチャされる)
app.showWindow("magiccut")Photopea 拡張 — マジックカットパネルを開く
app.showWindow("vbitmap")Photopea 拡張 — ビットマップベクトル化パネルを開く
app.UI.zoomIn()ズームイン
app.UI.zoomOut()ズームアウト
app.UI.fitTheArea()キャンバスをビューポートに合わせる
app.UI.pixelToPixel()100% ズーム
app.UI.switchFullscreen()フルスクリーンの切り替え
app.UI.scroll(dx, dy)デルタ値でスクロール
app.UI.scrollTo(x, y)絶対位置にスクロール

重要: ピクセル測定を使用するスクリプトの先頭で、常にルーラーの単位をピクセルに設定してください:

var savedUnits = app.preferences.rulerUnits;
app.preferences.rulerUnits = Units.PIXELS;
// ... あなたのコード ...
app.preferences.rulerUnits = savedUnits;

Document — ドキュメントオブジェクト

app.activeDocument または app.documents[i] でアクセスします。

プロパティ

プロパティ型R/W説明
widthnumberR現在のルーラー単位でのドキュメントの幅
heightnumberR現在のルーラー単位でのドキュメントの高さ
resolutionnumberRDPI (1 インチあたりのピクセル数)
namestringR/WPhotopea 拡張 — 表示ラベル(履歴ステップなし)
sourcestringR/WPhotopea 拡張 — ファイルの起点 URL または "local,X,NAME"
modeDocumentModeRDocumentMode.RGB, GRAYSCALE, CMYK, LAB, BITMAP, INDEXEDCOLOR, MULTICHANNEL
bitsPerChannelBitsPerChannelTypeRBitsPerChannelType.EIGHT, SIXTEEN, THIRTYTWO
colorProfileNamestringR埋め込まれたカラープロファイルの名前
activeLayerLayer/ArtLayer/LayerSetR/Wレイヤーをアクティブにするために設定する
currentLayerArtLayerR/WactiveLayer のエイリアス
layersLayersRすべてのトップレベルレイヤー(アート + グループの両方)
artLayersArtLayersRトップレベルのアートレイヤーのみ
layerSetsLayerSetsRトップレベルのグループレイヤーのみ
selectionSelectionR現在の選択範囲
channelsChannelsRすべてのチャンネル
historyStatesHistoryStatesR元に戻す履歴
activeHistoryStateHistoryStateR/W現在の履歴位置
layerCompsLayerCompsRレイヤーコンポのコレクション
guidesGuidesRガイドのコレクション
pathItemsPathItemsRベクトルパス
idnumberR一意のドキュメント ID
savedbooleanRドキュメントに未保存の変更があるかどうか
quickMaskModebooleanRクイックマスクモードかどうか
backgroundLayerArtLayerR背景レイヤー
pixelAspectRationumberRカスタムピクセルアスペクト比 (0.1–10.0)
histogramarrayR256 要素のヒストグラム配列

メソッド

メソッドシグネチャ説明
resizeImage(w, h, res, resampleMethod)画像ピクセルをリサイズします。ResampleMethod: BICUBIC, BILINEAR, NEARESTNEIGHBOR, NONE, BICUBICSHARPER, BICUBICSMOOTHER
resizeCanvas(w, h, anchor)キャンバスをスケーリングせずにリサイズします。AnchorPosition: TOPLEFT, TOPCENTER, TOPRIGHT, MIDDLELEFT, MIDDLECENTER, MIDDLERIGHT, BOTTOMLEFT, BOTTOMCENTER, BOTTOMRIGHT
rotateCanvas(degrees)キャンバス全体を回転します。正の値 = 時計回り
flipCanvas(direction)Direction.HORIZONTAL または Direction.VERTICAL
crop([x1,y1,x2,y2], angle, w, h)キャンバスを切り抜きます。角度と寸法はオプションです
trim(trimType, top, left, bottom, right)透明ピクセルまたは特定の色に基づいてキャンバスをトリミングします
close(saveOptions)ドキュメントを閉じます。SaveOptions.DONOTSAVECHANGES, SAVECHANGES, PROMPTTOSAVECHANGES
saveToOE(formatString)Photopea 拡張 — ファイルをエクスポートし、ArrayBuffer を返します(runScript 経由)
flatten()すべてのレイヤーを平坦化します
mergeVisibleLayers()表示されているレイヤーをマージします
duplicate()ドキュメントのコピーを作成します
link(targetDoc)このドキュメントをもう一方にリンクします(リンクされたレイヤー編集用)
suspendHistory(name, script)単一の元に戻す履歴ステップとしてスクリプトを実行します
changeMode(changeMode)ChangeMode.CMYK, GRAYSCALE, BITMAP, INDEXEDCOLOR, MULTICHANNEL, RGB, LAB
convertProfile(destination, intent, blackPointComp, dither)カラープロファイルを変換します
paste()クリップボードの内容を新しいレイヤーとして貼り付けます
mergeAllLayers()すべてのレイヤーを 1 つに結合します

Layer — レイヤーオブジェクト

app.activeDocument.layers[i]、artLayers[i]、または layerSets[i] 経由でアクセスします。

プロパティ

プロパティ型R/W説明
namestringR/Wレイヤー名
visiblebooleanR/W表示/非表示
opacitynumberR/W不透明度 (0–100)
blendModeBlendModeR/Wブレンドモード: NORMAL, MULTIPLY, SCREEN, OVERLAY, DIFFERENCE, LIGHTEN, DARKEN, HUE, COLOR, LUMINOSITY, SATURATION, COLORDODGE, COLORBURN, SOFTLIGHT, HARDLIGHT, PINLIGHT, VIVIDLIGHT, LINEARDODGE, LINEARBURN, HARDMIX, LINEARLIGHT, DARKERCOLOR, LIGHTERCOLOR, DIVIDE, SUBTRACT, PASSTHROUGH
boundsarrayR境界ボックス [x1, y1, x2, y2] (ピクセル単位)
linkedLayersLayersRリンクされたレイヤー
parentLayerSetR親レイヤーセット(トップレベルレイヤーの場合は null)
groupedbooleanR/Wクリッピングマスク内でグループ化されているかどうか
allLockedbooleanR/Wすべてのロック
pixelsLockedbooleanR/Wピクセルロック
positionLockedbooleanR/W位置ロック
transparentPixelsLockedbooleanR/W透明ピクセルロック
isBackgroundLayerbooleanR背景レイヤーかどうか
idnumberR一意のレイヤー ID
layerMaskEnabledbooleanR/Wレイヤーマスクが有効かどうか
vectorMaskEnabledbooleanR/Wベクトルマスクが有効かどうか

メソッド (レイヤー)

メソッドシグネチャ説明
remove()レイヤーを削除します
duplicate(destDoc, name)このドキュメントまたは別のドキュメントにレイヤーを複製します
move(destDoc, ElementPlacement)レイヤーを別の場所に移動します。ElementPlacement.PLACEATBEGINNING, PLACEATEND, PLACEBEFORE, PLACEAFTER
resize(horiz, vert, anchor)レイヤーをパーセンテージでリサイズします(例: resize(150, 150) = 150%)
rotate(angle, anchor)度単位で回転します
translate(dx, dy)指定されたピクセル数だけ移動します
scale(relH, relV, anchor)resize のエイリアス
flip(direction)Direction.HORIZONTAL または Direction.VERTICAL
adjustFillOpacity(percent)塗りの不透明度をパーセンテージで調整します
link(layer)別のレイヤーにリンクします
unlink()すべてのリンクを解除します
applyGroup(name)選択したレイヤーを新しいグループにグループ化します
merge()下のレイヤーとマージします
createMask(maskType)MaskType.USERSAVE, VECTORSAVE, HIDESELECTION, REVEALALL, HIDEALL, REVEALSELECTION
enableOtherLayers()他のすべてのレイヤーを非表示にします
isAnyLocked()何かがロックされている場合は true を返します

ArtLayer — アートレイヤーオブジェクト

Document のすべてのプロパティに加えて:

プロパティ

プロパティ型R/W説明
kindLayerKindR/WNORMAL, TEXT, SMARTOBJECT, CLIPBOARD, PATTERN, GRADIENT, BRUSHSTROKE
textItemTextItemR/Wテキストレイヤーのテキストプロパティ
fillMethodFillMethodR/WSOLIDCOLOR, GRADIENT, PATTERN
fillForegroundSolidColorR塗りの前景色
fillBackgroundSolidColorR塗りの背景色
strokeMethodStrokeMethodR/WSTROKEFILL、GRADIENT、PATTERN
strokePositionStrokePositionR/WINSIDEFRAME, OUTSIDEFRAME, CENTERFRAME
strokeWeightPointR/Wストロークの太さ
strokeColorSolidColorR/Wストロークの色
strokeOverPrintbooleanR/Wオーバープリント
adjustmentsobjectR/W調整レイヤーの設定(タイプ固有)

adjustments のキー(調整レイヤー)

プロパティ型説明
brightnessnumber明るさ (-150–150)
contrastnumberコントラスト (-50–100)
huenumber色相 (-180–180)
saturationnumber彩度 (-100–100)
lightnessnumber明度 (-100–100)
levelInputnumber[]レベル入力 [shadow, gamma, highlight] (0–255)
levelOutputnumber[]レベル出力 [min, max] (0–255)
curvesnumber[][][[input, output], ...]
invertboolean反転
thresholdnumberしきい値 (0–255)
posterizenumberポスタリゼーション (2–255)
channelMixerobjectチャンネルミキサーの設定
colorBalancenumber[]カラーバランス [shadow, midtone, highlight]
photoFilterobject写真フィルターの設定
exposurenumber露出
offsetnumberオフセット
gammaCorrectionnumberガンマ補正
blackAndWhiteobject白黒ミキサーの設定
gradientMapobjectグラデーションマップの設定
selectiveColorobject特定色域の選択の設定
vibranceobjectビビッドの設定
hdrToningobjectHDR トーニングの設定
matchingColorobjectカラーマッチの設定
replaceColorobject色の置き換えの設定

LayerSet — レイヤーグループ

Layer のすべてのプロパティに加えて:

プロパティ型R/W説明
layersLayersRこのグループ内のすべてのレイヤー
artLayersArtLayersRこのグループ内のアートレイヤーのみ
layerSetsLayerSetsRネストされたグループ
enabledChannelsChannelType[]R/W['RGB', 'RED', ...]

TextItem — テキストレイヤーのプロパティ

プロパティ型R/W説明
contentsstringR/Wテキストの内容
fontstringR/Wフォント名(例: "ArialMT")
sizePointR/Wフォントサイズ(タイプ単位)
colorSolidColorR/Wテキストの色
positionarrayR/W[x, y] 位置
kindTextTypeR/WTextType.PARAGRAPHTEXT または POINTTEXT
antiAliasMethodAntiAliasR/WANTIALIASNONE, SHARP, CRISP, SMOOTH, STRONG
autoLeadingbooleanR/Wオートカーニング
baselineShiftnumberR/Wベースラインシフト
characterDirectionDirectionR/W文字方向
desiredGlyphScalingnumberR/Wグリフスケーリング
desiredLetterScalingnumberR/W文字間スケーリング
desiredWordScalingnumberR/W単語間スケーリング
fakeBoldbooleanR/W疑似太字
fakeItalicbooleanR/W疑似斜体
firstLineIndentnumberR/W最初の行のインデント
glyphScalingnumber[]R/W最小/最大グリフスケーリング
horizontalAlignmentJustificationR/WLEFT, CENTER, RIGHT, JUSTIFYLEFT, JUSTIFYCENTER, JUSTIFYRIGHT, FULLYJUSTIFY
capitalizationCaseR/WNORMAL, ALLCAPS, SMALLCAPS
kerningnumberR/Wカーニング
leadingnumberR/W行送り
letterScalingnumber[]R/W最小/最大文字間スケーリング
ligaturebooleanR/W合字
linesarrayRテキスト行
maximumGlyphScalingnumberR/W最大グリフスケーリング
maximumLetterScalingnumberR/W最大文字間スケーリング
maximumWordScalingnumberR/W最大単語間スケーリング
minimumGlyphScalingnumberR/W最小グリフスケーリング
minimumLetterScalingnumberR/W最小文字間スケーリング
minimumWordScalingnumberR/W最小単語間スケーリング
noBreakbooleanR/W改行禁止
openTypeFeaturesOpenTypeFeaturesR/WOpenType 機能
overlinebooleanR/W上線
paragraphOverflowColumnbooleanR/W段落オーバーフローカラム
spaceAfternumberR/W段落後のスペース
spaceBeforenumberR/W段落前のスペース
strikeThroughtbooleanR/W打ち消し線
tateChuYokobooleanR/W縦中横
trackingnumberR/Wトラッキング
tsumenumberR/Wツメ
underlinebooleanR/W下線
useAutoLeadingbooleanR/W自動行送りを使用
wordScalingnumber[]R/W最小/最大単語間スケーリング
wrapbooleanR/Wテキストの折り返し
paragraphOverflowColumnbooleanR/W段落オーバーフローカラム
textComposerTextComposerR/WTextComposer.ADOBE_EVERYLINE_COMPOSER または ADOBE_SINGLELINE_COMPOSER
paragraphStyleParagraphStyleR/W段落スタイル
characterStyleCharacterStyleR/W文字スタイル

Selection — 選択範囲オブジェクト

app.activeDocument.selection 経由でアクセスします。

プロパティ

プロパティ型R/W説明
boundsarrayR/W[x1, y1, x2, y2] (現在のルーラー単位)
solidbooleanR空でない選択範囲の場合は true
lengthnumberR選択範囲内のパスの数

メソッド

メソッドシグネチャ説明
select(region, type, feather)長方形 [x1,y1,x2,y2] またはパスアイテムを選択します。SelectionType.REPLACE, EXTEND, DIMINISH, INTERSECT
selectAll()すべてを選択します
deselect()選択を解除します
invert()選択範囲を反転します
contract(by)選択範囲を縮小します
expand(by)選択範囲を拡大します
feather(radius)選択範囲をぼかします
grow(tolerance)許容値に基づいて選択範囲を拡大します
smooth(radius)選択範囲を滑らかにします
similar(tolerance)類似ピクセルを選択します
load(file, channel, invert)チャンネルから選択範囲を読み込みます
store(file, channel)選択範囲をチャンネルに保存します
clear()選択範囲内の内容を削除します
fill(fillType)FillType.FOREGROUNDCOLOR, BACKGROUNDCOLOR, BLACK, WHITE, GRAY50PERCENT, HISTORY, PATTERN, CONTENTAWARE
stroke(color, width, location)選択範囲の境界線を描画します。StrokeLocation.INSIDE, OUTSIDE, CENTER
translate(dx, dy)選択範囲を移動します
resize(h, v, anchor)選択範囲をパーセンテージでリサイズします
rotate(angle, anchor)選択範囲を回転します
expandSelection(radius)expand のエイリアス
contractSelection(radius)contract のエイリアス
featherSelection(radius)feather のエイリアス

SolidColor — カラーオブジェクト

プロパティ

プロパティ型説明
rgbobject{red: 0–255, green: 0–255, blue: 0–255}
cmykobject{cyan: 0–100, magenta: 0–100, yellow: 0–100, black: 0–100}
grayobject{gray: 0–100}
labobject{l: 0–100, a: -128–127, b: -128–127}
hslobjectPhotopea 固有のプロパティ {hue: 0–360, sat: 0–100, lig: 0–100}
hexstringPhotopea 固有のプロパティ — "#FF8800" のような 16 進文字列

例:

var col = new SolidColor();
col.rgb = {red: 255, green: 128, blue: 0};
app.foregroundColor = col;

フィルター (app.activeDocument.activeLayer.applyFilter)

layer.applyFilter("filterName", params);

組み込みフィルター

フィルター名パラメーター
"motionblur"{distance: number, angle: number}
"radialblur"{amount: number, blurMethod: "spin"/"zoom", quality: "draft"/"good"/"best"}
"blurmore"{}
"blur"{}
"gaussianblur"{radius: number}
"smartblur"{radius: number, threshold: number, quality: "low"/"medium"/"high", mode: "normal"/"eedgesonly"/"overlay"}
"lensblur"{radius: number, brightness: number, threshold: number}
"shapblur"{radius: number, shape: "sqaure"/"triangle"/"circle"}
"boxblur"{radius: number}
"noise"{amount: number, distribution: "uniform"/"gaussian", monochromatic: bool}
"despeckle"{}
"dustandscratch"{radius: number, theshold: number}
"median"{radius: number}
"reduceNoise"{strength: number, preserveDetails: number, reduceColorNoise: number, sharpenDetails: number}
"clouds"{}
"differenceclouds"{}
"lightingeffect"{}
"fibers"{variance: number, strength: number}
"lensflare"`{brightness: number, center: {x: number, y: number}, type: "50-300mmzoom"/"35mmprime"/"105mmprime",

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

JantonioFC/skillsbank

AI-powered image editing with style transfer and object removal

JantonioFC/skillsbank

Internationalization and localization patterns. Detecting hardcoded strings, managing translations, locale files, RTL support.

JantonioFC/skillsbank

Analise e auditoria de editais de leilao judicial e extrajudicial. Riscos ocultos, clausulas perigosas, debitos, ocupante e classificacao da oportunidade.

JantonioFC/skillsbank

Best practices for Remotion - Video creation in React

JantonioFC/skillsbank

Generate walkthrough videos from Stitch projects using Remotion with smooth transitions, zooming, and text overlays

JantonioFC/skillsbank

Seek and analyze video content using Memories.ai Large Visual Memory Model for persistent video intelligence

JantonioFC/skillsbank

Writes complete, structured landing pages optimized for SEO ranking, AEO citation, and visitor conversion. Activate when the user wants to write or generate a landing page for a product, service, or offer.

JantonioFC/skillsbank

Video and audio perception, indexing, and editing. Ingest files/URLs/live streams, build visual/spoken indexes, search with timestamps, edit timelines, add overlays/subtitles, generate media, and create real-time alerts.

JantonioFC/skillsbank

Upload, stream, search, edit, transcribe, and generate AI video and audio using the VideoDB SDK.

JantonioFC/skillsbank

Skill for discovering and researching autonomous AI agents, tools, and ecosystems using the AgentFolio directory.

JantonioFC/skillsbank

Expert in building portfolios that actually land jobs and clients - not just showing work, but creating memorable experiences. Covers developer portfolios, designer portfolios, creative portfolios, and portfolios that convert visitors into opportunities.

JantonioFC/skillsbank

Tool lifecycle UI components for React/Next.js from ui.inference.sh. Display tool calls: pending, progress, approval required, results. Capabilities: tool status, progress indicators, approval flows, results display. Use for: showing agent tool calls, human-in-the-loop approvals, tool output. Triggers: tool ui, tool calls, tool status, tool approval, tool results, agent tools, mcp tools ui, function calling ui, tool lifecycle, tool pending

JantonioFC/skillsbank

Security audit, hardening, threat modeling (STRIDE/PASTA), Red/Blue Team, OWASP checks, code review, incident response, and infrastructure security for any project.

JantonioFC/skillsbank

When the user wants help with paid advertising campaigns on Google Ads, Meta (Facebook/Instagram), LinkedIn, Twitter/X, or other ad platforms. Also use when the user mentions 'PPC,' 'paid media,' 'ROAS,' 'CPA,' 'ad campaign,' 'retargeting,' 'audience targeting,' 'Google Ads,' 'Facebook ads,'...

JantonioFC/skillsbank

Create AI avatar and talking head videos with OmniHuman, Fabric, PixVerse via inference.sh CLI. Models: OmniHuman 1.5, OmniHuman 1.0, Fabric 1.0, PixVerse Lipsync. Capabilities: audio-driven avatars, lipsync videos, talking head generation, virtual presenters. Use for: AI presenters, expla...

JantonioFC/skillsbank

Create AI marketing videos for ads, promos, product launches, and brand content. Models: Veo, Seedance, Wan, FLUX for visuals, Kokoro for voiceover. Types: product demos, testimonials, explainers, social ads, brand videos. Use for: Facebook ads, YouTube ads, product launches, brand awarene...

JantonioFC/skillsbank

Generate AI videos with Google Veo, Seedance, Wan, Grok and 40+ models via inference.sh CLI. Models: Veo 3.1, Veo 3, Seedance 1.5 Pro, Wan 2.5, Grok Imagine Video, OmniHuman, Fabric, HunyuanVideo. Capabilities: text-to-video, image-to-video, lipsync, avatar animation, video upscaling, fole...

JantonioFC/skillsbank

Production-ready CI/CD configurations for Playwright — GitHub Actions, GitLab CI, CircleCI, Azure DevOps, Jenkins, Docker, parallel sharding, reporting, code coverage, and global setup/teardown.

JantonioFC/skillsbank

Next.js 16+ and Turbopack — incremental bundling, FS caching, dev speed, and when to use Turbopack vs webpack.

JantonioFC/skillsbank

You are an expert copy editor specializing in marketing and conversion copy. Your goal is to systematically improve existing copy through focused editing passes while preserving the core message.

関連スキル