aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/netpbm.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/netpbm.c b/src/netpbm.c
index 0cf4ca6..d87872f 100644
--- a/src/netpbm.c
+++ b/src/netpbm.c
@@ -120,11 +120,15 @@ int netpbm_read(struct image *img){
img->buf[a++] = val;
}
}else if(b->format == '6'){
- while(left--){
- img->buf[a++] = readvalb(b);
- img->buf[a++] = readvalb(b);
- img->buf[a++] = readvalb(b);
- }
+ if(b->maxval == 255){
+ fread(img->buf, 1, left * 3, f);
+ }else{
+ while(left--){
+ img->buf[a++] = readvalb(b);
+ img->buf[a++] = readvalb(b);
+ img->buf[a++] = readvalb(b);
+ }
+ }
}
img->state = LOADED;