Replace GIF/PNG color reduction with libimagequant

Ideas for improvements and requests for new features in XnView Classic

Moderators: XnTriq, xnview

Post Reply
User avatar
foxyshadis
Posts: 383
Joined: Sat Nov 18, 2006 8:57 am

Replace GIF/PNG color reduction with libimagequant

Post by foxyshadis » Sat Dec 13, 2014 12:08 am

This is a suggestion for both XnView and XnViewMP. libimagequant is a BSD licensed library that is tremendously better than the basic Adaptive, Dithered, etc currently in XnView. Anyone who uses them has to admit, the current color reduction methods are holdovers from the 90's, and they aren't very good, often horribly discoloring images at lower depths and creating ugly patterns. All of them could be replaced by this much superior version, except that libimagequant is slower. It'd still be an excellent default, though.

Further, with this, you don't have to convert to palettized color. In fact you never had to, it's just one option, but XnView does anyway, completely destroying any alpha channel.

Comparisons:
Image
libimagequant (19,996):
Image
XnView (20,297, 128 color adaptive):
Image
(Turned transparency off because it was just too ugly with it on.)

The difference just magnifies the more you quantize the color.

User avatar
omniplex
Posts: 127
Joined: Thu Feb 10, 2011 1:52 pm
Location: Hamburg
Contact:

Re: Replace GIF/PNG color reduction with libimagequant

Post by omniplex » Tue Dec 16, 2014 1:14 pm

Random observations: pngquant.org/ shows your examples and offers various tools. The PhotoShop plugin is an 8BI, XnView can't handle that (= supports only 32bit 8BF). To see what you are talking about I tested x128 cq.exe (color quantizer, there's a new version 2014-11-29, I still had the predecessor) and also tested XnView convert to 256 dither none + floyd-steinberg, edit palette transparency on 0, save as PNG.

Summary: You have a point. I'd like an improved variant also supporting more than 256 colours, because XPM (unlike GIF, or PNG with palette) is not limited to 256.

Update: There's also an older French article comparing pngquant, XnView, truepng, cq, imagemagick, gimp, etc.

User avatar
XnTriq
Moderator & Librarian
Posts: 5424
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: Replace GIF/PNG color reduction with libimagequant

Post by XnTriq » Fri Dec 19, 2014 5:00 am

Testing TinyPNG earlier this year left me puzzled. Thanks for clearing that up!

Post Reply