Re: A question on image type converter
Posted by
Albert Cardona on
Dec 03, 2007; 4:41pm
URL: http://imagej.273.s1.nabble.com/A-question-on-image-type-converter-tp3697886p3697887.html
Daan Zhu,
ImageJ makes it much easier for you:
ImagePlus imp = new ij.io.Opener imageOpener.openImage("Img12Bit.tif");
imp.setProcessor(imp.getTitle(), imp.getProcessor().convertToByte(true));
new FileSaver(imp).saveAsJpeg("Img12Bit.jpg");
The paths may have to be absolute for you to control them properly.
Also: to save as jpeg, you don't need to call convertToByte at all.
ImageJ's jpeg saver will convert your image to an RGB in any case
(with scaling as well) and then save that to jpeg.
So the above need only be two lines, not three.
Albert
--
Albert Cardona
http://www.mcdb.ucla.edu/Research/Hartenstein/acardona