Search code examples
apiimage-processingimage-optimization

Pixellena Light API does not return optimized image


Running the Light API of Pixellena I get a message similar to Not possible to create a webp that has a smaller size and also preserves quality of the original file, and my call does not return an image. How can I fix this so that I get the resulting optimized image?


Solution

  • It is a good question! It is explained on the Pixellena FAQ page, but actually it does not give any solution there. There is a solution though. You can use the Lux API instead, and set the max_overhead parameter to get an optimized image. With this parameter set you can get an optimized image bigger than the original image times the value of this parameter, as mentioned on their doc. e.g 'original image size: 10KB, max_overhead: 10, you can get an optimized image till 100KB'. Of course it can be smaller than 100KB. In fact the API will find the smaller one possible. ​ See below how you should set the adjustments for that: ​

    {
        "encoder": {
            "max_overhead": 10
        }
    }
    

    ​ Please give it a try. Hope that it can help you.