home | blog | art | now | git gpg | email | rss

morph

Generate xresources colors from an image.
git clone https://pollux.codes/git/morph.git
Log | Files | Refs | README | LICENSE
commit c706757c33d05f5f4618038cbedf2634974bb147
parent 76c39b1a3a8f45ae65779fb93492a46b5f163e72
Author: Pollux <pollux@pollux.codes>
Date:   Fri, 18 Jul 2025 21:01:06 -0500

fix: Divide channels by 255 when loading image.

Signed-off-by: Pollux <pollux@pollux.codes>

Diffstat:
Mmorph.c | 6+++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/morph.c b/morph.c @@ -110,9 +110,9 @@ get_image_pixel_data(const char *path) { for(int pixel = 0; pixel < image_width * image_height; pixel++) { DATA32 color = *(image_data + pixel); - image_pixels[pixel].r = (color & 0x000000ff); - image_pixels[pixel].g = (color & 0x0000ff00) >> 8; - image_pixels[pixel].b = (color & 0x00ff0000) >> 16; + image_pixels[pixel].r = (color & 0x000000ff) / 255.0f; + image_pixels[pixel].g = ((color & 0x0000ff00) >> 8) / 255.0f; + image_pixels[pixel].b = ((color & 0x00ff0000) >> 16) / 255.0f; } imlib_free_image();