Posted by
Bilal Ahmed-2 on
Dec 08, 2005; 7:51pm
URL: http://imagej.273.s1.nabble.com/thumbnail-quality-tp3704288p3704292.html
Thanks Wayne. Really appreciate your help. I got it to work.
-----Original Message-----
From: ImageJ Interest Group [mailto:
[hidden email]] On Behalf Of Wayne
Rasband
Sent: Wednesday, December 07, 2005 2:02 PM
To:
[hidden email]
Subject: Re: thumbnail quality
> Thanks for your help.? Since I am using the API only to
> generate thumbnails, I wouldn't have access to the plugin.?
> I did however saw your code at
>
http://rsb.info.nih.gov/ij/plugins/download/> Averaging_Reducer.java.? Is there a way I can just
> call the methods to clear the images?
You can copy the methods from Averaging_Reducer.java and paste them
into your program.
> ? I believe
> macros need to be run via the cmd shell, not java source.?
> Is that the right assumption?
Java programs can execute ImageJ commands, which is what this macro is
doing, by calling IJ.run(). Here is an example:
IJ.run("Duplicate...", "title=Thumbnail");
IJ.run("Gaussian Blur...", "radius=2");
IJ.run("Size...", "width=100 height=100 constrain interpolate");
IJ.run("Enhance Contrast", "saturated=0.1");
Java programs can also run macros using the IJ.runMacro() method, for
example:
String macro = "run('Duplicate...', 'title=Thumbnail')"
+"run('Gaussian Blur...', 'radius=2')"
+"run('Size...', 'width=100 height=100 constrain interpolate')"
+"run('Enhance Contrast', 'saturated=0.1')";
IJ.runMacro(macro);
-wayne
> -----Original Message-----
> From: ImageJ Interest Group [mailto:
[hidden email]] On Behalf Of
> Rasband Wayne
> Sent: Tuesday, December 06, 2005 6:59 PM
> To:
[hidden email]
> Subject: Re: thumbnail quality
>
> > I am using ImageJ Java API to create thumbnails.? It seems
> > like the quality gets worse as the image gets smaller.? Is
> > there a way to? enhance
> > the image quality?
>
> Try the Averaging Reducer plugin at "
http://rsb.info.nih.gov/ij/> plugins/reducer.html". If you can't use a plugin, try smoothing
> the?image, reducing it and then enhancing the contrast.
> Here is a macro?that does this:
>
> ??? run("Duplicate...", "title=Thumbnail");
> ??? run("Gaussian Blur...", "radius=2");
> ??? run("Size...", "width=100 height=100 constrain interpolate");
> ??? run("Enhance Contrast", "saturated=0.1");
>
> -wayne