[Insight-users] [insight-users]How to read jpg format and convert to png

汪济航 wangjihang88 at gmail.com
Fri Oct 29 03:50:39 EDT 2010


Hi,

I meet a run-time problem when I try to read the jpg format file and save it
as png. I just simulate the coding in itkPNGImageIOTest.cxx.
The problem may happen in the coding below

// Read in the image
  itk::PNGImageIO::Pointer io;
  io = itk::PNGImageIO::New();
  itk::ImageFileReader<RGBImageType>::Pointer PNGreader;
  PNGreader = itk::ImageFileReader<RGBImageType>::New();
  PNGreader->SetFileName( "demoMeanFilter.jpg" );
  PNGreader->SetImageIO(io);
  PNGreader->Update();
  itk::ImageFileWriter<OutputImageType>::Pointer PNGwriter;
  PNGwriter = itk::ImageFileWriter<OutputImageType>::New();
  PNGwriter->SetInput(PNGreader->GetOutput());
  PNGwriter->SetFileName("demoMeanFilter.png" );
  PNGwriter->SetImageIO(io);
  PNGwriter->Write();

Thanks,

Jihang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20101029/b7875746/attachment.htm>


More information about the Insight-users mailing list