Closed sjorssnoeren closed 6 years ago
I'm uploading images from tinify to AWS and small images (1mb and less) are taking up to 10 seconds, larger images usually take about 30 seconds. Is there any way to fasten this? Server location, Europe, AWS EU-west.
tinify.key = process.env.TINIFY_API_KEY; const buffer = new Buffer(req.body.image, 'base64'); const metadata = imageService.createImageMetadataFromBuffer(buffer, 'products'); const source = tinify.fromBuffer(buffer); const imageSize = imageService.createImageRect(req.body.width, req.body.height); // Resize images const thumbnail = source.resize({ method: 'cover', ...imageSize, }); const retinaThumbnail = source.resize({ method: 'cover', width: Math.ceil(imageSize.width * 2), height: Math.ceil(imageSize.height * 2), }); // Create requests to store images at AWS S3 const thumbnailStoreRequest = thumbnail.store({ ...storeOptions, path: imageService.createPathFromMetadata(metadata), }); const retinaThumbnailStoreRequest = retinaThumbnail.store({ ...storeOptions, path: imageService.createPathFromMetadata(metadata, '@2x'), }); const results = await Promise.all([ thumbnailStoreRequest.location(), retinaThumbnailStoreRequest.location(), ]);
Hi Sjors,
Compression times can depend on a couple of factors:
However these compressions times are not out of the ordinary for the compression.
I'm uploading images from tinify to AWS and small images (1mb and less) are taking up to 10 seconds, larger images usually take about 30 seconds. Is there any way to fasten this? Server location, Europe, AWS EU-west.