It is currently 01 Dec 2020, 01:40

• Featuring Members' Works (Image Attachments) •
1: member
2: member
3: member
4: member
5: member

GIMP/GL:  Tutorials | Tips | 🡆 Questions | Interests | Script Requests
Recommendations:  Index | Top 10
Resources:  Python-Fu Plug-ins | Scheme-Fu Scripts | GIMP
Python:  Lessons | Questions | Exercises
The Arts:  GIMPed | GIMPed Photos | Other | Contests | Public Domain Images | Isolated Images | Blender
Inkscape
Social:  Say Hello | Anything Goes | Shares | FCSP

"Ghost" python plugin?

GIMP or GIMP LEARN forum related Questions
vndep
Forum Member

Re: "Ghost" python plugin?

Post#11 by vndep » 21 Jun 2019, 20:54


Thanks a lot! You have been a great help!
GIMP Learn rocks...

vndep
Forum Member

Post#12 by vndep » 21 Jun 2019, 21:34


Oops ... another question.

All the code below works except one line and I can't figure out why; the line is:

pdb.gimp_file_save(1, new_img, layer, outputpath, 'AAA_TEST.png')

The objective is to save my work as a png file.

Code: Select all


def python_sample_scriptC(image, layer) : #FUNCTION DEFINITION
	pdb.gimp_image_undo_group_start(image)
	pdb.gimp_context_push()
	#YOUR CODE BEGINS=======================

	imagepath = 'G:/Users/Star/Dropbox/Projects/Stock photos/blue-clouds-day-53594.jpg'
	outputpath = 'G:/Users/Star/Dropbox/Projects/Stock photos/AAA_TEST.png'
	text = 'SAMPLE TEXT'
	drawableFLAG = None
	xval = 10
	yval = 10
	borderval = 0 
	antialiasFLAG = FALSE
	sizeval = 100
	sizetypeval = 1
	fontnameval = 'Arial Heavy'

	pdb.gimp_message('LOAD IMAGE')
	imageobj = pdb.file_jpeg_load(imagepath, imagepath)
	pdb.gimp_display_new(imageobj)
	pdb.gimp_message('CREATE TEXT LAYER')
	textlayerval = pdb.gimp_text_fontname(imageobj, drawableFLAG, xval, yval, text, borderval, antialiasFLAG, sizeval, sizetypeval, fontnameval)
	pdb.gimp_message('SET TEXT COLOR')
	pdb.gimp_text_layer_set_color(textlayerval, '#ff0000')
	time.sleep(1)
	pdb.gimp_message('DUPLICATE')
	new_image = pdb.gimp_image_duplicate(imageobj)
	pdb.gimp_message('MERGE')
	layer = pdb.gimp_image_merge_visible_layers(new_image, CLIP_TO_IMAGE)
	pdb.gimp_message('SAVE')
#  THIS NEXT LINE PRODUCES AN ERROR
	pdb.gimp_file_save(1, new_img, layer, outputpath, 'AAA_TEST.png')


#	pdb.gimp_message('DELETE')
#	pdb.gimp_image_delete(new_image)



#	time.sleep(10)
#	pdb.gimp_message('TRY TO DELETE LAYER')
#	pdb.gimp_item_delete(textlayerval)
#	pdb.gimp_message('LAYER DELETED')

		


	#YOUR CODE ENDS ========================
	pdb.gimp_context_pop()
	pdb.gimp_image_undo_group_end(image)
	pdb.gimp_displays_flush()
    #return
GIMP Learn rocks...

tim
GL Blogger

Post#13 by tim » 21 Jun 2019, 22:09


as a rule in python fu GIMP plug-ins,
The run mode is not used if it's used it's a named parameter so just ignore that first parameter can call it with

Code: Select all

pdb.gimp_file_save(new_image, layer, outputpath, outputpath)
aka Tin

         

vndep
Forum Member

Post#14 by vndep » 22 Jun 2019, 02:45


That also throws an error.
GIMP Learn rocks...

tim
GL Blogger

Post#15 by tim » 22 Jun 2019, 03:58


what's the error? it ran when i tested on mine.
you had it as new_img when it should be new_image
aka Tin

         

vndep
Forum Member

Post#16 by vndep » 22 Jun 2019, 09:45


<groan> I am used to coding in an IDE so little stupid errors like new_img vs. new_image are tripping me up!
now it works.
GIMP Learn rocks...

vndep
Forum Member

Post#17 by vndep » 22 Jun 2019, 10:45


BTW you are a godsend - your responses in another post (viewtopic.php?f=9&t=1210) solved another problem.
GIMP Learn rocks...

tim
GL Blogger

Post#18 by tim » 22 Jun 2019, 12:44


glad you finally got it working.
Don't hesitate to ask more if you run into other problems :D
Cheers.
aka Tin

         


GIMP/GL:  Tutorials | Tips | 🡆 Questions | Interests | Script Requests
Recommendations:  Index | Top 10
Resources:  Python-Fu Plug-ins | Scheme-Fu Scripts | GIMP
Python:  Lessons | Questions | Exercises
The Arts:  GIMPed | GIMPed Photos | Other | Contests | Public Domain Images | Isolated Images | Blender
Inkscape
Social:  Say Hello | Anything Goes | Shares | FCSP

Post Reply New Topic
  • Similar Topics
    Replies
    Views
    Last post

Who is online

Users browsing this forum: No registered users and 5 guests