Forums | Admin

Discussion Forums: help

Start New Thread Start New Thread
Message: 98052
BY: Yuhan Zhang (yuhanz)
DATE: 2012-07-11 22:29
SUBJECT: rgb to grayscale not working

 

Hi all,

I'm using rmagick (2.13.1) trying to convert an rgb image into grayscale. however it doesn't do the work, although the function didn't throw error. I still see rgb pixels.

Here's the code that I am using:

file = '/home/yuhan/workspace/testDFT/Debug/testImages/blank0.jpg'
img = Magick::Image::read(file).first
img = img.quantize( 256, Magick::GRAYColorspace );
img.cur_image[:Label] = "Grayscale"
@result = "dimension: " + img.columns.to_s() + ":" + img.rows.to_s() + " - " + pixel.to_s()


The result returned:

dimension: 400:300 - red=29601, green=29601, blue=29601, opacity=0

Is there anything that I did wrong?

Thank you

Yuhan


Thread View

Thread Author Date
rgb to grayscale not workingYuhan Zhang2012-07-11 22:29

Post a followup to this message