Gray anaglyph

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
tksharpless
Posts: 9
Joined: 2015-11-21T11:45:38-07:00
Authentication code: 1151

Gray anaglyph

Post by tksharpless »

I want to convert RGB stereo pairs to gray anaglyph.
composite -stereo needs rgb images, so I need to convert color RGB to gray RGB. How?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Gray anaglyph

Post by fmw42 »

In IM 6, grayscale images should still work, since IM replicates the gray image 3 times. Internally to IM, grayscale images have 3 channels. But I do not know if -stereo will work properly on 3 equal grayscale channels, since I have not tested that. So go ahead and try it.
tksharpless
Posts: 9
Joined: 2015-11-21T11:45:38-07:00
Authentication code: 1151

Re: Gray anaglyph

Post by tksharpless »

Thanks much. Yes,
composite -stereo 0 rgt.jpg -colorspace gray lft.jpg -colorspace gray anagg.jpg
works "like Magick".
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Gray anaglyph

Post by fmw42 »

If the images are already grayscale, then you do not need -colorspace gray. This should work in IM 6. It won't work in IM 7, since in IM 7 grayscale images are single channel. So you would have to -combine 3 copies of the grayscale image to format as RGB.

Code: Select all

composite -stereo 0 rgt.jpg lft.jpg anagg.jpg
tksharpless
Posts: 9
Joined: 2015-11-21T11:45:38-07:00
Authentication code: 1151

Re: Gray anaglyph

Post by tksharpless »

The images are rgb to begin with. But gray anaglyph is usually better for checking stereo alignment.
tksharpless
Posts: 9
Joined: 2015-11-21T11:45:38-07:00
Authentication code: 1151

Re: Gray anaglyph

Post by tksharpless »

Ideally, the -stereo operator should automatically convert a single channel image to 3 channel.
Post Reply