It is currently Wed Sep 03, 2014 12:37 am


Latest GIMP Scripts & Plug-ins

All times are UTC - 5 hours [ DST ]




Post new topic Reply to topic  [ 65 posts ]  Go to page 1, 2, 3, 4, 5 ... 7  Next
Author Message
 Post subject: True Pseudogrey in GIMP.
PostPosted: Fri May 11, 2012 2:04 am  (#1) 
Offline
GimpChat Member
User avatar

Joined: Sep 24, 2010
Posts: 6460
Many years ago, I ran across this site and was intriqued with this concept. I was using Sample Colorize but I would inevitably get way too many tones. Only recently (like an hour ago; lol) found out why (you will have to see the tut for the settings). Anyway, Click the link to the tut and you too will be Pseudo Greying (see tut for a cool test that you can try yourself as well and you too will be a believer). :)

Link to Tutorial: http://justpaste.it/pseudog_gimp

ref: http://www.fontplay.com/freephotos/thir ... 108-19.jpg

Image

_________________
Lyle

Psalm 109:8

Image


Share on Facebook Share on Twitter Share on Orkut Share on Digg Share on MySpace Share on Delicious Share on Technorati
Top
 Profile  
 
 Post subject: Re: True Pseudogrey in GIMP.
PostPosted: Fri May 11, 2012 2:09 am  (#2) 
Offline
GimpChat Member
User avatar

Joined: Sep 24, 2010
Posts: 6460
OK; manage to create a gradient with exactly 1786 tones. Count them yourself using Color Cube analysis. I was trying to do a diagonal gradient and never thought to just do a vertical. :)


Attachments:
gradient_1786.png
gradient_1786.png [ 39.16 KiB | Viewed 7192 times ]

_________________
Lyle

Psalm 109:8

Image
Top
 Profile  
 
 Post subject: Re: True Pseudogrey in GIMP.
