Preferred library and/or method of converting CMYK to RGB - image

Each month I get new CMYK and RGB images that shall be used on the web.
I had a script using a patched up ImageMagick doing this, but it got deleted. So I need to do it again, but it was hard last time.
How do you easily and quickly convert CMYK image files to RGB?

Like so:
convert CMYK.tiff -profile "RGB.icc" RGB.tiff

convert cmyk_image.jpg -colorspace
rgb rgb_image.jpg

The answer of g.b.1981 basically is correct (+1), but...
To make it work reliable, I found I had to add -type truecolor to the commandline:
convert cmyk.jpg -colorspace rgb -type truecolor rgb.jpg

Related

How to convert PNG to uncompressed DDS in Linux?

Based on wiki DDS could be compressed and uncompressed.
Now I'm trying to figure out how to achive converting png to dds without compression.
Regular converting could be achived with
convert file.png out.dds
It looks like you found a missing feature in ImageMagick. This is now only supported:
convert file.png -define dds:compression=none out.dds
But the following should work:
convert file.png -compress none out.dds
I just pushed a patch to the ImageMagick repository to add support for the -compress option that will be available in the next release.

How to convert a JPEG to a JPEG with EXIF orientation 1?

If you take a JPEG picture in a non-native orientation for the CCD, most cameras don't bother rotating the raw image. They just (lazily) modify the Orientation value in the EXIF metadata and make the image viewer deal with it. You can check this value by installing ExifTool (via APT) and running exiftool -Orientation -n image.jpg. (This will give you the raw number value found in the data, for a human-readable output remove the -n.)
Is there an Ubuntu/Linux tool or way to modify a JPEG image so that the raw image is rotated to the correct orientation when the EXIF orientation value is set to 1?
I think you want ImageMagick’s auto-orient feature. So, for one image:
convert input.jpg -auto-orient result.jpg
Or, if you have lots to do, make a backup first, then:
mogrify -auto-orient *.jpg
Note this will alter all your files irreversibly, so backup first and check it’s what you want.

ImageMagick, Convert command degrades image actual Quality

I have been trying to convert JPG image which is in CMYK format to sRGBformat with imagemagick library in Ruby on Rails.
But unfortunately, observed that quality of the image degraded after convertion of image by following command:
MiniMagick::Tool::Convert.new do |convert|
convert << attachment.tempfile.path
convert.merge! ["-colorspace", "srgb"]
convert << attachment.tempfile.path
end
Is there anything missing here? and looking forward to avoid the deviation.
Please let me know your ideas.
You can try to use the ImageMagick -profile option for better conversion:
convert image.jpg -profile sRGB.icc rgb_image.jpg
You can look here for more details on ImageMagick.

Remove meta information in picture using "convert" without changing the colors of the picture

I have a problem using the tool convert (imagemagick) to remove metainformation of pictures to make them smaller for faster delivery in websites.
When I use the convert command with following parameters:
convert -format png -strip pic1.png pic2.png
then the converted picture is much more darker than the original one.
I also tried to require the colorspace of the original picture with:
convert -format png -colorspace sRGB -strip pic1.png pic2.png
but it's the same problem.
Has anyone an idea how to solve it?
These are the example pictures:
(Original) Pic1:
(Converted) Pic 2:
The problem is the installed version 6.7.7 of ImageMagick (Standard-Version of Linux Mint 17)
In version 6.4 and (said in comment) in version 6.9 it works.
So the 6.7.7 version is buggy in that case.

ruby - Dragonfly - Force CMYK to RGB conversion when doing thumbnails

I'm using a nice enough cms (locomotive(github)) to allow some non-tech savy users to upload pictures to the system. The program is able to resize and crop pictures to any given size.
Trouble is, Internet explorer doesn't know how to deal with CMYK-encoded images. The users of this app are not exactly tech-savy; asking them to transform their images from CMYK to RGB is not an option. I'd like to modify locomotive so that it does the change automatically. I've been trying this for some hours but had no luck so far.
This is what I have found:
Locomotive uses dragonfly to perform the resizing.
Concretely, it uses dragonfly's imagemagick module.
The file that defines how Dragonfly is used in locomotive can be found here.
There is also a dragonfly initializer file.
I have also found that what (think) I need is adding a -colorspace RGB option to the parameter sent to Imagemagick by Dragonfly. It doesn't look like Dragonfly provides an easy option to do that.
I've tried several things, the last one consisting on monkeypatching Dragonfly's Imagemagick Processor so that the -colorspace RGB option is always used. I've added this in locomotive's config/initializers/dragonfly.rb:
# locomotive's config/initializers/dragonfly.rb
# ... Locomotive's default initialization
module Dragonfly
module ImageMagick
class Processor
alias :old_convert :convert
def convert(temp_object, args='', format=nil)
args += ' -colorspace RGB' # force RGB in all thumbnails
old_convert(temp_object, args, format)
end
end
end
end
I was pretty sure that this should work, but unfortunately it doesn't. And I have run out of ideas. Can anyone help?
On the commandline, I sometimes need to add -type truecolor to make colorspace conversions work reliably:
convert cmyk.jpeg -colorspace rgb -type truecolor rgb.jpeg
Maybe you try to add it in your code as well?
From the related list to the right, might this SO answer help?
Properly converting a CMYK image to RGB with RMagick
Unfortunately there doesn't seem to be a straightforward way to do this with Dragonfly. I've given up.

Resources