zak
14-04-2010, 17:16
Hi
i have surprised that the ppm image is just an ascii file
it consist of 4 headers
P3
#comments
width hight
255
then just a sets of (3 numbers) to describe the pixel color.
such as 255 0 0 means red and so on.
the attached code will print to a file 2 lines of 4 red pixels, then 2 lines of 4 blue pixels , you can zoom to look at. the good thing is that you can insert more than one space between numbers to make it clear.
read here for a detailed info and other P1-P6 headers uses:
http://en.wikipedia.org/wiki/Netpbm_format
if you have made a picture , then gives you an error when opening it , just drag it to notepad to look for the code; may be the first line a space and not P3 as an example.
Uses "FILE"
Dim myStr As String
myStr = "P3
# 2 lines of red 4 Pixels, Then 2 lines blue 4 Pixels
4 4
255
255 0 0 255 0 0 255 0 0 255 0 0
255 0 0 255 0 0 255 0 0 255 0 0
0 0 255 0 0 255 0 0 255 0 0 255
0 0 255 0 0 255 0 0 255 0 0 255
"
FILE_Save("image.ppm", myStr)
i have surprised that the ppm image is just an ascii file
it consist of 4 headers
P3
#comments
width hight
255
then just a sets of (3 numbers) to describe the pixel color.
such as 255 0 0 means red and so on.
the attached code will print to a file 2 lines of 4 red pixels, then 2 lines of 4 blue pixels , you can zoom to look at. the good thing is that you can insert more than one space between numbers to make it clear.
read here for a detailed info and other P1-P6 headers uses:
http://en.wikipedia.org/wiki/Netpbm_format
if you have made a picture , then gives you an error when opening it , just drag it to notepad to look for the code; may be the first line a space and not P3 as an example.
Uses "FILE"
Dim myStr As String
myStr = "P3
# 2 lines of red 4 Pixels, Then 2 lines blue 4 Pixels
4 4
255
255 0 0 255 0 0 255 0 0 255 0 0
255 0 0 255 0 0 255 0 0 255 0 0
0 0 255 0 0 255 0 0 255 0 0 255
0 0 255 0 0 255 0 0 255 0 0 255
"
FILE_Save("image.ppm", myStr)