AWARE [SYSTEMS] Imaging expertise for the Delphi developer
AWare Systems, Imaging expertise for the Delphi developer, Home TIFF and LibTiff Mailing List Archive

LibTiff Mailing List

TIFF and LibTiff Mailing List Archive
November 2008

Previous Thread
Next Thread

Previous by Thread
Next by Thread

Previous by Date
Next by Date

Contact

The TIFF Mailing List Homepage
This list is run by Frank Warmerdam
Archive maintained by AWare Systems



Valid HTML 4.01!



Thread

2008.11.21 16:50 "24 bit Color to 8 bit Palettized Conversion Utility (tiffcp enhancement/variation?)", by Kevin Myers
2008.11.21 17:29 "Re: 24 bit Color to 8 bit Palettized Conversion Utility (tiffcp enhancement/variation?)", by Frank Warmerdam
2008.11.21 18:49 "Re: 24 bit Color to 8 bit Palettized Conversion Utility (tiffcp enhancement/variation?)", by Bob Friesenhahn
2008.11.21 19:11 "Re: 24 bit Color to 8 bit Palettized Conversion Utility (tiffcp enhancement/variation?)", by Bob Friesenhahn
2008.11.21 19:37 "Re: 24 bit Color to 8 bit Palettized Conversion Utility (tiffcp enhancement/variation?)", by Kevin Myers

2008.11.21 19:37 "Re: 24 bit Color to 8 bit Palettized Conversion Utility (tiffcp enhancement/variation?)", by Kevin Myers

Hi Bob,

Actually the images that I am wanting to perform this processing on are 
already in a sense "color reduced".  They truly contain only a very limited 
number of colors, (unlike the scanned images that you and I were discussing 
offline previously).  So, all I really need is a program that can scan 
through the image identifying each color that actually exists, add those 
colors to a palette, and output the new image using the palettized values. 
So, step 2 from your list below is just a one to one mapping in this case. 
Also, since each color could be directly added to the palette on the fly as 
it is encountered, it would not be necessary to scan the image twice in this 
special case where the actual number of colors in the image (e.g. 16) is 
(much) less than the number of colors that the palette can theoretically 
accomodate (e.g. 256).

Don't know whether there is anything out there that is specifically designed 
to accomodate this special secnario, but that's what I would like, at least 
in theory.  Also, as you have surmised, some of my problems using 
GraphicsMagick/Imagemagick DO occur because the images are too large to load 
into available RAM.

Regards,
Kevin M.


----- Original Message ----- 
From: "Bob Friesenhahn" <bfriesen@simple.dallas.tx.us>
To: "Kevin Myers" <kmyers1@clearwire.net>
Cc: <tiff@lists.maptools.org>
Sent: Friday, November 21, 2008 13:11
Subject: Re: [Tiff] 24 bit Color to 8 bit Palettized Conversion Utility 
(tiffcp enhancement/variation?)


> On Fri, 21 Nov 2008, Bob Friesenhahn wrote:
>>
>> Did you try VIPS?  VIPS is able to accomplish many things without loading 
>> the whole image into memory and it is usually quite fast.  I don't know 
>> if its color reduction works without loading the whole image though since 
>> that would require a several-pass algorithm.
>
> Actually, from looking at the VIPS documentation, I am not finding an 
> algorithm for color reduction at all.  Maybe it does not exist. :-(
> Still, a programmer could use the VIPS API to develop a muti-pass color 
> reduction algorithm.
>
> In order to color reduce you need to
>
>  1) Build a color tree / histogram of the existing colors in the
>     image. This requires reading all the image pixels.
>
>  2) Evaluate the color tree and build a colormap which best
>     approximates it.
>
>  3) Re-read the image pixels and generate colormap indexes which best
>     approximate the image given the colormap which was selected.  This
>     may include dithering.
>
> So it can be seen that to color reduce an image using the color tree / 
> histogram method requires reading the pixels at least twice.  RAM is now 
> about 10,000 times faster than disk so reading from disk multiple times is 
> prohibitive unless the decoded image can not fit in RAM.
>
> Bob
> ======================================
> Bob Friesenhahn
> bfriesen@simple.dallas.tx.us, http://www.simplesystems.org/users/bfriesen/
> GraphicsMagick Maintainer,    http://www.GraphicsMagick.org/
>