summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Kramm <kramm@quiss.org>2011-08-31 17:54:21 -0700
committerMatthias Kramm <kramm@quiss.org>2011-08-31 17:54:21 -0700
commit09704e81296bef698368499394c37f4cc041d302 (patch)
tree2d794d1a39be4b237c59ec3bf82888041d15e4fe
parentb4251d5ef532fbf3b8ff07666673b29f0277073c (diff)
fixed bug in jpeg encoding
-rw-r--r--lib/jpeg.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/jpeg.c b/lib/jpeg.c
index cdfc1f3e..ddf50f63 100644
--- a/lib/jpeg.c
+++ b/lib/jpeg.c
@@ -247,12 +247,12 @@ int jpeg_save_to_mem(unsigned char*data, unsigned width, unsigned height, int qu
} else if(components == 4) {
unsigned char*data2 = malloc(width*3);
for(t=0;t<height;t++) {
- unsigned char*in = &data[width*3*t];
+ unsigned char*line = &data[width*3*t];
int x;
for(x=0;x<width;x++) {
- in[x*3+0] = data[x*4+1];
- in[x*3+1] = data[x*4+2];
- in[x*3+2] = data[x*4+3];
+ data2[x*3+0] = line[x*4+1];
+ data2[x*3+1] = line[x*4+2];
+ data2[x*3+2] = line[x*4+3];
}
jpeg_write_scanlines(&cinfo, &data2, 1);
}