RSS/Atom feed Twitter
Site is read-only, email is disabled

Gimp-python: Artefacts when creating layer

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

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

9 of 9 messages available
Toggle history

Please log in to manage your subscriptions.

Gimp-python: Artefacts when creating layer Sebastian Breuers 03 Jun 12:07
  Gimp-python: Artefacts when creating layer Simon Budig 03 Jun 14:29
   Gimp-python: Artefacts when creating layer Alan Horkan 03 Jun 14:39
    Gimp-python: Artefacts when creating layer Simon Budig 03 Jun 14:53
     Gimp-python: Artefacts when creating layer Joao S. O. Bueno Calligaris 03 Jun 16:58
      Gimp-python: Artefacts when creating layer Sebastian Breuers 03 Jun 18:34
      Gimp-python: Artefacts when creating layer Sven Neumann 04 Jun 19:45
       Gimp-python: Artefacts when creating layer Joao S. O. Bueno Calligaris 05 Jun 04:05
  Gimp-python: Artefacts when creating layer Sven Neumann 04 Jun 18:57
Sebastian Breuers
2006-06-03 12:07:42 UTC (over 18 years ago)

Gimp-python: Artefacts when creating layer

Hi@all

The plug-in, I'm writing, creates a number of layers, every layer receives an object, for example a circle (created by ellipse selection, an selection fill), but somewhen, don't know why, the layer contains not only the desired circle but also some artefacts. Stripes, areas of white, the mouse cursor, things they should not be there.
Is that a problem that can be solved by a certain programmable handling or do I have to remove these artefacts by hand?

seb

Simon Budig
2006-06-03 14:29:02 UTC (over 18 years ago)

Gimp-python: Artefacts when creating layer

Sebastian Breuers (sebbreuers@gmx.de) wrote:

The plug-in, I'm writing, creates a number of layers, every layer receives an object, for example a circle (created by ellipse selection, an selection fill), but somewhen, don't know why, the layer contains not only the desired circle but also some artefacts. Stripes, areas of white, the mouse cursor, things they should not be there.
Is that a problem that can be solved by a certain programmable handling or do I have to remove these artefacts by hand?

That sounds as if you don't clear the layer before you use it for the first time. Layers created from a Plugin are not initialized from the very beginning. They need to be cleared using e.g. gimp_drawable_fill.

Hope this helps, Simon

Alan Horkan
2006-06-03 14:39:16 UTC (over 18 years ago)

Gimp-python: Artefacts when creating layer

On Sat, 3 Jun 2006, Simon Budig wrote:

Date: Sat, 3 Jun 2006 14:29:02 +0200 From: Simon Budig
To: gimp-developer@lists.XCF.Berkeley.EDU Subject: Re: [Gimp-developer] Gimp-python: Artefacts when creating layer

Sebastian Breuers (sebbreuers@gmx.de) wrote:

The plug-in, I'm writing, creates a number of layers, every layer receives an object, for example a circle (created by ellipse selection, an selection fill), but somewhen, don't know why, the layer contains not only the desired circle but also some artefacts. Stripes, areas of white, the mouse cursor, things they should not be there.
Is that a problem that can be solved by a certain programmable handling or do I have to remove these artefacts by hand?

That sounds as if you don't clear the layer before you use it for the first time. Layers created from a Plugin are not initialized from the very beginning. They need to be cleared using e.g. gimp_drawable_fill.

I remember getting caught out by this too. Why is necessary to manually clear a new layer rather than have it done automatically?

Simon Budig
2006-06-03 14:53:27 UTC (over 18 years ago)

Gimp-python: Artefacts when creating layer

Alan Horkan (horkana@maths.tcd.ie) wrote:

On Sat, 3 Jun 2006, Simon Budig wrote:

That sounds as if you don't clear the layer before you use it for the first time. Layers created from a Plugin are not initialized from the very beginning. They need to be cleared using e.g. gimp_drawable_fill.

I remember getting caught out by this too. Why is necessary to manually clear a new layer rather than have it done automatically?

I have no strong opinions on that. I guess the reasoning behind this behaviour was a speed optimization: If a plugin later renders stuff to a new layer anyway it would be a waste of time to clear it automatically. If it doesn't it would just invoke gimp_drawable_fill. No harm done, except that you have to know about it.

It might even matter for big images...

Bye, Simon

Joao S. O. Bueno Calligaris
2006-06-03 16:58:41 UTC (over 18 years ago)

Gimp-python: Artefacts when creating layer

On Saturday 03 June 2006 09:53 am, Simon Budig wrote:

