image-manipulation - 如何在将 eps 文件转换为 jpeg 或 png 时更改其背景颜色

标签 image-manipulation ghostscript eps image-conversion

我正在将 eps(Encapsulated PostScript)文件转换为带有 ghostscript 的 jpeg 文件。我使用的示例命令是:

gswin32.exe -sDEVICE=jpeg -dJPEGQ=100 -dNOPAUSE -dBATCH -dSAFER -r600x600  -dGraphicsAlphaBits=4 -dUseCIEColor  -dEPSCrop -sOutputFile=”a.jpeg” b.eps

输入的 eps 文件带有白色背景(我只有它们的剪切路径)。我需要做的是在输出图像中将这个白色背景更改为另一种颜色,或者如果我能让它们透明会更好(输出文件格式为 png)。我怎样才能做到这一点?

最佳答案

我自己从未尝试过,但您应该可以通过设置将 eps 文件转换为 png:

-sDEVICE=pngalpha

pngalpha 设备也有一个 -dBackgroundColor 选项:

-dBackgroundColor=16#RRGGBB (RGB color, default white = 16#ffffff) For the pngalpha device only, set the suggested background color in the PNG bKGD chunk. When a program reading a PNG file does not support alpha transparency, the PNG library converts the image using either a background color if supplied by the program or the bKGD chunk. One common web browser has this problem, so when using on a web page you would need to use -dBackgroundColor=16#CCCC00 when creating alpha transparent PNG images for use on the page.



更多详情:Details of Ghostscript output devices见第 3.1 节。 PNG 文件格式

关于image-manipulation - 如何在将 eps 文件转换为 jpeg 或 png 时更改其背景颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2020972/

相关文章:

pdf - Ghostscript Merge pdf 并从合并的文件创建目录页面

pdf - GhostScript **** 警告 : considering '0000000000 XXXXX n' as a free entry Error because of CID Font

python - PIL 和基于矢量的图形

java - 使用 java 进行图像处理

python - 如何将 .ps 文件转换为 .png 文件?

php - 将分层 SVG 矢量图形转换为分层 EPS 矢量图形

pdf - 将 eps 图像转换为 pdf 时如何避免灰色轮廓伪影?

iphone - 如何像FaceGoo一样进行图像处理

user-interface - 您推荐使用哪种图像编辑器来创建炫酷的 UI 元素?

image-manipulation - 生成图像旋转版本的工具