python-fu

Select by color doesn't select all the pixels of the desired color in a python-fu script

纵然是瞬间 提交于 2021-01-24 11:34:06
问题 I am writing a python-fu script for gimp that should have a line where it select all pixels of certain color. To do this, I added the line: gimp.pdb.gimp_by_color_select(clipLayer,(white_level,white_level,white_level),0,CHANNEL_OP_REPLACE,TRUE,FALSE,0,TRUE) where cliLayer is the layer I'm working on (top layer) and white_level is an input parameter. When I give the value manually (e.g replacing the (white_level,white_level,white_level) with (136,136,136) ), the selection is carried properly,

Plugins usually don't work, how do I debug?

扶醉桌前 提交于 2020-01-25 20:56:13
问题 I am trying to write a plugin that will create a bitmap font. However, this is very frustrating to learn... while I am not familiar with python, it is not that hard to pick up and have not had problems with it outside of GIMP. Copied some of the code from: https://github.com/sole/snippets/blob/master/gimp/generate_bitmap_font/sole_generate_bitmap_font.py and from http://gimpbook.com/scripting/ Does work: #!/usr/bin/env python # Hello World in GIMP Python from gimpfu import * def create_font

GIMP batch editing (Script-fu/Python-fu)

纵然是瞬间 提交于 2020-01-03 03:37:29
问题 I have about 500 images, I would like edit all of them in batch, I need to resize them all at to 190x120 dimensions, position then slightly higher (say 10 pixels). And export. Also I would like them all to keep their initial names. Basically I have a frame and I would like to load images (on layer under it) then size them down (above dimensions) move slightly up and export each individual image with frame so that it keeps its name. What would be a command I could use in GIMP console (script

How do I save (export) all layers with gimp's script fu?

醉酒当歌 提交于 2019-12-20 20:00:56
问题 With gimp fu, I can save the content of one layer (at least, that is how I interprete the definition of gimp_file_save because it takes the parameter drawable ). Now, I have the following script: from gimpfu import * def write_text(): width = 400 height = 100 img = gimp.Image(width, height, RGB) img.disable_undo() gimp.set_foreground( (255, 100, 20) ) gimp.set_background( ( 0, 15, 40) ) background_layer = gimp.Layer( img, 'Background', width, height, RGB_IMAGE, 100, NORMAL_MODE) img.add_layer

GIMP, python-fu: How to disable “Input image” and “Input drawable”

爷,独闯天下 提交于 2019-12-13 02:39:54
问题 i am confused a little about the art of how gimp generates the gui for python plug-ins. gimp generates two, for my script, needless fields. "Input image" and "Input drawable". how can i disable them? I didn't find anything about it in the standart documetation. my register method: register( "fixPngColors", "fixPngColors", "fixPngColors", "Author", "Author", "2013", "<Image>/plug-ins/BATCH PNG Color Fix", "", [ (PF_DIRNAME, "png_input_directory", "Png directory(INPUT)", ""), (PF_DIRNAME, "png

Gimp: why can't I register this?

谁说胖子不能爱 提交于 2019-12-11 08:37:16
问题 I'm writing an add-on for Blender to sync it with Gimp and this script should be able to start from within Gimp, but I can't register it... Why? blender_gimp_sync.py: # -*- coding: utf-8 -*- #!/usr/bin/env python from gimpfu import * def blender_gimp_sync(): image_dir = "/home/antoni4040/Έγγραφα/Layout.png" image = gimp.pdb.gimp_file_load(image_dir, image_dir) gimp.Display(image) register( "python_fu_bgsync", "Blender-Gimp Sync", "Syncronize Gimp with Blender for texturing", "Antonis Karvelas

python-fu select copy paste

∥☆過路亽.° 提交于 2019-12-10 10:56:55
问题 I'm a newbie in python-fu, (my second day), so my question may seem naive: I'd like to select a rectangular portion from "r400r.png", rotate it 90 degrees, and save my selection in "r400ra.png". So far, I tried something on these lines: for fv in range(400,401): fn='r%sr.png' % fv img=pdb.gimp_file_load('/path/'+fn,fn) drw=pdb.gimp_image_get_active_layer(img) img1=pdb.gimp_image_new(1024,1568,0) lyr=pdb.gimp_layer_new(img1,1024,1568,0,'ly1',0,0) pdb.gimp_rect_select(img,10,200,1422,1024,2,0,0

Gimp: python script not showing in menu

醉酒当歌 提交于 2019-12-10 02:39:14
问题 I followed this tutorial and this is what I have come up so far: #!/usr/bin/python # -*- coding: utf-8 -*- #http://www.ibm.com/developerworks/library/os-autogimp/ from gimpfu import* def plugin_main(timg, tdrawable, maxh=540, maxw=800): currentWidth = tdrawable.width currentHeight = tdrawable.height newWidth = currentWidth newHeight = currentHeight if (maxw < newWidth): newWidth = maxw newHeight = (float(currentHeight) / (float(currentWidth) / newWidth)) if (maxh < newHeight): newHeight =

python-fu select copy paste

孤街浪徒 提交于 2019-12-06 13:31:54
I'm a newbie in python-fu, (my second day), so my question may seem naive: I'd like to select a rectangular portion from "r400r.png", rotate it 90 degrees, and save my selection in "r400ra.png". So far, I tried something on these lines: for fv in range(400,401): fn='r%sr.png' % fv img=pdb.gimp_file_load('/path/'+fn,fn) drw=pdb.gimp_image_get_active_layer(img) img1=pdb.gimp_image_new(1024,1568,0) lyr=pdb.gimp_layer_new(img1,1024,1568,0,'ly1',0,0) pdb.gimp_rect_select(img,10,200,1422,1024,2,0,0) drw=pdb.gimp_rotate(drw,0,1.570796327) pdb.script_fu_selection_to_image(img1,drw) f0=fn[:5]+'a'+fn[5:

GIMP Python-fu exporting file only exports transparent layer

可紊 提交于 2019-12-06 04:30:54
问题 I am having issues saving images in python via GIMP. I can get the image and apply the effects I want, but when I go to save, it only saves one layer and not everything (NOTE: The background is transparent) and because the background is transparent, I cannot get it to save anything besides the transparent background. The code I am using is posted below: image_array = gimp.image_list() i=0 for image in image_array: img = image_array[i] layers = img.layers last_layer = len(layers)-1 try: