diff --git a/gdk-pixbuf/ChangeLog b/gdk-pixbuf/ChangeLog index 16a1794dd9..4c3952e758 100644 --- a/gdk-pixbuf/ChangeLog +++ b/gdk-pixbuf/ChangeLog @@ -1,3 +1,8 @@ +Mon Sep 13 19:31:34 2004 Matthias Clasen + + * io-jpeg.c (real_save_jpeg): Drop the alpha channel + when saving 4-channel pixbufs. (#152450, Emmanuel Pacaud) + 2004-09-09 Matthias Clasen * makegdkpixbufalias.pl: Use the short prefix "IA__" for diff --git a/gdk-pixbuf/io-jpeg.c b/gdk-pixbuf/io-jpeg.c index 1a42feeb6b..1bf4bede11 100644 --- a/gdk-pixbuf/io-jpeg.c +++ b/gdk-pixbuf/io-jpeg.c @@ -872,6 +872,7 @@ real_save_jpeg (GdkPixbuf *pixbuf, int i, j; int w, h = 0; int rowstride = 0; + int n_channels; struct error_handler_data jerr; ToFunctionDestinationManager to_callback_destmgr; @@ -922,6 +923,7 @@ real_save_jpeg (GdkPixbuf *pixbuf, } rowstride = gdk_pixbuf_get_rowstride (pixbuf); + n_channels = gdk_pixbuf_get_n_channels (pixbuf); w = gdk_pixbuf_get_width (pixbuf); h = gdk_pixbuf_get_height (pixbuf); @@ -994,7 +996,7 @@ real_save_jpeg (GdkPixbuf *pixbuf, while (cinfo.next_scanline < cinfo.image_height) { /* convert scanline from ARGB to RGB packed */ for (j = 0; j < w; j++) - memcpy (&(buf[j*3]), &(ptr[i*rowstride + j*3]), 3); + memcpy (&(buf[j*3]), &(ptr[i*rowstride + j*n_channels]), 3); /* write scanline */ jbuf = (JSAMPROW *)(&buf);