Re: [Gimp-user] Python script

2018-06-21 Thread Alexander V. Kalachev via gimp-user-list
Thank you for your hint.

Alexander

On Thu, 21 Jun 2018 11:17:28 +0100
kevin payne  wrote:

> On 21 June 2018 at 10:32, Alexander V. Kalachev via gimp-user-list
>  wrote:
> > Dear list members,
> >
> > I wrote a script that adds an outline to the text. The script works as I 
> > expected with on exception. When it finished, it removes all textual 
> > information and converts the text into graphics. Could anyone give me an 
> > advice how to modify the script in order to keep the textual information 
> > unchanged? The script itself below.
> 
> 
> 
> You are stroking the path onto the Text layer, which will convert it
> from text to raster. To keep the Test layer you will need to stroke
> the path onto a new layer.
___
gimp-user-list mailing list
List address:gimp-user-list@gnome.org
List membership: https://mail.gnome.org/mailman/listinfo/gimp-user-list
List archives:   https://mail.gnome.org/archives/gimp-user-list


[Gimp-user] Python script

2018-06-21 Thread Alexander V. Kalachev via gimp-user-list
Dear list members,

I wrote a script that adds an outline to the text. The script works as I 
expected with on exception. When it finished, it removes all textual 
information and converts the text into graphics. Could anyone give me an advice 
how to modify the script in order to keep the textual information unchanged? 
The script itself below.


#!/usr/bin/env python
# -*- coding: utf-8 -*-

from gimpfu import *

def outline_text(image, outline_color, outline_thikness):
active = pdb.gimp_image_get_active_drawable(image)

pdb.gimp_image_undo_group_start(image)

if not pdb.gimp_drawable_is_text_layer(active):
pdb.gimp_message('Cannot proceed on non textual layer')
pdb.gimp_image_undo_group_end(image)
return

outline = pdb.gimp_vectors_new_from_text_layer(image, active)
pdb.gimp_image_insert_vectors(image, outline , None, -1)

saved_fg_color = pdb.gimp_context_get_foreground()

pdb.gimp_context_set_foreground(outline_color)
pdb.gimp_context_set_stroke_method(STROKE_LINE)
pdb.gimp_context_set_line_width(float(outline_thikness))
pdb.gimp_drawable_edit_stroke_item(active, outline)

pdb.gimp_context_set_foreground(saved_fg_color)

pdb.gimp_image_undo_group_end(image)

register(
"python_fu_outline_text",
"Adds an outline to a text",
"Adds an outline to a text",
"Alexander",
"Alexander",
"01.05.2018",
"Text outline",
"RGB* GRAY* INDEXED*",
[
(PF_IMAGE, "image", "Input image", None),
(PF_COLOR, "outline_color", "Color", (255, 255, 255)),
(PF_INT, "outline_thikness", ("Thickness"), "1"),
],
[],
outline_text, menu="/Illustration")
main()

With kind regards,
Alexander
___
gimp-user-list mailing list
List address:gimp-user-list@gnome.org
List membership: https://mail.gnome.org/mailman/listinfo/gimp-user-list
List archives:   https://mail.gnome.org/archives/gimp-user-list