Return-Path: <tiff-bounces@lists.maptools.org>
Delivered-To: info@awaresystems.be
Received: (qmail 2487 invoked from network); 21 Nov 2008 23:53:19 -0000
Received: from jack.telenet-ops.be ([195.130.136.5])
          (envelope-sender <tiff-bounces@lists.maptools.org>)
          by angelia.telenet-ops.be (qmail-ldap-1.03) with SMTP
          for <info@awaresystems.be>; 21 Nov 2008 23:53:19 -0000
Received: from mindy.telenet-ops.be (mindy.telenet-ops.be [195.130.136.8])
	by jack.telenet-ops.be (8.13.1/8.13.1) with ESMTP id mALNrJkL022833
	for <info@awaresystems.be>; Sat, 22 Nov 2008 00:53:19 +0100
Received: from localhost (localhost.localdomain [127.0.0.1])
	by mindy.telenet-ops.be (Postfix) with SMTP id 5529860007
	for <info@awaresystems.be>; Sat, 22 Nov 2008 00:53:19 +0100 (CET)
Received: from ladon.telenet-ops.be (ladon.telenet-ops.be [195.130.132.50])
	by mindy.telenet-ops.be (Postfix) with ESMTP id 4DF6B60005
	for <info@awaresystems.be>; Sat, 22 Nov 2008 00:53:19 +0100 (CET)
Received: from duke.maptools.org (r153.dmsolutions.ca [209.217.116.153])
	by ladon.telenet-ops.be (Postfix) with ESMTP id D65D6312773
	for <info@awaresystems.be>; Sat, 22 Nov 2008 00:53:18 +0100 (CET)
Received: from duke.maptools.org (duke.maptools.org [127.0.0.1])
	by duke.maptools.org (8.12.11/8.12.10) with ESMTP id mALNpKbb020188;
	Fri, 21 Nov 2008 18:52:04 -0500
Received: from an-out-0708.google.com (an-out-0708.google.com [209.85.132.247])
	by duke.maptools.org (8.12.11/8.12.10) with ESMTP id mALNpIbZ020185
	for <tiff@lists.maptools.org>; Fri, 21 Nov 2008 18:51:18 -0500
Received: by an-out-0708.google.com with SMTP id c38so518941ana.9
	for <tiff@lists.maptools.org>; Fri, 21 Nov 2008 15:51:16 -0800 (PST)
Received: by 10.100.196.17 with SMTP id t17mr497476anf.84.1227311476919;
	Fri, 21 Nov 2008 15:51:16 -0800 (PST)
Received: from KAM1720 ([72.183.109.32])
	by mx.google.com with ESMTPS id c29sm2703306anc.9.2008.11.21.15.51.14
	(version=SSLv3 cipher=RC4-MD5); Fri, 21 Nov 2008 15:51:15 -0800 (PST)
Message-ID: <AA3BEB0B7F8945CBA7F414ED06B30ED9@KAM1720>
From: "Kevin Myers" <kmyers1@clearwire.net>
To: <tiff@lists.maptools.org>
References: <200811211701.mALH13hu007438@duke.maptools.org><49270B32.9030801@qwest.net><0D422F7834824A26B434F1F21BF500B0@KAM1720><492727A8.3080800@qwest.net>
	<49272E06.1020104@pobox.com>
	<EE9C03880369482ABECA0DB8B6BC7083@KAM1720>
Subject: Re: [Tiff] Re: RGB to palette images
Date: Fri, 21 Nov 2008 17:51:07 -0600
MIME-Version: 1.0
Content-Type: text/plain; format=flowed; charset="iso-8859-1";
	reply-type=response
Content-Transfer-Encoding: 7bit
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 6.00.2900.5512
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579
X-BeenThere: tiff@lists.maptools.org
X-Mailman-Version: 2.1.4
Precedence: list
List-Id: TIFF and libtiff discussion <tiff.lists.maptools.org>
List-Unsubscribe: <http://lists.maptools.org/mailman/listinfo/tiff>,
	<mailto:tiff-request@lists.maptools.org?subject=unsubscribe>
List-Archive: <http://lists.maptools.org/mailman/private/tiff>
List-Post: <mailto:tiff@lists.maptools.org>
List-Help: <mailto:tiff-request@lists.maptools.org?subject=help>
List-Subscribe: <http://lists.maptools.org/mailman/listinfo/tiff>,
	<mailto:tiff-request@lists.maptools.org?subject=subscribe>