Alan Horkan (horkana@maths.tcd.ie) wrote:

On Sat, 3 Jun 2006, Simon Budig wrote:

That sounds as if you don't clear the layer before you use it for the first time. Layers created from a Plugin are not initialized from the very beginning. They need to be cleared using e.g. gimp_drawable_fill.

I remember getting caught out by this too. Why is necessary to manually clear a new layer rather than have it done automatically?

I have no strong opinions on that. I guess the reasoning behind this behaviour was a speed optimization: If a plugin later renders stuff to a new layer anyway it would be a waste of time to clear it automatically. If it doesn't it would just invoke gimp_drawable_fill. No harm done, except that you have to know about it.

It might even matter for big images...

For C plug-ins that might be true. However, python plug-ins are not good in dealing directly with pixels - that is, for rendering things.

I guess the python api for creating a layer could create an empty one with no problems.

Regards,
JS
->

Bye,
Simon

Sebastian Breuers
2006-06-03 18:34:49 UTC (over 18 years ago)

Gimp-python: Artefacts when creating layer

Am Samstag, 3. Juni 2006 16:58 schrieb Joao S. O. Bueno Calligaris:

On Saturday 03 June 2006 09:53 am, Simon Budig wrote:

Alan Horkan (horkana@maths.tcd.ie) wrote:

On Sat, 3 Jun 2006, Simon Budig wrote:

That sounds as if you don't clear the layer before you use it for the first time. Layers created from a Plugin are not initialized from the very beginning. They need to be cleared using e.g. gimp_drawable_fill.

Thanks a lot,

that helped. Did it with:

newLayer.fill(TRANSPARENT_FILL)

seb

I remember getting caught out by this too. Why is necessary to manually clear a new layer rather than have it done automatically?

I have no strong opinions on that. I guess the reasoning behind this behaviour was a speed optimization: If a plugin later renders stuff to a new layer anyway it would be a waste of time to clear it automatically. If it doesn't it would just invoke gimp_drawable_fill. No harm done, except that you have to know about it.

It might even matter for big images...

For C plug-ins that might be true. However, python plug-ins are not good in dealing directly with pixels - that is, for rendering things.

I guess the python api for creating a layer could create an empty one with no problems.

Regards,
JS
->

Bye,
Simon

_______________________________________________ Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer

Sven Neumann
2006-06-04 18:57:06 UTC (over 18 years ago)

Gimp-python: Artefacts when creating layer

Hi,

On Sat, 2006-06-03 at 12:07 +0200, Sebastian Breuers wrote:

The plug-in, I'm writing, creates a number of layers, every layer receives an object, for example a circle (created by ellipse selection, an selection fill), but somewhen, don't know why, the layer contains not only the desired circle but also some artefacts. Stripes, areas of white, the mouse cursor, things they should not be there.
Is that a problem that can be solved by a certain programmable handling or do I have to remove these artefacts by hand?

Clearing the layers before use would probably help.

Sven

Sven Neumann
2006-06-04 19:45:32 UTC (over 18 years ago)

Gimp-python: Artefacts when creating layer

Hi,

On Sat, 2006-06-03 at 11:58 -0300, Joao S. O. Bueno Calligaris wrote:

For C plug-ins that might be true. However, python plug-ins are not good in dealing directly with pixels - that is, for rendering things.

There is no need to access pixels directly. We are not asking the C programmer to iterate over the pixels and clear them directly. Calling gimp-drawable-fill is sufficient, no matter what language binding is being used.

Sven

Joao S. O. Bueno Calligaris
2006-06-05 04:05:27 UTC (over 18 years ago)

Gimp-python: Artefacts when creating layer

On Sunday 04 June 2006 02:45 pm, Sven Neumann wrote:

Hi,

On Sat, 2006-06-03 at 11:58 -0300, Joao S. O. Bueno Calligaris

wrote:

For C plug-ins that might be true. However, python plug-ins are not good in dealing directly with pixels - that is, for rendering things.

There is no need to access pixels directly. We are not asking the C programmer to iterate over the pixels and clear them directly. Calling gimp-drawable-fill is sufficient, no matter what language binding is being used.

That was not what I meant anyway. The matter is: the only advantadge of not having a layer automatically cleared when it is created, is sparing somw cycles if you are generating the layers content.

Generate the layers content from within thew python code is something that, although can be done, is so slow, that the time spent auto-clearing the table becomes negligible.

It may look as a single extra line of code for us. For one trying with the scripts, it is one more "secret" to be found or overcame, that might not take negligible time. That is the motive for my suggestion.

JS
->

Sven