experiments/img-format/compress.c
2024-05-27 21:30:27 +12:00

31 lines
788 B
C

#include <raylib.h>
#include <stdint.h>
#include <stdlib.h>
int main() {
SetRandomSeed(time(NULL));
int width = 10000;
int height = 10000;
int size = width * height;
uint8_t* data = calloc(sizeof(uint8_t), size);
uint8_t col = GetRandomValue(0, 255);
int count = 0;
for(int x = 0; x < width; x++) {
for(int y = 0; y < height; y++) {
//if(GetRandomValue(0, 500) < 50) {
count++;
col = GetRandomValue(0, 255);
//}
data[y * height + x] = col;
}
}
int comp_size = 0;
uint8_t* compressed = CompressData(data, size, &comp_size);
SaveFileData("img.plif", compressed, comp_size);
printf("%d different color strips, %d -> %d\n", count, size, comp_size);
}