feat: allow functions in replaceImage for programmatic image conversion#766
Draft
u1f992 wants to merge 19 commits into
Draft
feat: allow functions in replaceImage for programmatic image conversion#766u1f992 wants to merge 19 commits into
u1f992 wants to merge 19 commits into
Conversation
…lacement/builtinGrayReplacement
…rate WASM instance)
Comment on lines
+294
to
+299
| warnUnreplacedImages: v.pipe( | ||
| v.boolean(), | ||
| v.description($` | ||
| Warn when non-CMYK-compatible images remain in the PDF after image replacement. (default: true) | ||
| `), | ||
| ), |
Member
There was a problem hiding this comment.
Warningとして表示させるだけでなく、エラーとして動作を失敗させるようにして欲しいという要件もあるかもしれません。ifUnreplacedImagesFound: 'warn' | 'error' | 'ignore' などのように、画像がreplaceされなかった時の動作を指定するような設計を検討できますか?
Member
Author
|
開発者会議での報告の通り、カラースペースサポートを入れた後で同様の機能を再検討します。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CMYKへ機能を追加するPRです。ラスター画像をJavaScript側で変換する方法を提供します。またこれに合わせて、CMYK有効時にRGB画像が置換されずに残ったら警告が出るようにしました(色置換と同じ理屈)。サンプルに使用例を追加しているのでご確認ください。
カラーマネージメントの専門的なライブラリはJavaScriptにはほとんどないので、MuPDFを使って簡易的に自動変換する
builtinGrayReplacement()builtinCmykReplacement()もexportしています。ICCプロファイルを渡すこともでき、その場合はグローバルなICC状態の汚染を防ぐため別のmupdf WASMインスタンスで変換を行う必要があります。このためにnode_modulesの中を見に行くようになっておりここは特殊です。現在のところPNGを書き出してどうにかしてもらうことしか想定していませんが、将来の拡張のために
asPNG()を経由して画像を得るようにしています。PDFの情報などを渡せるのではないかと考えていますが、有用な使いみちは思いついていないので現時点ではasPNGだけです。