villacoop.blogg.se

Image compressor
Image compressor








image compressor

convertSizeįiles whose file type is included in the convertTypes list, and whose file size exceeds this value will be converted to JPEGs. Type: Array or string (multiple types should be separated by commas)įiles whose file type is included in this list, and whose file size exceeds the convertSize value will be converted to JPEGs.By default, the original mime type of the source image file will be used. Note: This option only available for image/jpeg and image/webp images. Be careful to use 1 as it may make the size of the output image become larger. If this argument is anything else, the default values 0.92 and 0.80 are used for image/jpeg and image/webp respectively. Note: This option only available when both the width and height options are specified. Sets how the size of the image should be resized to the container specified by the width and height options. Options: "none", "contain", and "cover".If not specified, the natural height of the original image will be used, or if the width option is set, the height will be computed automatically by the natural aspect ratio. If not specified, the natural width of the original image will be used, or if the height option is set, the width will be computed automatically by the natural aspect ratio. The value should be greater than 0 and should not be greater than the maxHeight. The value should be greater than 0 and should not be greater than the maxWidth. The value should be greater than 0.Īvoid getting a blank output image, you might need to set the maxWidth and maxHeight options to limited numbers, because of the size limits of a canvas element, recommend to use 4096 or lesser.

image compressor

The image's Exif information will be removed after compressed, so if you need the Exif information, you may need to upload the original image as well.If the size of the target image is too large (e.g., greater than 10 MB), you should disable this option to avoid an out-of-memory crash.Don't trust this all the time as some JPEG images have incorrect (not standard) Orientation values.Indicates whether to read the image's Exif Orientation value (JPEG image only), and then rotate or flip the image automatically with the value. The maxHeight option is set and its value is less than the natural height of the image.The maxWidth option is set and its value is less than the natural width of the image.The minHeight option is set and its value is greater than the natural height of the image.The minWidth option is set and its value is greater than the natural width of the image.The height option is set and its value is greater than the natural height of the image.The width option is set and its value is greater than the natural width of the image.The mimeType option is set and its value is different from the mime type of the image.Indicates whether to output the original image instead of the compressed one when the size of the compressed image is greater than the original one's, except the following cases: If you want to change the global default options, You may use tDefaults(options). You may set compressor options with new Compressor(file, options). addEventListener ( 'change', ( e ) => ) Import axios from 'axios' import Compressor from 'compressorjs' document.










Image compressor