RSS/Atom feed Twitter
Site is read-only, email is disabled

RGB to BGR script works, but how to run auto levels?

This discussion is connected to the gimp-user-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

13 of 13 messages available
Toggle history

Please log in to manage your subscriptions.

RGB to BGR script works, but how to run auto levels? Walter Francis 30 Aug 20:06
  RGB to BGR script works, but how to run auto levels? Guillermo S. Romero / Familia Romero 30 Aug 21:21
   RGB to BGR script works, but how to run auto levels? Walter Francis 31 Aug 02:21
    RGB to BGR script works, but how to run auto levels? Sven Neumann 31 Aug 17:25
     RGB to BGR script works, but how to run auto levels? Sven Neumann 31 Aug 17:57
    RGB to BGR script works, but how to run auto levels? Guillermo S. Romero / Familia Romero 31 Aug 17:33
   RGB to BGR script works, but how to run auto levels? Joao S. O. Bueno 31 Aug 08:10
    RGB to BGR script works, but how to run auto levels? Guillermo S. Romero / Familia Romero 31 Aug 17:44
   RGB to BGR script works, but how to run auto levels? Walter Francis 31 Aug 08:17
  RGB to BGR script works, but how to run auto levels? Joao S. O. Bueno 31 Aug 08:05
   RGB to BGR script works, but how to run auto levels? Sven Neumann 01 Sep 12:08
  RGB to BGR script works, but how to run auto levels? Shawn Willden 31 Aug 08:39
RGB to BGR script works, but how to run auto levels? G.DeSercey@bton.ac.uk 01 Sep 14:19
Walter Francis
2003-08-30 20:06:58 UTC (over 20 years ago)

RGB to BGR script works, but how to run auto levels?

Shooting IR using a Hoya 72A I get a good amount of false colour in the images, and by decomposing RGB and recomposing BGR the sky gets a nice blue cast to it and makes the image look better.

I took apart another script and experimented around and came up with the script at the bottom. This is for gimp 1.3.18, not sure if older versions have different arguments.

I also run auto levels on the images when I'm done, but so far it looks like this is not possible from Script-fu. Any updates on there? At least now I just push two buttons instead of decompose, compose, pick images, etc.

Thanks!

(define (script-fu-irchannelswap inImage inLayer)

(let* ((width (car (gimp-drawable-width inLayer))) (height (car (gimp-drawable-height inLayer))) )

(set! new-image-red (car (plug-in-decompose 1 inImage inLayer "Red"))) (set! new-image-green (car (plug-in-decompose 1 inImage inLayer "Green"))) (set! new-image-blue (car (plug-in-decompose 1 inImage inLayer "Blue"))) (set! new-image-bgr (car (plug-in-compose 1 new-image-blue inLayer new-image-green new-ima ge-red new-image-red "RGB")))
(gimp-display-new new-image-bgr)
(gimp-image-delete new-image-red)
(gimp-image-delete new-image-green)
(gimp-image-delete new-image-blue)
(gimp-displays-flush)

))

(script-fu-register "script-fu-irchannelswap"
"/Script-Fu/Enhance/IR Channel Swap" "Channel Swap and Auto Levels"
"Walter Francis"
"copyright 2003, Walter Francis"
"2003-08-30"
""
SF-IMAGE "The Image" 0
SF-DRAWABLE "The Layer" 0
)

Guillermo S. Romero / Familia Romero
2003-08-30 21:21:38 UTC (over 20 years ago)

RGB to BGR script works, but how to run auto levels?

wally@theblackmoor.net (2003-08-30 at 1406.58 -0400):

I also run auto levels on the images when I'm done, but so far it looks like this is not possible from Script-fu. Any updates on there? At least now I just push two buttons instead of decompose, compose, pick images, etc.

Always use the DB browser to search for things while coding, it is a great help. You can find other interesting filters there, but I think none is exactly what autolevels does. You could even try to do something with histogram, but that would mean some kind of long loop to analysis all the data.

If unable to find something that solves your problem, you should fill a bug, asking for an enhancement ("levels should register a PDB call for auto mode" or whichever useful description you can give).

