tumblr / docs

Tumblr's public platform documentation.
Apache License 2.0
109 stars 27 forks source link

Media type is wrong #78

Closed fireattack closed 2 years ago

fireattack commented 2 years ago
https://api.tumblr.com/v2/blog/ringocya/posts?api_key={yourkey}&id=678624056317231104&npf=1

Response (part):

"content": [
{
"type": "image",
"media": [
{
"media_key": "b8ecf797e9ccece1cb01970974e8db3d:712656fba0eed346-f9",
"type": "image/png",
"width": 2048,
"height": 1486,
"url": "https://64.media.tumblr.com/b8ecf797e9ccece1cb01970974e8db3d/712656fba0eed346-f9/s2048x3072/ec9c95d091f505fb016c5d6b8b1380415340144d.png",
"colors": {
"c0": "c06c47",
"c1": "ffffff"
}
},
{
"media_key": "b8ecf797e9ccece1cb01970974e8db3d:712656fba0eed346-f9",
"type": "image/png",
"width": 1280,
"height": 929,
"url": "https://64.media.tumblr.com/b8ecf797e9ccece1cb01970974e8db3d/712656fba0eed346-f9/s1280x1920/eae6f0ca7b7b9e63f7415adb7791b7e7eea72c73.png",
"colors": {
"c0": "c06c47",
"c1": "ffffff"

It says "type": "image/png", and has a .png suffix, but the image is actually JPEG.

>curl "https://64.media.tumblr.com/b8ecf797e9ccece1cb01970974e8db3d/712656fba0eed346-f9/s2048x3072/ec9c95d091f505fb016c5d6b8b1380415340144d.png" -o out.png
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  557k  100  557k    0     0  6197k      0 --:--:-- --:--:-- --:--:-- 6266k

>magick identify out.png
out.png JPEG 2048x1486 2048x1486+0+0 8-bit sRGB 571130B 0.000u 0:00.002
cyle commented 2 years ago

Hey @fireattack -- this is expected behavior. We have a byte-size cap for serving PNG files, and our image serving service will fall back to a JPEG when that cap is exceeded. We also mentioned recently on Changes that we're trying out various image serving optimization tactics, which may cause output like this.

fireattack commented 2 years ago

I don't get it.

our image serving service will fall back to a JPEG

I understand this part.

But then it should be marked as JPEG, since it's JPEG.