Quantcast

Reduce the number of colors on a selection

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Reduce the number of colors on a selection

Pere Pujal i Carabantes-2
Hi all!

I want to reduce the number of colors like image->mode->indexed does,
but just on the selected parts, not in the whole image.


Any hints?

Thanks
Pere

_______________________________________________
Gimp-user mailing list
[hidden email]
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Reduce the number of colors on a selection

vt-2
On Sunday 02 March 2008 20:49:48 Pere Pujal i Carabantes rašė:

> Hi all!
>
> I want to reduce the number of colors like image->mode->indexed does,
> but just on the selected parts, not in the whole image.
>
>
> Any hints?
>
> Thanks
> Pere

Right cllick on selection > Colors> Posterize
_______________________________________________
Gimp-user mailing list
[hidden email]
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Reduce the number of colors on a selection

Pere Pujal i Carabantes-2
Hi vt, thanks for the reply.

El dg 02 de 03 del 2008 a les 21:12 +0200, en/na vt va escriure:
> On Sunday 02 March 2008 20:49:48 Pere Pujal i Carabantes rašė:

> > I want to reduce the number of colors like image->mode->indexed does,
> > but just on the selected parts, not in the whole image.

>
> Right cllick on selection > Colors> Posterize

Acording to what I've find on the web(and on my tests), posterize
doesn't take the colors from the image like image->mode->indexed does.

Anyway, I'm unable to find a suitable equivalence from number of
colors on indexed to number of levels on posterize, some doc?

Thanks
Pere

_______________________________________________
Gimp-user mailing list
[hidden email]
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Reduce the number of colors on a selection

Chris Mohler
Maybe this:

1. Copy your selection
2. Edit->Paste as New
3. Image->Mode->Indexed
4. Image->Mode-RGB
5. Select All
6. Copy
7. Paste back into original image

I used to do something similar in Photoshop when I wanted to bitmap
just a portion of an image.

HTH,
Chris
_______________________________________________
Gimp-user mailing list
[hidden email]
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Reduce the number of colors on a selection

Pere Pujal i Carabantes-2
Hi Chris, thanks for the reply.

El dg 02 de 03 del 2008 a les 15:47 -0600, en/na Chris Mohler va
escriure:

> Maybe this:
>
> 1. Copy your selection
> 2. Edit->Paste as New
> 3. Image->Mode->Indexed
> 4. Image->Mode-RGB
> 5. Select All
> 6. Copy
> 7. Paste back into original image
>
8 close the auxiliar image
9 confirm that I don't want to save...

To many steps, but it does just what I need, so here is a little script
implementing that, it appears at colors->index-selection:

;; Copyright 2008 by Pere Pujal i Carabantes
;; License GNU/GPL
;; Author Pere Pujal i Carabantes

(define (script-fu-index-selection
         image
         drawable
         p-type
         number-of-colors
         palette
         remove-unused
         d-type
         alpha-dither
         )

  (let*(
        (dither-type (list-ref '(0 1 2 3) d-type))
        (palette-type (list-ref '(0 2 3 4) p-type))
        (indeximage)
        )
    (gimp-image-undo-group-start image)
    (gimp-edit-copy drawable)
    (set! indeximage (car (gimp-edit-paste-as-new)))
    (gimp-image-convert-indexed indeximage  dither-type palette-type
number-of-colors alpha-dither remove-unused palette )
    (gimp-image-convert-rgb indeximage)
    (gimp-selection-all indeximage)
    (gimp-edit-copy (car (gimp-image-get-active-layer indeximage)))
    (gimp-floating-sel-anchor(car (gimp-edit-paste drawable 0)))
    (gimp-image-delete indeximage)
    (gimp-displays-flush)
    (gimp-image-undo-group-end image)
    ))

(script-fu-register
 "script-fu-index-selection"
 "<Image>/Colors/Index Selection"
 "Reduces the colors on the current selection."
 "Pere Pujal i Carabantes"
 "Copyright 2008"
 ""
 ""
 SF-IMAGE "Image" 0
 SF-DRAWABLE "Drawable" 0
 SF-OPTION "Palette Type" '("MAKE-PALETTE" "WEB-PALETTE" "MONO-PALETTE"
"CUSTOM-PALETTE")
 SF-ADJUSTMENT "Number of Colors (ignored unless Palette
type=MAKE-PALETTE)" '(255 2 256 1 25 0 0)
 SF-PALETTE "Palette" "Web"
 SF-TOGGLE "Remove unused (ignored if Palette type=MAKE-PALETTE)" FALSE
 SF-OPTION "Dither type" '("NO-DITHER" "Floid Steinberg" "Floid
Steinberg LowBleed" "FIXED")
 SF-TOGGLE "Alpha Dither" FALSE
 )


Hope this helps other people too.
Yours
Pere



_______________________________________________
Gimp-user mailing list
[hidden email]
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
Loading...