Browse Source

Fix segfault

Checking if the type string contains paletted instead of just the current image
leading to palettes attempting to be applied to images without a color buffer
tags/v1.8.0
Xerbo 4 years ago
parent
commit
2d719f4f80
1 changed files with 3 additions and 3 deletions
  1. +3
    -3
      pngio.c

+ 3
- 3
pngio.c View File

@@ -270,7 +270,7 @@ void prow2crow(float **prow, int nrow, char *palette, rgb_t **crow){
int applyUserPalette(float **prow, int nrow, char *filename, rgb_t **crow){
rgb_t *pal_row[256];
if(!readPalette(filename, pal_row)){
fprintf(stderr, "Could not read palette");
fprintf(stderr, "Could not read palette\n");
return 0;
}

@@ -387,9 +387,9 @@ int ImageOut(options_t *opts, image_t *img, int offset, int width, char *desc, c
if(!greyscale){
prow2crow(img->prow, img->nrow, palette, crow);
}
// Apply a user provided color palette
if(CONTAINS(opts->type, Palleted)){
if(chid == Palleted){
applyUserPalette(img->prow, img->nrow, opts->palette, crow);
}



Loading…
Cancel
Save