Oddbean new post about | logout
 Folks, check the size of your profile image. Many folks are using massive 10MB gifs, some 50MB gifs. 

This takes seconds to load on mobile if it loads at all.

Your readers are wasting a lot of data simply trying to download your profile picture before reading your post.

Just as a reference, my profile pic is 800x800 pixels (which is super high resolution) and only consumes 57kb. 
 Nah I like serving my high def photo straight from my web server. 
 ? It's about the size, not the server choice. 
 Nah, I meant I just like the act of serving my profile image in hi def (and it just happens to be from my server) 
 That’s the dumb way to look at it. Anyone can use only a few pixels out of you “high-res” pfp, 400x400 px max on any of the clients. Makes the whole experience for everyone shit with hundreds of megabytes wasted on mobile fees for absolutely nothing. Take a look at what normally people will see 🐶🐾🫡
P.S. Not to say that most people in developing countries have very limited bandwidth. https://i.nostr.build/4C6s1MaKumbbkNcH.jpg  
 I'm in that developing country 😎 
 194KB 🫂🎨 
 What’s the best way to check the file size if you just have the nostr.build link? 
 Download it (click on the image and save to gallery) and open the files app to see the size 
 Mine is the entirety of star wars the empire strikes back in gif format 
 Be ungovernable 🫡 
 Things that need to be said
nostr:nevent1qqswtsvwkygau7jlp06wrdmzy6t4z6fwx3ezsmzhd7dkg6eshrva49spz4mhxue69uhhyetvv9ujuerpd46hxtnfduhsygzxpsj7dqha57pjk5k37gkn6g4nzakewtmqmnwryyhd3jfwlpgxtspsgqqqqqqsjhux8c 
 Yeah this is absolutely something that most people don’t realize how much data it costs. This is why I think optimizing client side is the best approach. Ffmpeg is magical for this. Auto converting gifs to webp has been huge for data savings. Then obviously png to jpeg for normal images. And can also downgrade to an “official size” so that anything uploaded larger than 1000x1000 (or whatever) gets resized down to that, then optimized for data. 
 Maybe clients should have reasonable default size limits for  profile/banner images. 
 Wen svg profile imgs?

Many of them are simple graphics, and they could totally be SVGs. 
 It should work with SVG as well.  
 I'll have to try it! 
 You can host it on https://svgshare.com/ 
 Woah, this might mean I can make my green heart image even smaller 🤯 
 why does anyone use gif? webp is way superior in quality and file size 
 Gifs should be removed 
 And give up my animated profile picture? NEVER. 😂🤣 
 Switch to webp. It will look better too 
 Gonna try and make a 2gb profile pic now… 
 165kb isn't too bad for mine. Animated profile images are cool, and all, but you're right: they are a beast for mobile data. A 50MB image costs ~$0.05 to download. Multiply that by repeat downloads and multiple people doing that, and your data plan is shot. 
 Most people have between 1GB and 2 GB of disk space available for amethyst. If the cache is full, Amethyst will be downloading the 50MB image every time you see a post from the user. If the app goes to the background and back and there is no disk space, it downloads again. 

So, costs multiply by a LOT with regular use. 
 also consider you may be doing caching wrong 

wtf are you storing the original image for? resize and optimize it 
 I want a centralized server scaling images. The scaling happens on the phone, but only after the full download.  
 * don't want.  
 I said just that
Download image, resize, cache for further use the smaller version 
 I have tried that. It doesnt work. 

Amethyst requires many image sizes, including the original size. Even without the original size, rescaling for all sizes the app can use takes more space than just keeping the original.  
 For profile pictures you do not need the original size usually.

Have a proper cache with mixed LRU/LFU and store 2 sizes: the original, and a smaller optimized version that can be on-demand scaled down to whatever you need. 
 It's funny that you think I don't have a proper cache even though I use state of the art caching system. 
 Also, scaling is not an issue since most Gif pictures are close to the size on the screen. The real culprit is the animation and the time of the gif. 
 can we just stop having GIFs and use APNG and/or normal video files 
 My animated profile pic is 128kB

It can be optimized. 
 $ curl -I https://vitorpamplona.com/images/me_300.jpg
...
content-length: 29297

ignore images that are too large based on http headers content-length

ignore gifs because gif is stale file format

when adding profile pic, make client side compression to eg 500x500 webp

further optimization:
there could be two profile pic files. one small, and one larger when you open profile or click to view full size image

//

you cannot expect any specific behaviour from users. anyone can set any size of profile pic. you can however make clients not to download those. 
 Way ahead of you 😎

If your client sees an up to date pfp for me it should be a tiny PNG of the heart I made for digit by shuba duck on /r/place 2022

If your client sees an out of state pfp it should be an animated image of a stream moving in reverse I painstakingly compressed to the most efficiency I could achieve judging by eye in webp 
 I'm not gonna say a number but my current PNG is really tiny 
 Everyone needs to learn how to optimize gifs. Use ezgif.com to check the size and reduce if necessary and nostr.build to upload your profile image. 
 mine is 400x400 156kb png uploaded to twitter (thx to elon for the free file storage) probably will easily load 99% of the time 
 Is it possible to limit on client side? Not downloading more than 300kb and if not enough show as avatar for the person "image too big, tap to download anyway". 
 Internet 101 peeps