【发布时间】:2017-02-28 05:13:43
【问题描述】:
我在ruby中使用以下代码将psds生成为jpgs-
process_file = abc.psd[0]
jpg_file = abc.jpg
system ("convert #{process_file} "\
"-profile '#{Rails.root}/lib/folder_name/AdobeRGB1998.icc' "\
"-profile '#{Rails.root}/lib/folder_name/sRGB_IEC61966-2-1_black_scaled.icc'"\
"-scale 3072x3072 -quiet #{jpg_file} ")
但是对于少数 psd,生成的 jpg 是服务器中的空白图像。经过一番研究,我找到了-flatten 的方法,但它并不总能获得正确的结果。那么,是否有一个适合所有人的解决方案,它适用于任何层的 psd(以及任何大小的 psd)。感谢您对上述代码进行任何调整。
当我使用 flatten 时代码发生了变化:
process_file = abc.psd
jpg_file = abc.jpg
system ("convert #{process_file} "\
"-profile '#{Rails.root}/lib/folder_name/AdobeRGB1998.icc' "\
"-profile '#{Rails.root}/lib/folder_name/sRGB_IEC61966-2-1_black_scaled.icc' "\
"-flatten -scale 3072x3072 -quiet #{jpg_file} ")
【问题讨论】:
标签: ruby-on-rails ruby imagemagick imagemagick-convert psd