开发者

RGB image to CMYK and soften colors

开发者 https://www.devze.com 2023-03-11 21:51 出处:网络
How to convert from RGB to CMYK soften/reduce color weight (avoid melt in printing press) in ruby? It\'s for a rails app. Links are ok, 开发者_StackOverflow中文版code examples are awsome.First, ma

How to

  • convert from RGB to CMYK
  • soften/reduce color weight (avoid melt in printing press)

in ruby? It's for a rails app. Links are ok, 开发者_StackOverflow中文版code examples are awsome.


First, make sure you have imagemagick compiled with LCMS (on a mac brew install imagemagick --with-little-cms). You probably need to reinstall the rmagick gem after reinstalling imagemagick.

Next, get Adobe ICC color profiles (again, these are for mac, but I'm sure you have no trouble locating versions for other platforms).

Then fire up your editor, and do something along these lines.

image = Image.read("my_image.jpg")[0]
image.colorspace = Magick::CMYKColorspace
image.add_profile("path_to/adobe_icc_profiles/CMYK/USWebCoatedSWOP.icc")
image.write("my_image_cmyk.jpg")


I would say, use RMagick: http://rmagick.rubyforge.org/

Make sure to use version 2 and on, though, since it works with Ruby 1.9, too. Version 1 only works with 1.8.

As for an example however, I am not insanely experienced with ImageMagick. You can start here though:

http://www.imagemagick.org/script/command-line-tools.php

0

精彩评论

暂无评论...
验证码 换一张
取 消