pqina / filepond-plugin-image-transform

🖼 Client-side image transformations for FilePond
https://pqina.nl/filepond
MIT License
18 stars 8 forks source link

imageTransform is re-compressing (even when no changes) unless imageTransformOutputMimeType is set #27

Open tomdav999 opened 3 years ago

tomdav999 commented 3 years ago

Describe the bug

imageTransform is re-compressing (even when no changes) unless imageTransformOutputMimeType is set

Logs

n/a

To Reproduce

    FilePond.registerPlugin(
        FilePondPluginFileValidateSize,
        FilePondPluginImageExifOrientation,
        FilePondPluginImagePreview,
        FilePondPluginImageTransform
    );

//  do not set resize, crop, or set any other transform related options (other than those below) to isolate bug 

Case 1

    FilePond.setOptions({
//  do not set imageTransformOutputMimeType
    });

upload a jpeg imageTransform will transform (re-compress) the jpeg

Case 2

    FilePond.setOptions({
    imageTransformOutputMimeType: 'image/jpeg',
    });

upload a jpeg imageTransform will not transform the jpeg

Expected behavior Case 1: imageTransform should not transform (re-compress) the jpeg since the mime type has not changed. One way around this is to set imageTransformOutputQualityMode: 'optional'. However, this is only works if imageTransformOutputQuality is set to a number (not browser default), so basically, to preserve mime type and avoid recompression one is forced to set imageTransformOutputQualityMode: 'optional' and imageTransformOutputQuality to a number.

Case 2: behaving as expected.

Stacktraces

n/a

Information about your project:

Windows 10, latest firefox, latest filepond

Additional context

n/a