Login  Register

Jpeg Quality

Posted by Jon Harman on Feb 19, 2007; 11:08pm
URL: http://imagej.273.s1.nabble.com/Jpeg-Quality-tp3700302.html

Hi,

I'd like to make a jpeg save dialog that shows the quality setting and allows the user to change it before saving (I would recommend this usage as the default for ImageJ).  I can see how to set it, but don't know how to get it.  It would also be nice if the quality number could be incorporated into the file save dialog, to reduce the number of clicks needed.  Here is a fragment of my code:

     double jpegqual = 75;
           
    GenericDialog gd1 = new GenericDialog("JPEG Quality, 100 is best");
    gd1.addNumericField("Quality (0-100)",jpegqual,0);
   
    gd1.showDialog();
    if(!gd1.wasCanceled()) {
     jpegqual = gd1.getNextNumber();
     IJ.run("Input/Output...", "jpeg=" + IJ.d2s(jpegqual));
     IJ.run("Jpeg...");
    }

Jon