Loading...
Loading...
Compare original and translation side by side
.figrenderfig.figrenderfignpm install -g renderfig
npx playwright install chromiumPlaywright가 스크린샷 촬영에 Chromium을 사용하므로, 최초 1회이 필요합니다. 이미 설치되어 있다면 생략 가능합니다.npx playwright install chromium
npm install -g renderfig
npx playwright install chromium由于Playwright使用Chromium进行截图,首次使用需要执行。如果已经安装过则可以省略。npx playwright install chromium
.fig 파일 → parsefig (파싱) → 노드 트리 + 이미지 추출
→ 오버라이드 적용 → HTML/CSS 생성 → Playwright 스크린샷 → PNG/JPG 출력.fig 文件 → parsefig(解析)→ 节点树 + 图像提取
→ 应用覆盖设置 → 生成HTML/CSS → Playwright截图 → 输出PNG/JPGinspectundefinedinspectundefined
inspect 출력에서 다음을 확인합니다:
- **노드 이름**: 오버라이드 `target`으로 사용할 이름
- **노드 타입**: `[TEXT]`는 텍스트 교체 가능, `(image)`는 이미지 교체 가능
- **노드 크기**: 렌더링 결과의 기대 크기
- **mixed styles**: TEXT 노드에 여러 스타일(폰트 크기, 굵기 등)이 혼합된 경우 각 런별 스타일 정보가 표시됩니다
在inspect的输出中需要确认以下内容:
- **节点名称**:用于覆盖设置的`target`名称
- **节点类型**:`[TEXT]`表示可替换文本,`(image)`表示可替换图像
- **节点大小**:渲染结果的预期尺寸
- **mixed styles**:TEXT节点中混合多种样式(字体大小、粗细等)时,会显示每个片段的样式信息npx renderfig render <파일경로> "페이지/프레임" -o output.pngnpx renderfig render <文件路径> "页面/帧" -o output.png--text--text--text "노드이름=새로운 텍스트"undefined--text "节点名称=新文本"undefined
**부분 교체 (스타일 보존)**: `--text "노드이름//검색텍스트=대체텍스트"` 형식으로 텍스트의 일부만 교체하면서 기존 스타일(폰트 크기, 굵기 등)을 보존합니다. `//`로 노드이름과 검색어를 구분합니다.
```bashundefined--text "节点名称//搜索文本=替换文本"//
전체 교체 시에도 줄 수가 같으면 라인별 스타일이 보존됩니다. 예를 들어 원본이 2줄(1줄 Medium, 2줄 Bold)이면 교체 텍스트도 2줄일 때 각 줄의 스타일이 유지됩니다.undefined--image--image "노드이름=이미지파일경로"npx renderfig render design.fig "프로필 카드/Channy" \
--image "사진=./new-photo.jpg" \
-o output.png
整体替换时,如果行数相同,每行的样式会被保留。例如原文本为2行(第一行Medium,第二行Bold),替换后的文本也为2行时,每行的样式会保持不变。--style--image--style "노드이름.속성=값"npx renderfig render design.fig "프로필 카드/Channy" \
--style "Channy (차니).fontSize=40" \
--style "Channy (차니).color=#ff0000" \
-o output.pngxywidthheightcolorbackgroundColoropacityvisiblecornerRadiusborderRadiusTopLeftborderRadiusTopRightborderRadiusBottomLeftborderRadiusBottomRightstrokeColorstrokeWeightfontSizefontFamilyfontWeighttextAligntextAlignVerticallineHeightlineHeightPercentletterSpacingtextDecorationgappaddingpaddingHorizontalpaddingVerticalpaddingToppaddingRightpaddingBottompaddingLeftalignItemsjustifyContent--image "节点名称=图像文件路径"npx renderfig render design.fig "个人资料卡片/Channy" \\
--image "照片=./new-photo.jpg" \\
-o output.png--font--style--font "폰트패밀리=폰트파일경로"npx renderfig render design.fig "프로필 카드/Channy" \
--font "Pretendard=./fonts/Pretendard-Regular.woff2" \
-o output.png--style "节点名称.属性=值"npx renderfig render design.fig "个人资料卡片/Channy" \\
--style "Channy (차니).fontSize=40" \\
--style "Channy (차니).color=#ff0000" \\
-o output.pngxywidthheightcolorbackgroundColoropacityvisiblecornerRadiusborderRadiusTopLeftborderRadiusTopRightborderRadiusBottomLeftborderRadiusBottomRightstrokeColorstrokeWeightfontSizefontFamilyfontWeighttextAligntextAlignVerticallineHeightlineHeightPercentletterSpacingtextDecorationgappaddingpaddingHorizontalpaddingVerticalpaddingToppaddingRightpaddingBottompaddingLeftalignItemsjustifyContent--font| 옵션 | 설명 | 기본값 |
|---|---|---|
| 출력 파일 경로 (필수) | - |
| 출력 포맷 | 확장자에서 자동 감지 |
| JPEG 품질 (0-100) | - |
| 디바이스 스케일 팩터 | 1 |
--font "字体家族=字体文件路径"npx renderfig render design.fig "个人资料卡片/Channy" \\
--font "Pretendard=./fonts/Pretendard-Regular.woff2" \\
-o output.pngimport { renderFrame } from 'renderfig';
const buffer = await renderFrame({
figFile: './design.fig',
frameName: '프로필 카드/Channy',
output: './output.png',
scale: 2,
overrides: [
// 전체 교체
{ type: 'text', target: 'Channy (차니)', value: '새이름' },
// 부분 교체 (search로 해당 부분만 교체, 스타일 보존)
{ type: 'text', target: '타이틀', search: '원래텍스트', value: '새텍스트' },
{ type: 'image', target: '사진', src: './photo.jpg' },
{ type: 'style', target: 'Maker', props: { fontSize: 24, color: '#0066ff' } },
// 동일 이름 노드 구분: 인덱스 문법
{ type: 'text', target: '이메일[1]', value: 'second@email.com' },
],
fonts: [
{ family: 'Pretendard', src: './fonts/Pretendard-Regular.woff2' },
],
});| 选项 | 说明 | 默认值 |
|---|---|---|
| 输出文件路径(必填) | - |
| 输出格式 | 自动从扩展名识别 |
| JPEG质量(0-100) | - |
| 设备缩放因子 | 1 |
inspect/기본 정보/Channy (차니)이름[n]이메일[0]이메일[1]--font<path><span>import { renderFrame } from 'renderfig';
const buffer = await renderFrame({
figFile: './design.fig',
frameName: '个人资料卡片/Channy',
output: './output.png',
scale: 2,
overrides: [
// 整体替换
{ type: 'text', target: 'Channy (차니)', value: '新名称' },
// 部分替换(通过search仅替换对应部分,保留样式)
{ type: 'text', target: '标题', search: '原文本', value: '新文本' },
{ type: 'image', target: '照片', src: './photo.jpg' },
{ type: 'style', target: 'Maker', props: { fontSize: 24, color: '#0066ff' } },
// 区分同名节点:索引语法
{ type: 'text', target: '邮箱[1]', value: 'second@email.com' },
],
fonts: [
{ family: 'Pretendard', src: './fonts/Pretendard-Regular.woff2' },
],
});inspect/基本信息/Channy (차니)名称[n]邮箱[0]邮箱[1]--font<path><span>