Re: [Gimp-user] Problem script-fu gimp-text-layer-get-text

2011-08-09 Thread Volker Lenhardt
Am 09.08.2011 14:53, schrieb Rob Antonishen:
 You can access it using sed/grep or some such tool.  Opening the xcf
 file in a text editor, even after an autocrop, the text information
 remains in the following format:

 (text test text)
 (font Sans)
 (font-size 18.00)
 (font-size-unit pixels)
 (hinting yes)
 (antialias yes)
 (language en-us)
 (base-direction ltr)
 (color (color-rgb 0.00 0.00 0.00))
 (justify left)
 (box-mode dynamic)
 (box-unit pixels)

 I posted a grep example here:
 http://registry.gimp.org/node/25145#comment-11229


 -Rob A

Thank you very much indeed. That's the solution.
I'll make me a script to meet my needs.

Volker

 On Mon, Aug 8, 2011 at 5:21 PM, Volker Lenhardt
 volker.lenha...@uni-due.de  wrote:
 Am 08.08.2011 21:00, schrieb Ofnuts:
 On 08/08/2011 12:57 PM, Volker Lenhardt wrote:
 Gimp 2.6.8 on Linux openSUSE 11.3

 I need to extract text and font from a text layer. No problem, I
 thought, with gimp-text-layer-get-text and gimp-text-layer-get-font.

 But I find that the original text layer was cropped with
 plug-in-autocrop-layer. Nevertheless Gimp lets me edit the text with the
 text edit tool - after a confirmation dialog.

 But I can't get the text with script-fu. Is there a way to manage it?
 There are many files involved.

 The layer name is usually the text contents, so instead of getting the
 text you can retrieve the name. Your Mileage May Vary.

 It does vary, I'm sorry for it. Thank you all the same.

 Volker
___
Gimp-user mailing list
Gimp-user@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user


[Gimp-user] Problem script-fu gimp-text-layer-get-text

2011-08-08 Thread Volker Lenhardt
Gimp 2.6.8 on Linux openSUSE 11.3

I need to extract text and font from a text layer. No problem, I 
thought, with gimp-text-layer-get-text and gimp-text-layer-get-font.

But I find that the original text layer was cropped with
plug-in-autocrop-layer. Nevertheless Gimp lets me edit the text with the 
text edit tool - after a confirmation dialog.

But I can't get the text with script-fu. Is there a way to manage it? 
There are many files involved.

Volker
___
Gimp-user mailing list
Gimp-user@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user


Re: [Gimp-user] Problem script-fu gimp-text-layer-get-text

2011-08-08 Thread Volker Lenhardt
Am 08.08.2011 21:00, schrieb Ofnuts:
 On 08/08/2011 12:57 PM, Volker Lenhardt wrote:
 Gimp 2.6.8 on Linux openSUSE 11.3

 I need to extract text and font from a text layer. No problem, I
 thought, with gimp-text-layer-get-text and gimp-text-layer-get-font.

 But I find that the original text layer was cropped with
 plug-in-autocrop-layer. Nevertheless Gimp lets me edit the text with the
 text edit tool - after a confirmation dialog.

 But I can't get the text with script-fu. Is there a way to manage it?
 There are many files involved.

 The layer name is usually the text contents, so instead of getting the
 text you can retrieve the name. Your Mileage May Vary.

It does vary, I'm sorry for it. Thank you all the same.

Volker
___
Gimp-user mailing list
Gimp-user@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user


Re: [Gimp-user] best monitor

2009-11-13 Thread Volker Lenhardt
Paul Hartman schrieb:
 On Fri, Nov 13, 2009 at 11:38 AM, Volker Lenhardt
 
 I'm replying this to the list since Volker's email appears to have
 been sent only to me! :)

Thank you, Paul. I did mean to send it to the list. I hope this one is
better aimed.

Volker
___
Gimp-user mailing list
Gimp-user@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user


[Gimp-user] Script-fu: the best way to copy an open image

2002-08-26 Thread Volker Lenhardt

Hi,

in a script I want among other things to copy an open image into another, 
after merging the visible layers and scaling them down. But without changing 
the original image.

I thought of copying the whole image into a new dummy image, make the 
adjustments, copy the drawable to the destination and delete the dummy.

But I can't find a way to copy an image all in one. Is there the only 
complicated way to copy all layers to the dummy and translate them? Or have I 
got to make the adjustments to the original image and leave it scaled down 
with merged layers and hope that it will not be saved?

What do you advise me to do?

Greetings from Volker

-- 
Volker Lenhardt
Am Spinnweg 19, 45894 Gelsenkirchen
Tel.: 0209-30213 - Fax: 0209-390437
Email: [EMAIL PROTECTED]
___
Gimp-user mailing list
[EMAIL PROTECTED]
http://lists.xcf.berkeley.edu/mailman/listinfo/gimp-user



[Gimp-user] Script-fu: copy an image into a different image

2002-08-15 Thread Volker Lenhardt

 Hi,

 I'm a script-fu newby and I'm trying to write a script to let up to four
 pictures be printed on one sheet (DINA4). User selects the files and the
 border width. The rest is up to the script.

 The new image for the sheet is established easily. So I started with the
 first file. I managed to open it and scale it down to a quarter of the
 sheet.

 But I cannot find the procedures proper to copy the visible parts of the
 image (as one layer?) to the sheet image. Please help me.

 Thanks in advance. Volker

