Bitmap/Read a PPM file: Difference between revisions
→{{header|J}}: simplify and reuse verbs from Basic bitmap storage
(add Ruby) |
(→{{header|J}}: simplify and reuse verbs from Basic bitmap storage) |
||
Line 503:
=={{header|J}}==
'''Solution:'''
Uses <tt>makeRGB</tt> from [[Basic bitmap storage#J|Basic bitmap storage]].
<lang j>
require 'files'
Line 508 ⟶ 509:
readppm=: monad define
dat=. fread y NB. read from file
't
if. (_99 e. wbyh,maxval
▲ (shape , 3) $ a. i. dat NB. convert to basic bitmap format
)
</lang>
|