(set! new-image-red (car (plug-in-decompose 1 inImage inLayer "Red"))) (set! new-image-green (car (plug-in-decompose 1 inImage inLayer "Green"))) (set! new-image-blue (car (plug-in-decompose 1 inImage inLayer "Blue")))

Why not call only one time and work with the list? car gives you the first element, but you can use cadr for the second, and caddr for the third. Try typing (caddr '(1 2 3 4)) and (cadr '(1 2 3 4)) in the Script Fu console to experiment (btw, arrow keys let you edit old commands).

GSR

Walter Francis
2003-08-31 02:21:33 UTC (over 20 years ago)

RGB to BGR script works, but how to run auto levels?

Guillermo S. Romero / Familia Romero wrote:

wally@theblackmoor.net (2003-08-30 at 1406.58 -0400):

I also run auto levels on the images when I'm done, but so far it looks like this is not possible from Script-fu. Any updates on there? At least now I just push two buttons instead of decompose, compose, pick images, etc.

Always use the DB browser to search for things while coding, it is a great help. You can find other interesting filters there, but I think none is exactly what autolevels does. You could even try to do something with histogram, but that would mean some kind of long loop to analysis all the data.

If unable to find something that solves your problem, you should fill a bug, asking for an enhancement ("levels should register a PDB call for auto mode" or whichever useful description you can give).

(set! new-image-red (car (plug-in-decompose 1 inImage inLayer "Red"))) (set! new-image-green (car (plug-in-decompose 1 inImage inLayer "Green"))) (set! new-image-blue (car (plug-in-decompose 1 inImage inLayer "Blue")))

Why not call only one time and work with the list? car gives you the first element, but you can use cadr for the second, and caddr for the third. Try typing (caddr '(1 2 3 4)) and (cadr '(1 2 3 4)) in the Script Fu console to experiment (btw, arrow keys let you edit old commands).

I figured there was a better way, but this is my first one, so I was doing what was obvious (and simple :)

I made one other small change, grabbing the filename so the path and filename was right to save the changed picture, and I experimented with a progress bar but it didn't work quite right.. I'll experiment some more with all that, and might try using a list for the above. I tried "RGB" once but only got the Red, so that's why I split 'em up, a list would be more effecient.

I might very well file a bug asking for an auto levels script-fu, I'm just really surprized there isn't something available already! And yes, I've definately been browsing/searching for stuff, otherwise I'd have gotten stuck and not gotten anything done.

Thanks!

Joao S. O. Bueno
2003-08-31 08:05:27 UTC (over 20 years ago)

RGB to BGR script works, but how to run auto levels?

RGB to BGR script works, but how to run auto levels?

Autolevels is a missing feature on the PDB up to 1.2.5 and 1.3.18 - I've worked in a PDB entry to it together with Shawn Willden. Although I do not know if our contributionis beignn commited into 1.3.19 - I am compiling it now.
(BUG 119233)

Regards,
JS
->

On Saturday 30 August 2003 3:06 pm, Walter Francis wrote:

Shooting IR using a Hoya 72A I get a good amount of false colour in the images, and by decomposing RGB and recomposing BGR the sky gets a nice blue cast to it and makes the image look better.

I took apart another script and experimented around and came up with the script at the bottom. This is for gimp 1.3.18, not sure if older versions have different arguments.

I also run auto levels on the images when I'm done, but so far it looks like this is not possible from Script-fu. Any updates on there? At least now I just push two buttons instead of decompose, compose, pick images, etc.

Thanks!

(define (script-fu-irchannelswap inImage inLayer)

(let* ((width (car (gimp-drawable-width inLayer))) (height (car (gimp-drawable-height inLayer))) )

(set! new-image-red (car (plug-in-decompose 1 inImage inLayer "Red"))) (set! new-image-green (car (plug-in-decompose 1 inImage inLayer "Green"))) (set! new-image-blue (car (plug-in-decompose 1 inImage inLayer "Blue"))) (set! new-image-bgr (car (plug-in-compose 1 new-image-blue inLayer new-image-green new-ima ge-red new-image-red "RGB")))
(gimp-display-new new-image-bgr)
(gimp-image-delete new-image-red)
(gimp-image-delete new-image-green)
(gimp-image-delete new-image-blue)
(gimp-displays-flush)

))

