Help scripting transform and copy/paste for photobooth automation?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]




All,

I'm new to script-fu, and brushing up on my rusty Scheme, which I
haven't used in about 15 years!

I'm trying to write a script that will help me automate creating a
photobooth-like experience. I have a template with a space for 4
images, and some captured images that I want to scale down and
copy/paste into the template.

Here is my code, which oddly, which alternates between working
properly, throwing an error about a bad drawable ID, and saving the
template without the transformed, pasted image.

Also, any tips on an appropriate way to pass 4 filename arguments to
the script (as i will eventually be running it on the command line)
would be much appreciated!

   (define (script-fu-create-filmstrip)
   (let*
		(
			; open the template
			(image
				(car
					(gimp-file-load
					 RUN-NONINTERACTIVE
					 "c:\\photobooth strip.jpg"
					 "c:\\photobooth strip.jpg"
					)
				)
			)
			
			(drawable (car (gimp-image-get-active-layer image)
						)
			)
			
			; open captured image
			(cap1
				(car
					(gimp-file-load
					RUN-NONINTERACTIVE
					"C:\\Img0014.jpg"
					"C:\\Img0014.jpg"
					)
				)
			)
			
			(cap1-d (car (gimp-image-get-active-layer cap1)
						)
			)
			
			(sel-float)

		)
	
			; scale down captured image
			(gimp-image-resize cap1 563 368 0 0)

			(gimp-selection-all cap1)
			
			
			(gimp-edit-copy cap1)
			
			(gimp-rect-select
			image
			20
			20
			563
			368
			REPLACE
			0
			0
			)
		
			; Paste captured image
			(set! sel-float (car (gimp-edit-paste drawable FALSE)))

			; Anchor the selection
			(gimp-floating-sel-anchor sel-float)
			
			(gimp-selection-none image)
						
			(gimp-image-flatten
			image
			)
			
			(set! drawable (car (gimp-image-get-active-layer image)
						)
			)
			
			(gimp-file-save
			RUN-NONINTERACTIVE
			image
			drawable
			"c:\\test.jpg"
			"c:\\test.jpg"
			)
		)
	)
	
      (script-fu-register
          "script-fu-create-filmstrip"                        ;func name
          "Film Strip"                                  ;menu label
          "Edits the filmstrip file and replaces\
            the placeholder boxes with camera images" ;description
          "Author"                             ;author
          "copyright 2009"             ;copyright notice
          "December 7, 2010"                          ;date created
          ""                     ;image type that the script works on
        )
        (script-fu-menu-register "script-fu-create-filmstrip"
"<Toolbox>/Xtn/Photobooth")



Any help to this Gimp scripting newbie would be much appreciated!
_______________________________________________

Gimp-user@xxxxxxxxxxxxxxxxxxxxxx
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user

[Gimp Announce]     [Gimp Images]     [GIMP Development]     [Video For Linux]     [Photo]     [Yosemite News]    [Yosemite Photos]    [gtk]     [KDE]     [Scanner]     [Gimp's Home]     [Gimp Docs]     [Gimp on Windows]     [Steve's Art]     [Webcams]     [Share Your Images]     [Free Online Dating]     [Photo Site]     [Script Fu]     [GIMP Software]     [GIMP Books]

Barnes&Noble.com

Add to Google Follow Gimp on Twitter