mensatt / backend

The backend repository for Mensatt
MIT License
5 stars 2 forks source link

API for image dimensions and color #200

Open StealWonders opened 4 months ago

StealWonders commented 4 months ago

UI team apparently needs this. @maanex could you elaborate on the color properties you need and in which format?

StealWonders commented 4 months ago

cc: @GamerBene19 for image-service integration

maanex commented 4 months ago

The image entity should get three new fields

width: number!
height: number!
preview: number[]

width and height should be self-explanatory, just the image dimensions in px so we can do page layout before the image has loaded.

preview (not settled on the name, open for suggestions) should be an array of colors as rgb integers (e.g. 0x123456) that represents the image but scaled down to a tiny size. We need to decide on a size here but let's say we go with 4x4, that means preview has 4x4=16 numbers which you can think of as a 4x4 image we can render in the client and upscale+blur to create a placeholder for when the image hasn't loaded yet.

This preview value is not urgent at all and can be it's own issue, width and height would be pretty important though.

maanex commented 4 months ago

Width and height should be the original image dimensions, aka the largest size the image is available in. In case that wasn't clear.