Posted by
Thomas Delnoij-3 on
May 30, 2006; 4:04pm
URL: http://imagej.273.s1.nabble.com/Basic-question-tp3702635.html
I recently switched from using javax.imageio to ImageJ and I am
running into several basic issues. I hope some of you can help me out.
The requirements are a multi threaded webcrawler that is generating
thumbnails from URL's to Image files (jpg, png and gif). The
thumbnails are written to a predefined directory on the file system.
Thumbnails should be 100px*100px; we need the best possible quality.
File size of the generated thumbails is not so important. Performance
is crucial though. Processing should be done in the backgroung (no
gui).
I started with this code.
ImagePlus ip = new ImagePlus(imageUrl);
ImageProcessor imp = ip.getProcessor();
ImageProcessor imp2 = imp.resize(THUMB_WIDTH, THUMB_HEIGHT);
imp2.setInterpolate(true);
ImagePlus ip2 = new ImagePlus("Resized Image", imp2);
FileSaver fs = new FileSaver(ip2);
JpegWriter.setQuality(100);
fs.saveAsJpeg();
Performance is OK, but the quality of the generated thumbnails is not so good.
Then I read this thread that has some info on improving the quality of
the generated thumbnails:
https://list.nih.gov/cgi-bin/wa?A2=ind0512&L=IMAGEJ&P=R2440&I=-3I tried both IJ.run("","") and IJ.runMacro(String macro) style syntax.
Both give me different types of errors:
- Image locked errors
- A window pops up and no thumbnail is generated
- Runtime exceptions
Some thumbs are generated though and they are much better quality than
before, reason I like to ge this code working.
Now, I think my problems are related to threading issues. I am very
new to ImageJ and probably my question shows my basic ignorance. Still
I hope some of you read so far and can give me some hints or pointers
to some examples.
Rgrds. Thomas Delnoij