Sign up now! · Forgot password?
RSS/Atom feed identi.ca Twitter

Python script

This discussion is connected to the gimp-user-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

5 of 5 messages available
Toggle history

Please log in to manage your subscriptions.

Python script Alexander V. Kalachev via gimp-user-list 21 Jun 09:32
  Python script kevin payne via gimp-user-list 21 Jun 10:17
   Python script Alexander V. Kalachev via gimp-user-list 21 Jun 22:57
  Python script Carol Spears via gimp-user-list 21 Jun 12:46
   Python script Alexander V. Kalachev via gimp-user-list 21 Jun 22:57
Alexander V. Kalachev via gimp-user-list
2018-06-21 09:32:46 UTC (29 days ago)

Python script

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

kevin payne via gimp-user-list
2018-06-21 10:17:28 UTC (29 days ago)

Python script

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.

Carol Spears via gimp-user-list
2018-06-21 12:46:32 UTC (28 days ago)

Python script

On Thu, Jun 21, 2018 at 5:32 AM, Alexander V. Kalachev via gimp-user-list < gimp-user-list@gnome.org> 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.

The layer will fail to be a text layer after being changed by any tool or plug-in which is not the text tool. The text becomes just another painted layer.

Perhaps a different software will retain the textural information, but not GIMP.

carol

Alexander V. Kalachev via gimp-user-list
2018-06-21 22:57:01 UTC (28 days ago)

Python script

Thank you for your explanation.

Alexander

On Thu, 21 Jun 2018 08:46:32 -0400 Carol Spears wrote:

On Thu, Jun 21, 2018 at 5:32 AM, Alexander V. Kalachev via gimp-user-list < gimp-user-list@gnome.org> 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.

The layer will fail to be a text layer after being changed by any tool or plug-in which is not the text tool. The text becomes just another painted layer.

Perhaps a different software will retain the textural information, but not GIMP.

carol

Alexander V. Kalachev via gimp-user-list
2018-06-21 22:57:32 UTC (28 days ago)

Python script

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.