ImageMagick フォーラムの次のスレッドでは、これについて詳細に議論しています: http://www.imagemagick.org/discourse-server/viewtopic.php?f=1&t=16464
私は現在、この bash スクリプトを使用して、任意の画像 (CMYK を含む) を sRGB に変換しています:
http://alma.ch/scripts/any2srgb
プロファイルが埋め込まれていない画像には、icc プロファイルが必要です。これらはウェブ上で簡単に見つけることができます。たとえば、Adobe のサイト: http://www.adobe.com/cfusion/search/index.cfm?term=icc+profile&siteSection=support%3Adownloads
完全なスクリプトが行うことの要約 (未テスト) を次に示します (サイズ変更やその他のオプションは除きます)。プロファイルと ImageMagick が必要です。Debian ベースのシステムの場合: apt-get install icc-profiles imagemagick
.
#!/bin/bash
srgb=sRGB.icm
cmyk=ISOwebcoated.icc
# extract possible color profile
profile="${f/%.*/.icc}"
convert "$f" "icc:$profile" 2>/dev/null
if cmp -s "$profile" "$srgb" ; then
# embedded profile is already srgb. Nothing to do
exit
fi
if [ -s "$profile" ]; then
# we have an embedded profile, so ImageMagick will use that anyway
convert "$f" -profile "$srgb" +profile '*' "$outfile"
else
# no embedded profile in source
if identify -format "%r" "$f" | grep -q CMYK; then
# CMYK file without embedded profile
convert "$f" -profile "$cmyk" -profile "$srgb" "$outfile"
fi
fi