Default quality in juce_writeJPEGImageToStream


#1

in juce_writeJPEGImageToStream()

    if (quality < 0.0f)
        quality = 6.0f;
    jpeg_set_quality (&jpegCompStruct, jlimit (0, 100, roundFloatToInt (quality * 100.0f)), TRUE);

should be

    if (quality < 0.0f)
        quality = 0.6f; // <-- here
    jpeg_set_quality (&jpegCompStruct, jlimit (0, 100, roundFloatToInt (quality * 100.0f)), TRUE);

isn’t it ?


#2

yep, but better put quality = 0.85 by default at least… a quality less than 80 produce a lot of artifacts in jpeg images…


#3

ok, sounds sensible. Thanks chaps.


#4

By the way, sort of related, in the same method, it would be really nice to be able to set the DPI resolution of the JPEG. I did this by adding:

jpegCompStruct.write_JFIF_header = 1; jpegCompStruct.JFIF_major_version = 1; jpegCompStruct.JFIF_minor_version = 2; jpegCompStruct.density_unit = 1; jpegCompStruct.X_density = 300; //These could be a variable jpegCompStruct.Y_density = 300; //...

somewhere after the call to: