Java how to set jpg quality
<p>Just wanting to get some code edited so that the output jpg quality isn't the default low quality setting that </p>

<pre><code>try
        {
            ImageIO.write(var6, "jpg", var7);
        }
</code></pre>

<p>.....is using currently. </p>

<p>I've looked at some other java examples of setting quality, not being very familiar with Java I'm having trouble understanding how to plug stuff in and rework some examples, that I've seen on using Java to set image quality. </p>

<pre><code>ImageWriteParam iwparam = new JPEGImageWriteParam(Locale.getDefault());
    iwparam.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
    iwparam.setCompressionQuality(quality);
    writer.write(null, new IIOImage(image, null, null), iwparam);
</code></pre>

<p>Here is the code I'm trying to get work........ </p>

<pre><code>public static String func_74292_a(File par0File, String par1Str, int par2, int par3)
{
    File var4 = new File(par0File, "screenshots");
    var4.mkdir();
    int var5 = par2 * par3;

    if (field_74293_b == null || field_74293_b.capacity() &lt; var5)
    {
        field_74293_b = BufferUtils.createIntBuffer(var5);
        field_74294_c = new int[var5];
    }

    GL11.glPixelStorei(GL11.GL_PACK_ALIGNMENT, 1);
    GL11.glPixelStorei(GL11.GL_UNPACK_ALIGNMENT, 1);
    field_74293_b.clear();
    GL11.glReadPixels(0, 0, par2, par3, GL12.GL_BGRA, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, field_74293_b);
    field_74293_b.get(field_74294_c);
    func_74289_a(field_74294_c, par2, par3);
    BufferedImage var6 = new BufferedImage(par2, par3, 1);
    var6.setRGB(0, 0, par2, par3, field_74294_c, 0, par2);

    if (par1Str == null)
    {
        var7 = func_74290_a(var4);
    }
    else
    {
        var7 = new File(var4, par1Str);
    }

    try
    {
        ImageIO.write(var6, "jpg", var7);
    }
    catch (IOException var8)
    {
        ;
    }

    Thread var7x = new Thread(new ScreenShotHelper$1());
    var7x.start();
    return "\u00a7aUploading Screenshot....";
}

private static File func_74290_a(File par0File)
{
    String var1 = dateFormat.format(new Date()).toString();
    int var2 = 1;

    while (true)
    {
        File var3 = new File(par0File, var1 + (var2 == 1 ? "" : "_" + var2) + ".jpg");

        if (!var3.exists())
        {
            return var3;
        }

        ++var2;
    }
}
</code></pre>
