Browse Source

Use RGB for palettes instead of RGBA

tags/v1.8.0
Xerbo 4 years ago
parent
commit
c6716c4aab
2 changed files with 5 additions and 5 deletions
  1. BIN
      palettes/N19-June-High-Vegetation.png
  2. +5
    -5
      pngio.c

BIN
palettes/N19-June-High-Vegetation.png View File

Before After
Width: 256  |  Height: 256  |  Size: 78 KiB Width: 256  |  Height: 256  |  Size: 71 KiB

+ 5
- 5
pngio.c View File

@@ -220,8 +220,8 @@ int readPalette(char *filename, rgb_t **pixels) {
}else if(bit_depth != 8){
fprintf(stderr, "Palette must be 8 bit color.\n");
return 0;
}else if(color_type != PNG_COLOR_TYPE_RGBA){
fprintf(stderr, "Palette must be RGBA.\n");
}else if(color_type != PNG_COLOR_TYPE_RGB){
fprintf(stderr, "Palette must be RGB.\n");
return 0;
}

@@ -244,9 +244,9 @@ int readPalette(char *filename, rgb_t **pixels) {

for(int x = 0; x < width; x++)
pixels[y][x] = (rgb_t){
PNGrows[y][x*4],
PNGrows[y][x*4 + 1],
PNGrows[y][x*4 + 2]
PNGrows[y][x*3],
PNGrows[y][x*3 + 1],
PNGrows[y][x*3 + 2]
};
}



Loading…
Cancel
Save