I've made a programme that reads and displays images
I wanted to be able to save the image in ASCII format, so as to be able to view the value of each pixel so I ended up with this code
.
.
.
int x = mImage->get_Width();
int y = mImage->get_Height();
pic1->ClientSize = System:
rawing::Size(x,y);
ClientSize = System:
rawing::Size((x)+20,
+40);
for (int Xcount = 0; Xcount < mImage->Width; Xcount=Xcount+1)
for (int Ycount = 0; Ycount < mImage->Height; Ycount=Ycount+1)
{
Color xsx = mImage->GetPixel(Xcount,Ycount);
String* zxc = xsx.ToString();
br->WriteLine(zxc);
}
br->Flush();
br->Close();
.
.
.
and the ASCII file looked like this:
Color [A=255, R=213, G=148, B=110]
Color [A=255, R=222, G=162, B=134]
Color [A=255, R=215, G=163, B=141]
Color [A=255, R=227, G=178, B=161]
Color [A=255, R=244, G=195, B=180]
Color [A=255, R=248, G=199, B=185]
Color [A=255, R=250, G=207, B=198]
Color [A=255, R=250, G=207, B=198]
.
.
.
Now I want to be able to open the ASCII file and display the image (the original values of the image have been altered)
and I've come so far with this (note: the images have always the same dimensions 430x286 and 122980 is the lines of the ASCII file)
.
.
.
String* fs = pOFD->FileName;
FileStream* s2 = new FileStream(fs, FileMode::Open, FileAccess::Read);
StreamReader* ss1 = new StreamReader(s2);
for (int skee = 0; skee < 122980; skee = skee+1)
ss1->BaseStream->Seek(skee,SeekOrigin::Begin);
String* line = ss1->ReadLine();
for (int Xcount = 0; Xcount < 430; Xcount=Xcount+1)
for (int Ycount = 0; Ycount < 286; Ycount=Ycount+1)
mImage->SetPixel(Xcount, Ycount, line);
.
.
.
the problem is that line is a string and note a color value , so that thing doesn't work
not that if line was a color value would work.
any ideas? any help appreciated
I wanted to be able to save the image in ASCII format, so as to be able to view the value of each pixel so I ended up with this code
.
.
.
int x = mImage->get_Width();
int y = mImage->get_Height();
pic1->ClientSize = System:
ClientSize = System:
for (int Xcount = 0; Xcount < mImage->Width; Xcount=Xcount+1)
for (int Ycount = 0; Ycount < mImage->Height; Ycount=Ycount+1)
{
Color xsx = mImage->GetPixel(Xcount,Ycount);
String* zxc = xsx.ToString();
br->WriteLine(zxc);
}
br->Flush();
br->Close();
.
.
.
and the ASCII file looked like this:
Color [A=255, R=213, G=148, B=110]
Color [A=255, R=222, G=162, B=134]
Color [A=255, R=215, G=163, B=141]
Color [A=255, R=227, G=178, B=161]
Color [A=255, R=244, G=195, B=180]
Color [A=255, R=248, G=199, B=185]
Color [A=255, R=250, G=207, B=198]
Color [A=255, R=250, G=207, B=198]
.
.
.
Now I want to be able to open the ASCII file and display the image (the original values of the image have been altered)
and I've come so far with this (note: the images have always the same dimensions 430x286 and 122980 is the lines of the ASCII file)
.
.
.
String* fs = pOFD->FileName;
FileStream* s2 = new FileStream(fs, FileMode::Open, FileAccess::Read);
StreamReader* ss1 = new StreamReader(s2);
for (int skee = 0; skee < 122980; skee = skee+1)
ss1->BaseStream->Seek(skee,SeekOrigin::Begin);
String* line = ss1->ReadLine();
for (int Xcount = 0; Xcount < 430; Xcount=Xcount+1)
for (int Ycount = 0; Ycount < 286; Ycount=Ycount+1)
mImage->SetPixel(Xcount, Ycount, line);
.
.
.
the problem is that line is a string and note a color value , so that thing doesn't work
not that if line was a color value would work.
any ideas? any help appreciated