Bitmap/Histogram: Difference between revisions
Content added Content deleted
(→{{header|J}}: fix toBW) |
m (→{{header|J}}: wording) |
||
Line 355: | Line 355: | ||
=={{header|J}}== |
=={{header|J}}== |
||
'''Solution |
'''Solution''' |
||
Using <code>toGray</code> from [[Grayscale image#J|Grayscale image]]: |
|||
<lang j> |
<lang j> |
||
getImgHist=: ([: /:~ ~. ,. #/.~)@, |
getImgHist=: ([: /:~ ~. ,. #/.~)@, |
||
Line 363: | Line 365: | ||
'''Example Usage:''' |
'''Example Usage:''' |
||
Using |
|||
Use [http://rosettacode.org/mw/images/b/b6/Lenna100.jpg Lenna100.jpg] for testing (read using the [[j:Addons/media/platimg|media/platimg]] addon and convert to ppm file). |
|||
<lang j> |
<lang j> |
||
require 'media/platimg' |
|||
NB. read jpg and write ppm |
|||
' |
'Lenna100.ppm' writeppm~ 256#.inv readimg 'Lenna100.jpg' |
||
786447 |
786447 |
||
</lang> |
|||
NB. Write black and white version to file |
|||
⚫ | |||
Read ppm, convert to black and white and write to a ppm file using <code>writeppm</code>, <code>readppm</code> and <code>toColor</code> from other pages. |
|||
<lang j> |
|||
⚫ | |||
786447 |
786447 |
||
</lang> |
</lang> |