Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Twitter started using WebP by default thumbnails format. #31

Open
cxplay opened this issue Aug 2, 2023 · 3 comments
Open

Twitter started using WebP by default thumbnails format. #31

cxplay opened this issue Aug 2, 2023 · 3 comments
Labels
bug Something isn't working fixed

Comments

@cxplay
Copy link

cxplay commented Aug 2, 2023

Currently, downloading from a script results in WebP-formatted images, and occasionally only thumbnails. I'm not sure if this is normal behavior.
In contrast, I would like to be able to use a selectable image format if possible (usually determined by the query parameters).

@AlttiRi AlttiRi added the bug Something isn't working label Aug 3, 2023
@AlttiRi
Copy link
Owner

AlttiRi commented Aug 3, 2023

Damn, it's bad, since there is not only jpg images, but png ones too (~9 %).

So, just replacing webp with jpg will not be an ideal variant.

if (urlObj.searchParams.get("format") === "webp") {
    urlObj.searchParams.set("format", "jpg");
}

But anyway jpg is much better than webp.
To see jpg's compression artefacts you need to use zoom, while webp's artefacts is visible without zooming when you compare it with the original png image version.

While png images have no compression artefacts at all.

Also it's bad to just always use png link to download an image, if the original image is jpg, then the png version will be pixel identical, but with much larger size. And only ~9 % (based on my downloaded images) of images are png, the others are jpg.

I would not want to use Twitter API for images too, especially now, since there is API request's limit.


Currently, I just replace webp with jpg: 982aff3
Dev version link: https://github.com/AlttiRi/twitter-click-and-save/raw/master/twitter-click-and-save.user.js


Well, possibly I need to use API for images too now. Will do it later.

@AlttiRi
Copy link
Owner

AlttiRi commented Aug 3, 2023

Oh, fine, I do not need to use API.

I just need to check does orig URL for jpg format (...?format=jpg&name=orig) returns 404, if it is, then the image is png (format=png&name=orig should return 200 (or 504 if it currently unavailable)).

@AlttiRi
Copy link
Owner

AlttiRi commented Aug 4, 2023

00ad7dc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed
Projects
None yet
Development

No branches or pull requests

2 participants