Converting galaxy images to greyscale

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
mhwombat
Posts: 3
Joined: 2014-09-23T08:23:53-07:00
Authentication code: 6789

Converting galaxy images to greyscale

Post by mhwombat »

I am trying to convert galaxy images to greyscale, but I need to preserve most of the detail of the spiral "arms". I have read ImageMagick tutorials, and tried loads of different filters, thresholds, other options etc., but I'm not having any luck. Can anyone offer any suggestions?

Here is a sample image:

Image
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Converting galaxy images to greyscale

Post by fmw42 »

try this

Code: Select all

convert 1237648673994965546.jpg -colorspace cmyk -channel black -separate +channel \
1237648673994965546_black.png
or negate it

Code: Select all

convert 1237648673994965546.jpg -colorspace cmyk -channel black -separate +channel \
-negate 1237648673994965546_black_neg.png
In Windows replace the end of line \ with ^
mhwombat
Posts: 3
Joined: 2014-09-23T08:23:53-07:00
Authentication code: 6789

Re: Converting galaxy images to greyscale

Post by mhwombat »

I finally found a magick incantation that works well:

Code: Select all

-set colorspace RGB -colorspace gray
@fmw42: Those commands generated colour pictures with lots of speckle-y artifacts.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Converting galaxy images to greyscale

Post by fmw42 »

mhwombat wrote:
@fmw42: Those commands generated colour pictures with lots of speckle-y artifacts.
They work perfectly fine for me on the image you provided when using IM 6.8.9.7 Q16 Mac OSX. What version of IM are you using and what platform? Always a good idea to identify those when asking a question
mhwombat
Posts: 3
Joined: 2014-09-23T08:23:53-07:00
Authentication code: 6789

Re: Converting galaxy images to greyscale

Post by mhwombat »

I'm on Debian "Sid". And interestingly, I just completed a system update, and now the command works fine. So perhaps it was a bug that's been fixed.

Now I'm running ImageMagick 6.8.9-6 Q16 x86_64 2014-09-06. Don't know what I was running just before the update.
Post Reply