gimp r27756 - in trunk: . plug-ins/common
- From: neo svn gnome org
- To: svn-commits-list gnome org
- Subject: gimp r27756 - in trunk: . plug-ins/common
- Date: Wed, 3 Dec 2008 16:22:57 +0000 (UTC)
Author: neo
Date: Wed Dec 3 16:22:57 2008
New Revision: 27756
URL: http://svn.gnome.org/viewvc/gimp?rev=27756&view=rev
Log:
2008-12-03 Sven Neumann <sven gimp org>
* plug-ins/common/file-tiff-save.c (save_image)
(image_is_monochrome): allow to save images that are plain white
or
plain black using the CCITT Fax compression methods.
Modified:
trunk/ChangeLog
trunk/plug-ins/common/file-tiff-save.c
Modified: trunk/plug-ins/common/file-tiff-save.c
==============================================================================
--- trunk/plug-ins/common/file-tiff-save.c (original)
+++ trunk/plug-ins/common/file-tiff-save.c Wed Dec 3 16:22:57 2008
@@ -425,13 +425,13 @@
if (colors)
{
- if (num_colors == 2)
+ if (num_colors == 2 || num_colors == 1)
{
- const guchar bw_map[] = { 0, 0, 0, 255, 255, 255 };
- const guchar wb_map[] = { 255, 255, 255, 0, 0, 0 };
+ const guchar bw_map[] = { 0, 0, 0, 255, 255, 255 };
+ const guchar wb_map[] = { 255, 255, 255, 0, 0, 0 };
- if (memcmp (colors, bw_map, 6) == 0 ||
- memcmp (colors, wb_map, 6) == 0)
+ if (memcmp (colors, bw_map, 3 * num_colors) == 0 ||
+ memcmp (colors, wb_map, 3 * num_colors) == 0)
{
monochrome = TRUE;
}
@@ -649,7 +649,7 @@
gint bytesperrow;
guchar *t, *src, *data;
guchar *cmap;
- gint colors;
+ gint num_colors;
gint success;
GimpDrawable *drawable;
GimpImageType drawable_type;
@@ -740,16 +740,16 @@
break;
case GIMP_INDEXED_IMAGE:
- cmap = gimp_image_get_colormap (image, &colors);
+ cmap = gimp_image_get_colormap (image, &num_colors);
- if (colors == 2)
+ if (num_colors == 2 || num_colors == 1)
{
- is_bw = (memcmp (cmap, bw_map, 6) == 0);
+ is_bw = (memcmp (cmap, bw_map, 3 * num_colors) == 0);
photometric = PHOTOMETRIC_MINISWHITE;
if (!is_bw)
{
- is_bw = (memcmp (cmap, wb_map, 6) == 0);
+ is_bw = (memcmp (cmap, wb_map, 3 * num_colors) == 0);
if (is_bw)
invert = FALSE;
@@ -765,7 +765,7 @@
bitspersample = 8;
photometric = PHOTOMETRIC_PALETTE;
- for (i = 0; i < colors; i++)
+ for (i = 0; i < num_colors; i++)
{
red[i] = cmap[i * 3 + 0] * 65535 / 255;
grn[i] = cmap[i * 3 + 1] * 65535 / 255;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]