-- 
Volker Lenhardt
Am Spinnweg 19, 45894 Gelsenkirchen
Tel.: 0209-30213 - Fax: 0209-390437
Email: [EMAIL PROTECTED]
___
Gimp-user mailing list
[EMAIL PROTECTED]
http://lists.xcf.berkeley.edu/mailman/listinfo/gimp-user



Re: [Gimp-user] Script-fu: copy an image into a different image

2002-08-15 Thread Volker Lenhardt

Am Donnerstag, 15. August 2002 13:59 schrieb Joel:
 To copy the visible parts of the image, use these pdb functions:

 gimp_image_merge_visible_layers   # combine layers in original file
 gimp_rect_select  # create a selection (in 
original)
 gimp_edit_copy# copy original to clipboard
 gimp_edit_paste   # paste it as a new floating 
layer

 Exact parameters, and a bit of documentation, are in the PDB. (/Xtns/DB
 Browser ...)

That's exactly what I thought. But it doesn't seem to work. If you don't mind, 
I'll give you my code so far (no loop for the next three pics yet):

(define (mm-to-pixel mm xy)
(if (= xy 0)
(+ (* (/ mm 25.4) (car (gimp-get-monitor-resolution))) 0.5)
(+ (* (/ mm 25.4) (cadr (gimp-get-monitor-resolution))) 0.5)
)
)
(define (script-fu-dina4-4 sheet-border-mm path-1)
(let*(
(din-a4-x (mm-to-pixel 297 0))
(din-a4-y (mm-to-pixel 210 1))
(sheet-width (- din-a4-x (* (mm-to-pixel sheet-border-mm 0) 2)))
(sheet-height (- din-a4-y (* (mm-to-pixel sheet-border-mm 1) 2)))
(sheet-ratio (/ sheet-width sheet-height))
(sheet (car (gimp-image-new sheet-width sheet-height RGB)))
(pic-1 (car (gimp-file-load 1 path-1 path-1)))
(pic-width (car (gimp-image-width pic-1)))
(pic-height (car (gimp-image-height pic-1)))
(pic-ratio (/ pic-width pic-height))
;next 2 lines: minus 2 pixel for a small white line between the four pictures
(new-pic-width (- (/ sheet-width 2) 2))
(new-pic-height (- (/ sheet-height 2) 2))
(layer-1 (car (gimp-layer-new sheet new-pic-width new-pic-height 0 
Up-left 
100 0)))
)
; if the picture is portrait, it must be made landscape:
(if ( pic-ratio 1.0)
(begin
(plug-in-rotate 0 pic-1 pic-1 3 TRUE)
(set! pic-width (car (gimp-image-width pic-1)))
(set! pic-height (car (gimp-image-height pic-1)))
(set! pic-ratio (/ pic-width pic-height))
)
)
; the picture must fit either high or wide, depending on its ratio:
(if ( pic-ratio sheet-ratio)
(set! new-pic-width (* new-pic-height pic-ratio))
(set! new-pic-height (/ new-pic-width pic-ratio))
)
(gimp-image-scale pic-1 new-pic-width new-pic-height)
(if ( (car (gimp-image-get-layers pic-1)) 1)
(gimp-image-merge-visible-layers pic-1 1)
)
(gimp-image-add-layer sheet layer-1 0)
(gimp-rect-select pic-1 0 0 new-pic-width new-pic-height 0 FALSE 0)
(gimp-edit-copy (car (gimp-image-get-selection pic-1)))
(gimp-edit-paste layer-1 0)
(gimp-display-new sheet)
; testing just to see the scaling:
(gimp-display-new pic-1)
(gimp-image-clean-all sheet)
(gimp-image-clean-all pic-1)
)
)
(script-fu-register script-fu-dina4-4
Toolbox/Xtns/Script-Fu/VierLaden
Erzeugt eine DINA4-Seite mit 4 Bildern zur Druckausgabe
Volker Lenhardt
GNU, Volker Lenhardt
12. August 2002

SF-VALUE Seitenrand (mm) 10
SF-FILENAME Datei /bilder/
)

If you try it out you'll find that the selection in pic-1 isn't in the 
edit-buffer, there's a white area instead.

What is wrong with my script?


 Note that if you just select, then copy, and then paste, Gimp will put the
 floating layer in the center of the new document. Use the
 gimp_layer_translate function to move it to where you want it to go. In
 Python (not sure what the equivalent is in Scheme), I use this code to find
 the physical dimensions of the stuff I want to copy, taking transparency
 into consideration:

As I define a layer in sheet with exactly the wanted dimensions there's no 
need for me to change the default middle position. Sure I have to position 
the next three layers to their quarters.


pdb.gimp_selection_layer_alpha(originalFile.layers[0])
empty, x1, y1, x2, y2 = pdb.gimp_selection_bounds(originalFile)

 Then, using that, I'll calculate the top/right position :

x = (x1 + x2 - originalFile.width) / 2
y = (y1 + y2 - originalFile.width) / 2

# Now, adjust for the position where the old image should be put into
 the # new image
x = x + top# top and left are values that I pass in
y = y + left

pdb.gimp_layer_translate(floatLayer, x, y)

I'm very curious. Greetings from Volker

-- 
Volker Lenhardt
Am Spinnweg 19, 45894 Gelsenkirchen