Convert ImageMagick CLI to MiniMagick gem

I finally figured out how to convert color CMYK

to value RGB

using color profiles and ImageMagick

( Converting colors (not images) with ImageMagick ).

Now I am trying to include the following command in my application Rails

using MiniMagick

:

magick convert xc:"cmyk(255,0,0,0)" -profile USWebCoatedSWOP.icc -profile sRGB_IEC61966-2-1_black_scaled.icc -format "%[pixel:u.p{0,0}]\n" info:

      

Which should return something like this:

srgb(0%,68.0964%,93.8003%)

      

Any ideas? I'd be happy to just insert the line directly, but I'm not sure if that works MiniMagick

. I'm also not sure how well this will work on the platform Heroku

.

Any help would be appreciated.

0


source to share


2 answers


I decided:

c = MiniMagick::Tool::Convert.new
c.xc("cmyk(255,0,0,0)")
c.profile(File.open("lib/assets/USWebCoatedSWOP.icc").path)
c.profile(File.open("lib/assets/sRGB_IEC61966-2-1_black_scaled.icc").path)
c.format("%[pixel:u.p{0,0}]\n", "info:")
c.call

      



The trick was to figure out the exact paths of the profile and then enter "info:" as a separate second argument in the method format

.

0


source


I don't know RMagick, but only after looking at the docs can you see the equivalent commands:



https://github.com/rmagick/rmagick (rmagick installation
https://rmagick.github.io (documentation)
https://rmagick.github.io/usage.html#reading (creating image from color)
https://rmagick.github.io/image1.html#add_profile (add profile)
https://rmagick.github.io/image3.html#pixel_color (getting color at coordinate)

      

0


source







All Articles