tinify / tinify-python

Python client for the Tinify API.
https://tinypng.com/developers
MIT License
131 stars 21 forks source link

Tinify converts images to JPEG instead of given input type #21

Closed dusanbrankov closed 1 year ago

dusanbrankov commented 1 year ago

When I try to convert a JPG or PNG file to WebP, I get a JPEG file as output without any errors. At first I thought that something in my code was causing this strange behaviour, but then I hardcoded the values and I am still geting the same output.

import tinify

try:
    tinify.key = ...
    tinify.validate()
except tinify.Error as e:
    print(e)

source = tinify.from_file("space-1.jpg")
converted = source.convert(type=["image/webp"])
extension = converted.result().extension
converted.to_file("space-1." + extension)

Output: space-1.jpeg

Am I missing something? Not long ago, everything was working fine. Compressing and resizing still works normally.

ddmicu commented 1 year ago

Hi there,

I just tried the code provided and I had no issues converting an image to webp. Is the image a JPG or just the extension is jpeg? You can send the images and the email used for your tinify account to support@tinypng.com

rolftimmermans commented 1 year ago

Hi! Thank you very much for this report. You are not doing anything wrong. We had an issue that prevented images from being converted properly via the API. This was introduced around 9:00 UTC on June 7 and resolved around 20.30 UTC on the same day.

Could you please confirm whether image conversion is working again properly for you?

dusanbrankov commented 1 year ago

Hi there,

Thanks for the quick replies.

I've just tested it again, converting from JPG to WebP works again, but when I try to convert the same original file to PNG, it also converts to WebP. Also, when I try to convert PNG to JPEG, I get a WebP file as output again.

The output file type is WebP in all cases, so it's not just the extension. The file sizes are identical.

Let me know if you need more information.

ddmicu commented 1 year ago

This issue should be solved now. Thank you for letting us know and we are really sorry for the inconvenience. Could you please let us know the email used for your account so we can provide some free API credits?

dusanbrankov commented 1 year ago

@ddmicu Unfortunately, it still doesn't work when testing with JPG and PNG files. I'm still hardcoding the values just to be sure.

Here's the image I'm using for testing: space-1

ddmicu commented 1 year ago

Probably the image is cached. Could you please try with an image that has not been uploaded to the API in the past 24 hours?

dusanbrankov commented 1 year ago

Ok, it's working now. Thanks for fixing this so quickly.

My email address: dusanbrankov@proton.me