You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I run a social media scheduling tool and Twitter requires that images don't exceed 524kb.
Is it possible, using this library, to automatically create the "perfect" combination of scaling and quality to achieve a target size of 524kb?
For example, if an image is 10,000 pixels wide and is 10mb and optimising it to a combination 2,000 pixels wide and 90% quality would make it 523kb then we go with that.
The preference would be a minimum of 90% quality and as high a resolution as possible.
Any ideas?
The text was updated successfully, but these errors were encountered:
I think it is difficult to decide the best combination of resizing and reducing by each image.
However, this processor treats an image as Buffer, so you can confirm image size easily. So probably you can try to resize/reduce with several different parameters in the same process and choose the best result from theirs.
// try to resize with three of paramtersreturnPromise.all([newImageResizer(Object.assign({},this.options,{quality: n1}).exec(image),newImageResizer(Object.assign({},this.options,{quality: n2}).exec(image),newImageResizer(Object.assign({},this.options,{quality: n3}).exec(image)]).then(results=>{// choose the best result from three of result by looking `Buffer.byteLenth(image.data)`});
You can do it on reducing image as same as above.
But of course, Lambda will use more memory for multiple processing, so you need to consider about it.
I run a social media scheduling tool and Twitter requires that images don't exceed 524kb.
Is it possible, using this library, to automatically create the "perfect" combination of scaling and quality to achieve a target size of 524kb?
For example, if an image is 10,000 pixels wide and is 10mb and optimising it to a combination 2,000 pixels wide and 90% quality would make it 523kb then we go with that.
The preference would be a minimum of 90% quality and as high a resolution as possible.
Any ideas?
The text was updated successfully, but these errors were encountered: