ogres icon indicating copy to clipboard operation
ogres copied to clipboard

Use Webp instead of JPG to let tokens keep transparency

Open ianfhunter opened this issue 6 months ago • 3 comments

image

ianfhunter avatar Jun 30 '25 09:06 ianfhunter

I'm mostly on board with this change but a few things need to happen before we can do this, will follow up in another comment shortly.

samcf avatar Jul 02 '25 19:07 samcf

The one visual quirk with transparent tokens like that is that there is a Player flag which wraps the token in a gold ring base, and this looks a little awkward with transparent images. I'm open to ideas about ways to better represent a "Player" flag.

Screenshot 2025-07-03 at 10 50 35 AM

A technical limitation is that Safari does not support exporting a <canvas> as Webp and will instead use PNG as a fallback. Converting all images blindly to Webp would mean that Safari users would be pretty much unable to use scene images since their filesize would explode as PNG.

MDN Browser Compatibility

This is kind of why props are not very usable for Safari at the moment: image.cljs#L205-207

Users should still have the option of using a flat background color for token images with transparency since there are many instances of the official digital art of a creature using transparency. For example the art of Animated Armor (https://www.dndbeyond.com/monsters/16786-animated-armor) has a transparent background but is not in the style of your example. Forcing users to preprocess the image to add the background themselves is not an option.

I think I will be adding an area for token options in the "Edit images" dialog and being able to toggle transparency on or off from a token seems like the right call here.

Transparency is a good idea but these issues would need to be addressed before considering for merge.

samcf avatar Jul 03 '25 17:07 samcf

Perhaps there could be separate functions for scenes and tokens/props. I don't see much need for transparency in a scene and I guess the impact of filesize is less with the small images.

I think your idea about the token options is also the correct call. You could even have it select a specific background colour for extra customisation. (e.g. that armour might look bad with a white background, but another monster like a Shadow might look bad with a black background)

I don't think the player indication looks too bad, but I also amn't really sure how it's used in others's games as overwhelmingly, my games would have different player avatars than NPCs, so wouldn't really need it.

ianfhunter avatar Jul 04 '25 10:07 ianfhunter