owntracks / talk

Questions, talk about OwnTracks
30 stars 4 forks source link

Explicitly allow higher quality card faces #138

Closed atjn closed 2 years ago

atjn commented 2 years ago

Hi :)

While I can't find any official documentation on this, it seems like the face images for cards are generally expected to be PNGs and approximately 40x40 pixels in size. (I am basing this on what I have seen while going through the source code. The faces are usually decoded as PNGs, and in the included face image generator, the images are always reencoded as 40x40 PNGs.)

I think this is an unfortunate restriction, since the small pixel count often makes the faces look blurry. If the images were instead 192x192 pixels, then I believe they would look sharp in every scenario, and if they could be encoded as JPGs, they would often not use more disk space than a 40x40 PNG.

Question 1: Would you be opposed to adding some text to the booklet cards section that formalizes exactly which encodings/sizes are supported?

Question 2: Could the supported encodings be a PNG or JPEG of any size, with a recommendation of 192x192 pixels?

I wouldn't mind writing this section, and possibly also giving a few hints about which encoding to use and how to properly minify the image.

As far as I can tell, using any of these encodings/sizes right now does not actually break any of the official owntracks apps. Despite the fact that they handle the images as PNGs, the underlying libraries actually decode the image based on encoding type sniffing, so they don't mind decoding a PNG with JPEG encoding. And the apps usually set a fixed size on the image, so supplying a larger sized image doesn't change any layout. With that said, the apps should probably be adjusted to properly handle images encoded as JPGs, and the image generator should be adjusted to produce the recommended image type.

jpmens commented 2 years ago

I think I'm the culprit for the 40x40, having determined that the icon was still visible in our Android and iOS apps and ensuring that we transported as little data as possible.

I have tested a 192x192 size PNG and JPEG and both appear to work without visible issues in the apps and in the new version of the Recorder UI you have submitted.

Answer 1: not at all, on the contrary: we would greatly appreciate it.

Answer 2: I think we shouldn't go overboard and should not say any size; I wouldn't like to see people complain that their 16MB snapshot is killing their data plan .. ;-) Kidding aside, I think the tradeoff of 192x192 is a good tradeoff between sharp image and data volume.

Thank you for the suggestion.

atjn commented 2 years ago

Awesome, thank you!

I have some other work I need to attend to right now, but I'll get back to this and update the booklet. I am also considering making a more user friendly app that can crop, resize and minify the image automagically (maybe as an update to the existing webapp).