Skip to content

How to change quality for an image using the base64 encode (or sharp) ? #436

Answered by dougtoppin
rapgodnpm asked this question in Q&A
Discussion options

You must be logged in to vote

@rapgodnpm I am moving this to the Discussions/Q&A as it is more appropriate in that section

Quality changes are associated with the image format and the following is the correct way to specify it in a request.

This was tested using quality values of 100 and 50. The results can be compared using Preview on Mac with Tools->Adjust Color.

The color palette that appears shows a difference between the two along with the returned image file size being smaller for lesser quality values.

const imgReq = JSON.stringify({
    bucket: 'test',
    key: 'test.jpg',
    edits: {
        resize: {
            width: 1000,
            height: 500
        },
        jpeg: {
            quality: 100
       …

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by rapgodnpm
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
2 participants
Converted from issue

This discussion was converted from issue #435 on January 30, 2023 21:04.