[vtkusers] Is there any one know how to generate a JPEG file manually?
Q Ma
s0343497 at sms.ed.ac.uk
Mon Mar 8 19:06:38 EST 2004
Hi, there,
Is there any one know how to generate a JPEG file manually?
I have an arrary of data, grey value for each pixel,and want to output into a
JPEG file.
I use vtkJPEGWriter, with following code:
vtkJPEGWriter *imagewriter=vtkJPEGWriter::New();
imagewriter->SetFileName(imagefilename);
vtkStructuredPoints *im = vtkStructuredPoints::New();
im->SetDimensions(1024,768,1);
vtkFloatArray *scalartemp = vtkFloatArray::New();
im->GetPointData()->SetScalars(scalartemp);
for(int x=0;x<1024;x++)
for(int y=0;y<768;y++)
scalartemp->InsertValue(y*1024+x,(char)(xy[x][y][2]/5));
imagewriter->SetInput(im);
imagewriter->Write();
It does not work. And an error reported like this:
warning: In /var/tmp/BUILD-cedward1/VTK/IO/vtkJPEGWriter.cxx, line 186
vtkJPEGWriter only supports unsigned char input
Can anyone with some help on how to output JPEG file manually?
Thank you very much.
Regards,
Qi
More information about the vtkusers
mailing list