Bitmap/Read a PPM file: Difference between revisions

m
(Replaced "initImage" by "newImage" (change in "bitmap.nim" interface).)
m (→‎{{header|Phix}}: minor tidy)
Line 1,612:
 
=={{header|Phix}}==
Based on [[Bitmap/Read_a_PPM_file#Euphoria|Euphoria]], requires write_ppm() from [[Bitmap/Write_a_PPM_file#Phix|Write_a_PPM_file]], to_grayto_grey from [[Grayscale_image#Phix|Grayscale_image]]<br>
Note that demo\rosetta\Bitmap_read_ppm.exw is just the last 3 lines with the include ppm.e since that contains the read_ppm() (abeit with a few more options and other tweaks) also used by several other examples, and covers the above requirements. Results may be verified with demo\rosetta\viewppm.exw
<lang Phix>function read_ppm(sequence filename)
<lang Phix>-- demo\rosetta\Bitmap_read_ppm.exw (runnable version)
 
<lang Phix>function read_ppm(sequencestring filename)
sequence image, line
integer dimx, dimy, maxcolor
Line 1,637 ⟶ 1,640:
return image
end function
 
--include ppm.e -- read_ppm(), write_ppm(), to_grey() (as distributed, instead of the above)
sequence img = read_ppm("Lena.ppm")
img = to_grayto_grey(img)
write_ppm("LenaGray.ppm",img)</lang>
 
=={{header|PicoLisp}}==
7,813

edits