GT Portal . Forums . Official Tutorials . Art Galleries . FAQs . Search . New Posts . Contact Us Login  .  Register


Board index » GIMP Art Galleries and Resources » GIMP Plugins, Filters, and Scripts Make Money Online . Free Image Hosting
Featured Tutorial : Learn how to create characters by Griatch
Search for :  


Post new topic Reply to topic   [ 7 posts ]  


Author Message
 Post subject:
PostPosted: Sat Apr 26, 2008 9:18 am 
Offline

Joined:
Sat Apr 26, 2008 9:12 am

Topics: 2
Posts: 5

Find User's Topics

Hi all,
I'm doing my first steps in scripting and wanna know how to apply colour cube filter to an image from a script (either script-fu or python). Is it possible to exract all colors value by their html names or RGB values?

Thanks in advance




Top
 Profile  
 
 Post subject:
PostPosted: Sat Apr 26, 2008 2:53 pm 
Online
User avatar

Joined:
Mon Aug 22, 2005 8:35 pm

Topics: 76
Posts: 3461

Find User's Topics
It is possible to fetch the value of a pixel using 'gimp-drawable-get-pixel'. Using a script to access individual pixels is rather slow and you would be better served to write a plug-in (using C language); but for learning purposes, a script for this would be fine.

I have written the following color cube Script-fu (I was bored) which you can examine to see how it works. It is, as stated, rather slow and I would not recommend using it on images with dimensions larger than a couple of hundred pixels.

http://flashingtwelve.brickfilms.com/GIMP/Scripts/colorcube.scm

And here is a sample output (using the Mona Lisa as the sampled image):

Image


_________________
Any sufficiently primitive technology is indistinguishable from a rock.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 28, 2008 11:16 pm 
Offline

Joined:
Sat Apr 26, 2008 9:12 am

Topics: 2
Posts: 5

Find User's Topics
Thanks Saulgoode for your help. When I tried to apply the script attached to your reply I got the following error message:

Error while executing
(script-fu-indexed-color-cube 23 187)
ERROR: Procedural database execution failed:
(gimp_drawable_set_pixel 190 50 500 4 #4"00ce00ff"


any idea what's the problem?

Thanks alot



Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 29, 2008 4:30 am 
Online
User avatar

Joined:
Mon Aug 22, 2005 8:35 pm

Topics: 76
Posts: 3461

Find User's Topics
Perhaps try opening the Script-fu console (in the Xtns menu) and executing the following command (only have a single image open):

(script-fu-indexed-color-cube (aref (cadr (gimp-image-list)) 0) (car (gimp-image-get-active-layer (aref (cadr (gimp-image-list)) 0))

That might provide a better indication of where the error occurs.


_________________
Any sufficiently primitive technology is indistinguishable from a rock.


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 09, 2008 11:50 pm 
Offline

Joined:
Sat Apr 26, 2008 9:12 am

Topics: 2
Posts: 5

Find User's Topics
When I execute the above command in Sript-Fu Console I got the following error message (only one file is open):
ERROR: end of file inside list

Thanks



Top
 Profile  
 
 Post subject:
PostPosted: Sat May 10, 2008 1:22 am 
Online
User avatar

Joined:
Mon Aug 22, 2005 8:35 pm

Topics: 76
Posts: 3461

Find User's Topics
I can't find that error being generated anywhere in the code. Which version of GIMP are you using?


_________________
Any sufficiently primitive technology is indistinguishable from a rock.


Top
 Profile  
 
 Post subject: Re: colour cube filter
PostPosted: Fri May 16, 2008 11:22 am 
Offline

Joined:
Sat Apr 26, 2008 9:12 am

Topics: 2
Posts: 5

Find User's Topics
I'm using Gimp version 2.2.13
Thanks



Top
 Profile  
 
Display posts from previous:  Sort by  

Post new topic Reply to topic
 [ 7 posts ] 



Who is online

Users browsing this forum: No registered users and 1 guest


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

Jump to:  
Related Website
Gimp tutorials database
All rights reserved © GimpTalk 2008
forum software by
phpBB