It is currently Mon Jul 22, 2024 4:26 pm


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 15 posts ] 
Author Message
 Post subject: An improved "posterize" filter
PostPosted: Wed May 11, 2011 11:51 am  (#1) 
Offline
Script Coder
User avatar

Joined: Apr 23, 2010
Posts: 1553
Location: not from Guildford after all
I've never liked that the colors resulting from GIMP's Posterize filter are somewhat random and do not correspond to the colors in the original image. It is also somewhat limited in that the number of resulting RGB colors must be a power of two (e.g., if Levels is "3" then the result has 8 colors, if "5" then 32 colors result, etc.).

Converting the image to Indexed Mode overcomes these limitations, but the entire image must be converted (not just the current layer, or the selected region of the current layer). Nonetheless, I often found myself performing a work-around of dragging a layer to the Toolbox, converting it to Indexed Mode, and then dragging it back.

I finally broke down and wrote a script which automates this task, as well as providing a couple of nice options for smoothing the edges between color transitions. The script does not do anything particularly special but it does seem to be well-behaved and I am basically happy with it (though a better name might be considered; too bad posterize is already taken :( ).

BEFORE:
Image

AFTER:
Image

The new function is added to the Colors menu and the command is named "Quantize". The script is described on my Chiselapp WIKI and a link to the download file is provided therein.

Any bug reports would be welcome.

_________________
Any sufficiently primitive technology is indistinguishable from a rock.


Last edited by saulgoode on Wed May 11, 2011 12:36 pm, edited 2 times in total.

Share on Facebook Share on Twitter Share on Orkut Share on Digg Share on MySpace Share on Delicious Share on Technorati
Top
 Post subject: Re: An improved "posterize" filter
PostPosted: Wed May 11, 2011 12:02 pm  (#2) 
Offline
GimpChat Member

Joined: Apr 12, 2010
Posts: 5870
cool, i also hate the result of the standard filter as its limitations for the number of colors.

I remember you wrote another "posterize" script somehow similar except that each color was in its own layer, i found that really useful for edit . But i lost it and i can't find on chiselapp do you still have it somewhere?

And... will work with gimp 2.7.3 ?

_________________
My 3D Gallery on Deviantart http://photocomix2.deviantart.com/
Main gallery http://www.flickriver.com/photos/photocomix-mandala/
Mandala and simmetry http://www.flickriver.com/photos/photocomix_mandala/

Image

Mrs Wilbress


Top
 Post subject: Re: An improved "posterize" filter
PostPosted: Wed May 11, 2011 12:07 pm  (#3) 
Offline
Script Coder
User avatar

Joined: Apr 23, 2010
Posts: 1553
Location: not from Guildford after all
PhotoComix wrote:
I remember you wrote another "posterize" script somehow similar except that each color was in its own layer, i found that really useful for edit . But i lost it and i can't find on chiselapp do you still have it somewhere?

I recall a script for decomposing Indexed images to separate layers, but it is over five years old and in dire need of updating and migrating to my "official" repository (maybe I will get around to it next weekend).

PhotoComix wrote:
And... will work with gimp 2.7.3 ?

It should, though I've not tested it.

_________________
Any sufficiently primitive technology is indistinguishable from a rock.


Top
 Post subject: Re: An improved "posterize" filter
PostPosted: Wed May 11, 2011 12:18 pm  (#4) 
Offline
GimpChat Member

Joined: Apr 12, 2010
Posts: 5870
Exact that,"decomposing Indexed images " was the technical process but the input, the image could be also RGB/RGBA
and it was a option to reconvert back image mode to rgb, so i somehow seen as a filter to posterize with greater control on the number of colors and, for further edit ,the convenience to have each color on its own layer

_________________
My 3D Gallery on Deviantart http://photocomix2.deviantart.com/
Main gallery http://www.flickriver.com/photos/photocomix-mandala/
Mandala and simmetry http://www.flickriver.com/photos/photocomix_mandala/

Image

Mrs Wilbress


Top
 Post subject: Re: An improved "posterize" filter
PostPosted: Wed May 11, 2011 12:26 pm  (#5) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14725
Location: USA
The only error i get in 2.7.3 is gimp-selection-load should be gimp-image-select-item
The filter works nice though. :)

Thanks Saulgoode.

Image

_________________
Image
Edmund Burke nailed it when he said, "The only thing necessary for the triumph of evil is for good men to do nothing."


Top
 Post subject: Re: An improved "posterize" filter
PostPosted: Thu May 19, 2011 2:14 pm  (#6) 
Offline
Script Coder
User avatar

Joined: Apr 23, 2010
Posts: 1553
Location: not from Guildford after all
I have updated the script to correct the mishandling of the alpha channel (avoiding the coercion of partially transparent colors to either 100% opaque or 100% transparent). This is an important fix and if you are using the script, I would recommend updating to latest version.

http://chiselapp.com/user/saulgoode/repository/script-fu/wiki?name=sg-quantize

_________________
Any sufficiently primitive technology is indistinguishable from a rock.


Top
 Post subject: Re: An improved "posterize" filter
PostPosted: Thu May 19, 2011 2:24 pm  (#7) 
Offline
GimpChat Member
User avatar

Joined: Sep 24, 2010
Posts: 12535
Somehow missed this one; thanks Saul. I do look forward to trying this one (maybe my Legos will be better now; lol). Much need imo; Posterize really is lacking. Maybe the folks who wrote Cartoonize could use your algorithm instead of Posterize too. :)

_________________
Lyle

Psalm 109:8

Image


Top
 Post subject: Re: An improved "posterize" filter
PostPosted: Thu May 19, 2011 2:56 pm  (#8) 
Offline
Script Coder
User avatar

Joined: Jul 14, 2010
Posts: 697
sg-

You must have missed my post last year:
http://gimpchat.com/viewtopic.php?f=9&t ... 5449#p5449

-Rob A>

_________________
Image
Fantasy Cartography and Mapping by RobA


Top
 Post subject: Re: An improved "posterize" filter
PostPosted: Thu May 19, 2011 2:59 pm  (#9) 
Offline
GimpChat Member
User avatar

Joined: Sep 24, 2010
Posts: 12535
I didn't see or recall that either Rob, and I actually posted earlier on that thread. lol

:)

_________________
Lyle

Psalm 109:8

Image


Top
 Post subject: Re: An improved "posterize" filter
PostPosted: Thu May 19, 2011 9:19 pm  (#10) 
Offline
Retired Staff
User avatar

Joined: May 22, 2008
Posts: 6947
Location: Somewhere in GIMP
I used the frog from the GIMP game post. I played with the settings and this one is the one I like best. Nice filter!

Image

_________________
Image
World War IV will be fought with sticks and stones. - Albert Einstein


Top
 Post subject: Re: An improved "posterize" filter
PostPosted: Thu May 19, 2011 9:24 pm  (#11) 
Offline
GimpChat Member

Joined: Feb 06, 2011
Posts: 342
I like the filter too Saul. Thanks!!!

Liana


Attachments:
hiefers quantize.png
hiefers quantize.png [ 1.41 MiB | Viewed 1839 times ]
chicken house sg-quantize.png
chicken house sg-quantize.png [ 339.6 KiB | Viewed 1839 times ]
Top
 Post subject: Re: An improved "posterize" filter
PostPosted: Fri May 20, 2011 7:32 pm  (#12) 
Offline
Script Coder
User avatar

Joined: Apr 23, 2010
Posts: 1553
Location: not from Guildford after all
RobA wrote:
sg-

You must have missed my post last year:
viewtopic.php?f=9&t=556&p=5449#p5449

Indeed I had. Your palette selection and dithering options are interesting -- and I can see where they might be useful in cartography -- nonetheless I think I'll leave my script in its current state. I just feel it is more suitable to my needs.

@lianam, those are very nice. I particularly like the chicken picture.

_________________
Any sufficiently primitive technology is indistinguishable from a rock.


Top
 Post subject: Re: An improved "posterize" filter
PostPosted: Tue May 24, 2011 1:14 pm  (#13) 
Offline
Script Coder
User avatar

Joined: Jul 14, 2010
Posts: 697
saulgoode wrote:
Indeed I had. Your palette selection and dithering options are interesting -- and I can see where they might be useful in cartography -- nonetheless I think I'll leave my script in its current state. I just feel it is more suitable to my needs.


I just wanted to point it out - nothing like having choice! :)

-Rob A>

_________________
Image
Fantasy Cartography and Mapping by RobA


Top
 Post subject: Re: An improved "posterize" filter
PostPosted: Fri Jun 24, 2011 7:57 pm  (#14) 
Offline
GimpChat Member
User avatar

Joined: Apr 09, 2011
Posts: 1764
they all look great!


Top
 Post subject: Re: An improved "posterize" filter
PostPosted: Sat Jun 25, 2011 7:29 am  (#15) 
Offline
GimpChat Member
User avatar

Joined: Apr 08, 2010
Posts: 5420
Location: Northwest Ohio
A little comparison of different filters. All default or minimal changes except the G'mic...had to mess with it to get a decent picture.
Image

oops, forgot default Quantize filter!
Image
and Robs indexed poster script at default settings.
Image


Top
Post new topic Reply to topic  [ 15 posts ] 

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts Attachment(s) "Posterize" filter?

9

No new posts Attachment(s) cli345's cartoon filter as a native GEGL Filter.

10

No new posts Attachment(s) Carve.. filter

3

No new posts Attachment(s) My last Aquarelle filter

21

No new posts Attachment(s) Made with new filter in G'mic

23



* Login  



Powered by phpBB3 © phpBB Group