From 7c813a75f35420366130d35130badbbf86f6736e Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 19 Nov 2025 01:27:32 +0000 Subject: [PATCH] Improve OGP image quality with high-quality rendering options MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 高品質なレンダリングオプションを追加してOGP画像の品質を向上: - shapeRendering: geometricPrecision (最高品質の図形レンダリング) - textRendering: geometricPrecision (最高品質のテキストレンダリング) - imageRendering: optimizeQuality (最高品質の画像レンダリング) - loadSystemFonts: false (パフォーマンス向上のため) これにより、テキストや図形のエッジがよりシャープで鮮明になります。 --- package-lock.json | 10 +--------- scripts/generate-ogp.mjs | 7 +++++++ 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/package-lock.json b/package-lock.json index 61f30c18..af9aad24 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,8 +16,7 @@ "textlint": "^14.0.4", "textlint-filter-rule-comments": "^1.2.2", "textlint-rule-preset-ja-spacing": "^2.4.3", - "textlint-rule-preset-ja-technical-writing": "^10.0.1", - "toml": "^3.0.0" + "textlint-rule-preset-ja-technical-writing": "^10.0.1" } }, "node_modules/@azu/format-text": { @@ -4521,13 +4520,6 @@ "node": ">=0.10.0" } }, - "node_modules/toml": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/toml/-/toml-3.0.0.tgz", - "integrity": "sha512-y/mWCZinnvxjTKYhJ+pYxwD0mRLVvOtdS2Awbgxln6iEnt4rk0yBxeSBHkGJcPucRiG0e55mwWp+g/05rsrd6w==", - "dev": true, - "license": "MIT" - }, "node_modules/traverse": { "version": "0.6.9", "resolved": "https://registry.npmjs.org/traverse/-/traverse-0.6.9.tgz", diff --git a/scripts/generate-ogp.mjs b/scripts/generate-ogp.mjs index 1af56319..fa00eda1 100644 --- a/scripts/generate-ogp.mjs +++ b/scripts/generate-ogp.mjs @@ -72,6 +72,7 @@ function extractMetadata(filePath, content) { /** * SVGをPNGに変換 + * 高品質レンダリングオプションを使用 */ function svgToPng(svg) { const resvg = new Resvg(svg, { @@ -79,6 +80,12 @@ function svgToPng(svg) { mode: 'width', value: 1200, }, + font: { + loadSystemFonts: false, // システムフォント読み込みを無効化してパフォーマンス向上 + }, + shapeRendering: 2, // 0: optimizeSpeed, 1: crispEdges, 2: geometricPrecision + textRendering: 2, // 0: optimizeSpeed, 1: optimizeLegibility, 2: geometricPrecision + imageRendering: 2, // 0: optimizeSpeed, 1: optimizeQuality }); const pngData = resvg.render();