(script-fu-register "script-fu-irchannelswap"
"/Script-Fu/Enhance/IR Channel Swap" "Channel Swap and Auto Levels"
"Walter Francis"
"copyright 2003, Walter Francis"
"2003-08-30"
""
SF-IMAGE "The Image" 0
SF-DRAWABLE "The Layer" 0
)

_______________________________________________ Gimp-user mailing list
Gimp-user@lists.xcf.berkeley.edu
http://lists.xcf.berkeley.edu/mailman/listinfo/gimp-user

Joao S. O. Bueno
2003-08-31 08:10:49 UTC (over 20 years ago)

RGB to BGR script works, but how to run auto levels?

On Saturday 30 August 2003 4:21 pm, Guillermo S. Romero / Familia Romero wrote:

wally@theblackmoor.net (2003-08-30 at 1406.58 -0400):

I also run auto levels on the images when I'm done, but so far it looks like this is not possible from Script-fu. Any updates on there? At least now I just push two buttons instead of decompose, compose, pick images, etc.

Always use the DB browser to search for things while coding, it is a great help. You can find other interesting filters there, but I think none is exactly what autolevels does. You could even try to do something with histogram, but that would mean some kind of long loop to analysis all the data.

If unable to find something that solves your problem, you should fill a bug, asking for an enhancement ("levels should register a PDB call for auto mode" or whichever useful description you can give).

