0
我用下面的代码在Ruby中产生的PSD成JPG格式 -ImageMagick的 - PSD转换为JPG - 生成空白影像
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} ")
但对于一些月台幕门,生成的JPG文件是在服务器空白影像。经过一番研究,我发现了一种方法-flatten
,但它并不总能获得正确的结果。那么,是否有一种适合所有人的解决方案,适用于任何psds层(以及任何尺寸的psd)。任何调整上述代码表示赞赏。
代码修改时,我使用的扁平化:
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} ")