Sender: tiff-bounces@lists.maptools.org
Errors-To: tiff-bounces@lists.maptools.org
X-SpamCatcher-Score: 31 [X]

FYI, I just tried using tiffmedian combined with Windows OS file compression 
on the scanned image of a paper version of a similar document to the 
computer generated image file previously tested below.  Results were 
somewhat less favorable, but not really too bad considering the much greater 
color variation in the scanned image.

Using tiffmedian with both 16 and 32 colors resulted in poor color 
reproduction.  I had to use 256 colors to get decent colors from the scanned 
image.  Palettizing combined with file compression shrank the original 24 
bit uncompressed image from 828682 KB to 110980 KB, a compression ratio of 
approximately 7.5 to 1.  For comparison, the compression ratio on the 
computer generated document was 17.5 to 1.  Looks like a smarter color 
reduction algorithm may still be necessary for scanned images.

s/KAM


----- Original Message ----- 
From: "Kevin Myers" <kmyers1@clearwire.net>
To: <tiff@lists.maptools.org>
Sent: Friday, November 21, 2008 16:46
Subject: Re: [Tiff] Re: RGB to palette images


> Frank Warmerdam wrote:
>
>> In the interest of completeness, the normal libtiff command for this
>> task is tiffmedian.  It does not require holding the whole image in RAM.
>>
>> However, it will not exactly preserve the color list from an RGB image 
>> with
>> a very limited number of unique colors (as described) so it is likely not
>> a great solution for the problem.
>>
>
> Actually Frank, that may turn out to be exactly what I needed.  I tried 
> tiffmedian on one of my fairly large images, and it seemed to produce 
> excellent results and was very fast.
>
> By manual count just looking through the original image, I counted 16 
> unique colors.  I did not attempt to count the distinct colors using a 
> program. Here is a summary of the output file size and color reproduction 
> results using different values for the number of color map entries and 
> compared to several variations on the original image:
>
> original image, uncompressed, 302291 KB, original colors (8/24 bit RGB, 
> unprocessed)
> original image, LZW tiff compression, 22611 KB, original colors (8/24 bit 
> RGB, tiff compression only)
> original image, LZW OS compression, 37692 KB, original colors (8/24 bit 
> RGB, OS compression only)
>
> tiffmedian, 16 colors, uncompressed, 100726 KB, fair color reproduction
> tiffmedian, 16 colors, LZW OS compression, 17112 KB, fair color 
> reproduction
>
> tiffmedian, 32 colors, uncompressed, 100726 KB, excellent color 
> reproduction
> tiffmedian, 32 colors, LZW OS compression, 17228 KB, excellent color 
> reproduction
>
> tiffmedian, 256 colors, uncompressed, 100726 KB, excellent color 
> reproduction
> tiffmedian, 256 colors, LZW OS compression, 17232 KB, excellent color 
> reproduction
>
> Since my legacy app can't deal with LZW tiff compression, the second 
> option listed above is out, and all of the uncompressed images are far too 
> big to be practical considering current laptop hard drive sizes and the 
> number of these images that I must have available on a single laptop 
> (thousands!). Using Windows OS file compression alone drastically reduced 
> the file size down to about 38 MB.  But using Windows compression combined 
> with palettizing the image further reduced the file size by a signifcant 
> amount, down to about 17 MB.  The 16 color palettized representation 
> wasn't too good, but using either 32 colors or 256 colors allowed the file 
> size to be reduce to almost the same level with excellent color 
> reproduction.
>
> So, it looks like using tiffmedian with 256 colors and Windows file 
> compression should be a perfectly adequate solution for the color images 
> that I receive which have been programmatically generated using a 
> relatively small number of colors.
>
> Now onto my next problem involving scanned images of similar documents 
> that contain a much larger number of colors due to ink and paper 
> variations, scanner noise, scanner resolution limits, color transitions, 
> etc...
>
> Thanks again!!!
>
> Kevin M.
>
>
> _______________________________________________
> Tiff mailing list: Tiff@lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/tiff
> http://www.remotesensing.org/libtiff/
> 

_______________________________________________
Tiff mailing list: Tiff@lists.maptools.org
http://lists.maptools.org/mailman/listinfo/tiff
http://www.remotesensing.org/libtiff/
