[Tioga-users] monochrome image
Bill Paxton
paxton at kitp.ucsb.edu
Tue Dec 12 12:28:33 EST 2006
Hi,
Here's a little example of a monochrome image using checkerboard data.
def mono_image
table = build_table(0.1, 0.9)
samples = t.create_monochrome_image_data(table, 'boundary'
=> 0.5)
t.fill_color = Black
t.show_image(
'width' => 8,
'height' => 8,
'color_space' => 'mono',
'data' => samples,
'interpolate' => false,
'll' => [0.1, 0.1],
'lr' => [0.9, 0.1],
'ul' => [0.1, 0.9])
end
Here are two screen captures showing the result:
The first one is from Adobe's acroread (naturally, it looks like it
should):
-------------- next part --------------
A non-text attachment was scrubbed...
Name: acroread_version.tiff
Type: image/tiff
Size: 11172 bytes
Desc: not available
Url : http://rubyforge.org/pipermail/tioga-users/attachments/20061212/0e2a61dc/attachment-0002.tiff
-------------- next part --------------
The second is from Apple's preview (and unfortunately it isn't so
great):
-------------- next part --------------
A non-text attachment was scrubbed...
Name: preview_version.tiff
Type: image/tiff
Size: 56180 bytes
Desc: not available
Url : http://rubyforge.org/pipermail/tioga-users/attachments/20061212/0e2a61dc/attachment-0003.tiff
-------------- next part --------------
It seems that Apple doesn't pay attention to the flag that should
control interpolation.
I've included the pdf file below in case you'd like to check your
favorite viewer!
Cheers,
Bill
Here's the checkerboard data:
def build_table(light, dark)
num_cols = 8
num_rows = 8
table = Dtable.new(num_cols, num_rows)
row0 = Dvector[light, dark, light, dark, light, dark, light,
dark]
row1 = Dvector[dark, light, dark, light, dark, light, dark,
light]
table.set_row(0,row0)
table.set_row(1,row1)
table.set_row(2,row0)
table.set_row(3,row1)
table.set_row(4,row0)
table.set_row(5,row1)
table.set_row(6,row0)
table.set_row(7,row1)
return table
end
Here's the PDF file:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mono_image.pdf
Type: application/pdf
Size: 1787 bytes
Desc: not available
Url : http://rubyforge.org/pipermail/tioga-users/attachments/20061212/0e2a61dc/attachment-0001.pdf
More information about the Tioga-users
mailing list