PostPosted: Fri May 11, 2012 6:26 am  (#3) 
Offline
Script Coder
User avatar

Joined: Apr 23, 2010
Posts: 1263
Location: not from Guildford after all
I had a mind to write a script to perform this... and actually did so (code is in spoiler below), however, it would seem that the Palette Map plug-in does not properly handle palettes with more than 256 colors; so my script does not work. I am only including it as an example of how not to do it (the generation of the palette is correct, though, and should be more accurate than obtained through the gradient method).

I guess one would have to generate a temporary image with the pseudo-gray palette and then use Sample Colorize (I may do this in the future, but have other things occupying my time at the moment). Note that it was not too long ago that Sample Colorize could not effectively be called non-interactively so if script or plug-in is written using this approach, be aware that it will only work with GIMP 2.6.11 or later.

; This program is free software; you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2 of the License, or
; (at your option) any later version.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
; GNU General Public License for more details.

(define (script-fu-sg-pseudo-gray image layer)
  (define (make-pseudo-gray-palette)
    (gimp-progress-set-text "Creating palette...")
    (gimp-palette-new "Pseudo Grays")
    (let loop ((color 0))
      (if (= color 255)
        (begin
          (gimp-palette-add-entry "Pseudo Grays" "white" '(255 255 255))
          (gimp-progress-end) )
        (begin
          (map (lambda (x)
                  (gimp-progress-pulse)
                  (gimp-palette-add-entry "Pseudo Grays"
                                          ""
                                          x ))
                  (let ((grays (make-list 7 (make-list 3 color)))
                        (nears '((0 0 0) (0 0 1) (1 0 0) (1 0 1)
                                 (0 1 0) (0 1 1) (1 1 0) )) )
                    (map (lambda (a b)
                           (map + a b) ) grays nears) ))
          (loop (+ color 1)) ))))
  (gimp-image-undo-group-start image)
  (gimp-context-push)
  (cond
    ((zero? (car (gimp-palettes-get-list "Pseudo Grays")))
      (make-pseudo-gray-palette) )
    ((<> (car (gimp-palette-get-info "Pseudo Grays")) 1786)
      (gimp-palette-delete "Pseudo Grays")
      (make-pseudo-gray-palette) ))
  (gimp-context-set-palette "Pseudo Grays")
  (plug-in-palettemap RUN-NONINTERACTIVE image layer)
  (gimp-displays-flush)
  (gimp-context-pop)
  (gimp-image-undo-group-end image)
  )
 
(script-fu-register "script-fu-sg-pseudo-gray"
  "Pseudo-gray"
  "Desaturate image to 1786 levels of \"near\" grays"
  "Saul Goode"
  "saulgoode"
  "May 2012"
  "RGB*"
  SF-IMAGE    "Image"    0
  SF-DRAWABLE "Drawable" 0
  )
 
(script-fu-menu-register "script-fu-sg-pseudo-gray"
  "<Image>/Colors/"
  )

_________________
A man who does not read good books has no advantage over a man who cannot read them. -- Mark Twain


Last edited by saulgoode on Fri May 11, 2012 4:17 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: True Pseudogrey in GIMP.
PostPosted: Fri May 11, 2012 8:56 am  (#4) 
Offline
GimpChat Member
User avatar

Joined: Sep 24, 2010
Posts: 6460
When you do a black and white gradient map (dragged) properly, it will be a Pseudogrey image as I showed in my followup link; that's what's cool. Once you have a good target (a pseudogrey gradient or the pyrimid that I actually used in the tut) it's child's play for Sample Colorize. I have since noticed that sometimes I have to still run Sample Colorize twice to get 1786 colors (not for the target in the tut though). Still, no real big deal.

Wish I could have the desire to learn how to program Saul, but lost my appetite since I got out of Engineering (and really since college; didn't really have to do much coding as an Analog EE). I'm an idea's guy anyway. I wonder if this could be done in G'MIC? :)

_________________
Lyle

Psalm 109:8

Image


Top
 Profile  
 
 Post subject: Re: True Pseudogrey in GIMP.
PostPosted: Fri May 11, 2012 11:19 am  (#5) 
Offline
GimpChat Member

Joined: Feb 14, 2012
Posts: 274
If you were to make a layer above your greyscale image fill it with white and then run the RGB noise filter with all the color sliders set all the way up to 1.0 and then reduce the opacity of the layer to 2.0 and merge down you can achieve even more shades as shown in the colorcube analysis. But while it looks greyscale it is RGB.

I find this colorcube and sample colorize to be very useful to me in creating smooth raster patterns for 3D height map images. What I do is all the steps above but I also blur the merged image by a setting of 5. Then I do the Sample Colorize as shown in the tutorial and it comes out even smoother.

It actually changes the numbe of colors again, (reducing it) but this seems to result in a smoother image than just doing the blur at a setting of 5.

Thanks for the info Lyle.

Alan


Top
 Profile  
 
 Post subject: Re: True Pseudogrey in GIMP.
PostPosted: Fri May 11, 2012 1:04 pm  (#6) 
Offline
Script Coder
User avatar

Joined: Jul 14, 2010
Posts: 613
lylejk wrote:
When you do a black and white gradient map (dragged) properly, it will be a Pseudogrey image as I showed in my followup link; that's what's cool.


In blend Dialog there are two check-boxes, Dither and Adaptive Super-sampling.

If neither is checked you will get 256 colours.
If both are checked you will get between 1745 and 1754 depending of them supersampling sliders, possibly out of that range, even.
With just Dither Checked I've seen as little as 1660 and as much as 1786

-Rob A>

_________________
Image
Fantasy Cartography and Mapping by RobA


Top
 Profile  
 
 Post subject: Re: True Pseudogrey in GIMP.
PostPosted: Fri May 11, 2012 1:44 pm  (#7) 
Offline
GimpChat Member
User avatar

Joined: Sep 24, 2010
Posts: 6460
Good things to know Rob; never really played with those settings. :)

_________________
Lyle

Psalm 109:8

Image


Top
 Profile  
 
 Post subject: Re: True Pseudogrey in GIMP.
PostPosted: Fri May 11, 2012 4:28 pm  (#8) 
Offline
Script Coder
User avatar

Joined: Apr 23, 2010
Posts: 1263
Location: not from Guildford after all
I have corrected an error in the script in my previous post. I originally had the green and magenta "near gray" values transposed (as exhibited in the following graphic, green has a higher luminosity than magenta.)

Attachment:
pgray.png
pgray.png [ 556 Bytes | Viewed 7039 times ]

_________________
A man who does not read good books has no advantage over a man who cannot read them. -- Mark Twain


Top
 Profile  
 
 Post subject: Re: True Pseudogrey in GIMP.
PostPosted: Sun May 13, 2012 4:07 pm  (#9) 
Offline
GimpChat Member
User avatar

Joined: Sep 24, 2010
Posts: 6460
Just curious Saul; have you made any progress in getting your script to output true Pseudo-grey? :)

_________________
Lyle

Psalm 109:8

Image


Top
 Profile  
 
 Post subject: Re: True Pseudogrey in GIMP.
PostPosted: Sun May 13, 2012 5:41 pm  (#10) 
Offline
Script Coder
User avatar

Joined: Apr 23, 2010
Posts: 1263
Location: not from Guildford after all
lylejk wrote:
Just curious Saul; have you made any progress in getting your script to output true Pseudo-grey? :)

No, I haven't; however, it appears to be possible to create a gradient with thousands of segments. So perhaps it would be feasible to modify my script to create a pseudo-gray gradient (with 1785 segments) which can then be applied using 'plug-in-gradmap', with the caveat being whether gradmap retains more than 8-bit precision when it calculates luminosity.

_________________
A man who does not read good books has no advantage over a man who cannot read them. -- Mark Twain


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 65 posts ]  Go to page 1, 2, 3, 4, 5 ... 7  Next

All times are UTC - 5 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

* Login  

* Subscribe to Gimp Chat's RSS Feed    * Subscribe to Gimp Chat's Tutorial Feed    * Subscribe to Gimp Chat's G'MIC Feed


Powered by phpBB3 © phpBB Group