I coded it to almost working and sent to Shawn, said it worked, Bbut I do not know if he uploaded it to Bug 199233, Guilhermo. I will`just look for it there, wait a second. Yup...the patch is there...untested and untouched by those with the appropriate access rights...
http://bugzilla.gnome.org/show_bug.cgi?id=119233

Could someone please do the honors? :-)

(set! new-image-red (car (plug-in-decompose 1 inImage inLayer "Red"))) (set! new-image-green (car (plug-in-decompose 1 inImage inLayer "Green"))) (set! new-image-blue (car (plug-in-decompose 1 inImage inLayer "Blue")))

Why not call only one time and work with the list? car gives you the first element, but you can use cadr for the second, and caddr for the third. Try typing (caddr '(1 2 3 4)) and (cadr '(1 2 3 4)) in the Script Fu console to experiment (btw, arrow keys let you edit old commands).

GSR

Walter Francis
2003-08-31 08:17:22 UTC (over 20 years ago)

RGB to BGR script works, but how to run auto levels?

I have it down to the following (although I'd still love an autolevels ;-), is there any way to pass a list to gimp-image-delete, because I've tried several things and I always get invalid argument. I tried:

(g-i-d new-image-rgb) (g-i-d (new-image-rgb))
(g-i-d '(new-image-rgb))

Must be something I am misunderstanding about lists. Basically trying to slim the three g-i-d's down to one statement. But I did reduce the decompose to one statement with lists (I suspect it's much faster now but I haven't really timed it) and removed some cruft from the script I started from that I didn't need..

(define (script-fu-irchannelswap inImage inLayer)

(set! new-image-rgb (plug-in-decompose 1 inImage inLayer "RGB")) (set! new-image-bgr (car (plug-in-compose 1 (caddr new-image-rgb) inLayer (cadr new-image-rgb) (car new-image-rgb) (car new-image-rgb) "RGB"))) (gimp-display-new new-image-bgr)
(gimp-image-delete (car new-image-rgb)) (gimp-image-delete (cadr new-image-rgb)) (gimp-image-delete (caddr new-image-rgb)) (gimp-image-set-filename new-image-bgr (car (gimp-image-get-filename inImage))) )
(gimp-displays-flush)

(script-fu-register "script-fu-irchannelswap" "/Script-Fu/Enhance/IR Channel Swap" "Channel Swap" "Walter Francis" "copyright 2003, Walter Francis" "2003-08-30" ""
SF-IMAGE "The Image" 0 SF-DRAWABLE "The Layer" 0 )

Shawn Willden
2003-08-31 08:39:51 UTC (over 20 years ago)

RGB to BGR script works, but how to run auto levels?

On Sat August 30 2003 12:06 pm, Walter Francis wrote:

I also run auto levels on the images when I'm done, but so far it looks like this is not possible from Script-fu. Any updates on there?

I submitted a bug report (http://bugzilla.gnome.org/show_bug.cgi?id=119233) and a patch to add a PDB entry for auto levels. If you don't mind applying the patch and building the GIMP yourself, you should be able to get auto levels to work from your script. The patch is at:

http://bugzilla.gnome.org/showattachment.cgi?attach_id=19053

Apply the patch to tools/pdbgen/pdb/color.pdb, then do the typical configure, make, make install process, taking care to add the "--with-pdbgen" option to the configure command line so the PDB code will be updated.

If you're not comfortable with patching and building, you'll probably have to wait until the patch gets applied by the developers. If you use Debian, drop me a line and I'll send you patched versions of the Sid .deb files.

Shawn.

Sven Neumann
2003-08-31 17:25:34 UTC (over 20 years ago)

RGB to BGR script works, but how to run auto levels?

Hi,

Walter Francis writes:

I might very well file a bug asking for an auto levels script-fu, I'm just really surprized there isn't something available already! And yes, I've definately been browsing/searching for stuff, otherwise I'd have gotten stuck and not gotten anything done.

There is a bug-report already and it even has a patch attached to it:

http://bugzilla.gnome.org/show_bug.cgi?id=119233

Sven

Guillermo S. Romero / Familia Romero
2003-08-31 17:33:10 UTC (over 20 years ago)

RGB to BGR script works, but how to run auto levels?

wally@theblackmoor.net (2003-08-30 at 2021.33 -0400):

I might very well file a bug asking for an auto levels script-fu, I'm just really surprized there isn't something available already! And yes, I've definately been browsing/searching for stuff, otherwise I'd have gotten stuck and not gotten anything done.

http://bugzilla.gnome.org/show_bug.cgi?id=119233

GSR

Guillermo S. Romero / Familia Romero
2003-08-31 17:44:10 UTC (over 20 years ago)

RGB to BGR script works, but how to run auto levels?

gwidion@mpc.com.br (2003-08-31 at 0310.49 -0300):

http://bugzilla.gnome.org/show_bug.cgi?id=119233

Yeah, found it too before your mail.

Could someone please do the honors? :-)

Sven added a comment today. Maybe when you get this mail it already got in (with the slow mailing list, probably, at least before the list copy arrives :] ).

GSR

Sven Neumann
2003-08-31 17:57:27 UTC (over 20 years ago)

RGB to BGR script works, but how to run auto levels?

Hi,

Sven Neumann writes:

There is a bug-report already and it even has a patch attached to it:

http://bugzilla.gnome.org/show_bug.cgi?id=119233

I have now applied this patch to CVS so gimp >= 1.3.20 should provide the functionality you need to finish your script.

Sven

Sven Neumann
2003-09-01 12:08:29 UTC (over 20 years ago)

RGB to BGR script works, but how to run auto levels?

Hi,

"Joao S. O. Bueno" writes:

Autolevels is a missing feature on the PDB up to 1.2.5 and 1.3.18 - I've worked in a PDB entry to it together with Shawn Willden. Although I do not know if our contributionis beignn commited into 1.3.19 - I am compiling it now.
(BUG 119233)

I've committed your patch yesterday. The new function will be in 1.3.20.

Sven

G.DeSercey@bton.ac.uk
2003-09-01 14:19:46 UTC (over 20 years ago)

RGB to BGR script works, but how to run auto levels?

-----Original Message-----
From: Walter Francis [mailto:wally@theblackmoor.net] Sent: 31 August 2003 07:17
To: Guillermo S. Romero / Familia Romero Cc: gimp-user@lists.xcf.berkeley.edu Subject: Re: [Gimp-user] Re: RGB to BGR script works, but how to run auto levels?

I have it down to the following (although I'd still love an autolevels ;-),
is there any way to pass a list to gimp-image-delete, because I've tried
several things and I always get invalid argument. I tried:

(g-i-d new-image-rgb) (g-i-d (new-image-rgb))
(g-i-d '(new-image-rgb))

Try this: (mapcar gimp-image-delete (butlast new-image-rgb)) Note that it need the butlast to get rid of the -1 at the end of the list otherwise gimp-image-delete chokes on it. mapcar returns the result of applying the one (call mapcar1) or two (call mapcar2) operand function to each element or the one or two following list.

Guillaume