How to find the path to ImageMagick configuration files

I am trying to download an ICM profile profile file that is stored with the main ImageMagick configuration files (colors.xml, etc.) using RMagick. I want to make sure that I always provide the correct file path through deployments using slightly different settings and / or versions of ImageMagick. Is there a way to find this location from ImageMagick (something like Magick-config)?

This is what I have now, but it seems fragile:

MAGICK_PREFIX  = `Magick-config --prefix`.strip!
MAGICK_VERSION = `Magick-config --version`.strip!.split(/\s/).first

RGB_COLOR_PROFILE = "#{MAGICK_PREFIX}/share/ImageMagick-#{MAGICK_VERSION}/config/sRGB.icm"
+3
source share
1 answer

I don't have the perfect anwser, but you can

$ convert -list color | grep Path: | awk '{print $2}'
/usr/lib/ImageMagick-6.3.7/config/colors.xml

If the answer is [embedded], try a different list value.

+1
source

Source: https://habr.com/ru/post/1734934/


All Articles