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

RE : Drawable copying / manipulation in plugin development

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.

7 of 8 messages available
Toggle history

Please log in to manage your subscriptions.

Drawable copying / manipulation in plugin development François Gingras 08 Jan 22:37
  Drawable copying / manipulation in plugin development Sven Neumann 08 Jan 23:46
   RE : Drawable copying / manipulation in plugin development François Gingras 09 Jan 05:04
    RE : Drawable copying / manipulation in plugin development Sven Neumann 09 Jan 11:25
    RE : Drawable copying / manipulation in plugin development Liam R E Quin 09 Jan 18:26
  Drawable copying / manipulation in plugin development Rob Antonishen 08 Jan 23:58
25F7A55ED3BE8E458637466ACAA... 07 Oct 20:28
  RE : RE : Drawable copying / manipulation in plugin development Sven Neumann 09 Jan 18:13
François Gingras
2010-01-08 22:37:19 UTC (over 15 years ago)

Drawable copying / manipulation in plugin development

Greetings,

Sorry if this sounds very newbie-ish; I'm somehow new to GIMP plugin development. Is there any quick way to copy a drawable in memory, in order to manipulate it, and then manipulate the original again? Basically, what I'm trying to do is transforming an image in a few different ways (every time using the original image) using gimp_drawable_transform_matrix_default, keeping results in memory, and then putting all these results in one image, which would be sent back to the core.

Also, I believe I misunderstand something about the behavior of gimp_drawable_transform_matrix_default : somehow I don't seem to be able to use it, and then immediately use it again on the result. Do I have to flush the drawable, or something among those lines?

Thank you all!

François Gingras

Sven Neumann
2010-01-08 23:46:53 UTC (over 15 years ago)

Drawable copying / manipulation in plugin development

On Fri, 2010-01-08 at 16:37 -0500, François Gingras wrote:

Greetings,

Sorry if this sounds very newbie-ish; I'm somehow new to GIMP plugin development. Is there any quick way to copy a drawable in memory, in order to manipulate it, and then manipulate the original again? Basically, what I'm trying to do is transforming an image in a few different ways (every time using the original image) using gimp_drawable_transform_matrix_default, keeping results in memory, and then putting all these results in one image, which would be sent back to the core.

I don't quite understand what you are up to. All the data is kept in the core if you use gimp_drawable_transform_matrix_default(). You just tell the core to transform the drawable. No data is actually sent to the plug-in.

I assume that the drawable your plug-in is working with, is actually a layer. Then the easiest way to create a copy of the drawable is to duplicate that layer.

Sven

Rob Antonishen
2010-01-08 23:58:15 UTC (over 15 years ago)

Drawable copying / manipulation in plugin development

Francois-

Providing additional information on what you are trying to do would help.

If you are planning to perform stock pdb functions on drawables, you may prefer to use script-fu or python, as it is simpler than the C coding (imoo)

-Rob A>

On 1/8/10, François Gingras wrote:

Greetings,

Sorry if this sounds very newbie-ish; I'm somehow new to GIMP plugin development. Is there any quick way to copy a drawable in memory, in order to manipulate it, and then manipulate the original again? Basically, what I'm trying to do is transforming an image in a few different ways (every time using the original image) using gimp_drawable_transform_matrix_default, keeping results in memory, and then putting all these results in one image, which would be sent back to the core.

Also, I believe I misunderstand something about the behavior of gimp_drawable_transform_matrix_default : somehow I don't seem to be able to use it, and then immediately use it again on the result. Do I have to flush the drawable, or something among those lines?

Thank you all!

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

François Gingras
2010-01-09 05:04:24 UTC (over 15 years ago)

RE : Drawable copying / manipulation in plugin development

Thanks, I actually hadn't realized that the data wasn't sent to the plug-in. Is there any way for a plug-in to use a function similar to gimp_drawable_transform_matrix_default() with data the it has access to?

They say images are worth a thousand words... So what I'm basically trying to do is turn this image:

http://mat.ulaval.ca/~fgingras/misc/1.png

into this one:

http://mat.ulaval.ca/~fgingras/misc/2.png

Thanks again!

François

De : Sven Neumann [sven@gimp.org]
Date d'envoi : 8 janvier 2010 17:46
À : François Gingras
Cc : gimp-developer@lists.XCF.Berkeley.EDU
Objet : Re: [Gimp-developer] Drawable copying / manipulation in plugin development

On Fri, 2010-01-08 at 16:37 -0500, François Gingras wrote:
> Greetings,
>
> Sorry if this sounds very newbie-ish; I'm somehow new to GIMP plugin
> development. Is there any quick way to copy a drawable in memory, in
> order to manipulate it, and then manipulate the original again?
> Basically, what I'm trying to do is transforming an image in a few
> different ways (every time using the original image) using
> gimp_drawable_transform_matrix_default, keeping results in memory, and
> then putting all these results in one image, which would be sent back
> to the core.

I don't quite understand what you are up to. All the data is kept in the
core if you use gimp_drawable_transform_matrix_default(). You just tell
the core to transform the drawable. No data is actually sent to the
plug-in.

I assume that the drawable your plug-in is working with, is actually a
layer. Then the easiest way to create a copy of the drawable is to
duplicate that layer.


Sven
Sven Neumann
2010-01-09 11:25:34 UTC (over 15 years ago)

RE : Drawable copying / manipulation in plugin development

On Fri, 2010-01-08 at 23:04 -0500, François Gingras wrote:

Thanks, I actually hadn't realized that the data wasn't sent to the plug-in. Is there any way for a plug-in to use a function similar to gimp_drawable_transform_matrix_default() with data the it has access to?

They say images are worth a thousand words... So what I'm basically trying to do is turn this image:

http://mat.ulaval.ca/~fgingras/misc/1.png

into this one:

http://mat.ulaval.ca/~fgingras/misc/2.png

But for that you don't need to have the data in the plug-in. This is a simple task that involves nothing but operations that are already available and accessible through the PDB. I would suggest that you use a GIMP Python or Script-Fu script to perform this task. But of course you can also do this in C if you prefer that.

Sven

Sven Neumann
2010-01-09 18:13:35 UTC (over 15 years ago)

RE : RE : Drawable copying / manipulation in plugin development

On Sat, 2010-01-09 at 09:24 -0500, François Gingras wrote:

I'll use a Script-Fu script if it's easier, but I really have no clue as to which operations would help me do this (i.e. having multiples copies of my image / layer, and merging them back together)... Would you have any suggestions?

Well, how would you do this in the GIMP user interface? Probably by creating a few copies of the original layer, then transforming them and in the end merge the layers back together. Just try to get your result and take notes about what you are doing. Your script should then do the same steps.

And please keep the discussion on the mailing-list instead of replying to me in private mail. Thanks.

Sven

Liam R E Quin
2010-01-09 18:26:59 UTC (over 15 years ago)

RE : Drawable copying / manipulation in plugin development

On Fri, 2010-01-08 at 23:04 -0500, François Gingras wrote:

They say images are worth a thousand words... So what I'm basically trying to do is turn this image:

http://mat.ulaval.ca/~fgingras/misc/1.png

into this one:

http://mat.ulaval.ca/~fgingras/misc/2.png

Do you have to do it on hundreds of images? A simple script will suffice and you could use gimp in batch mode. Or even use Imagemagick to do scaling. In gimp in script-fu you'd use gimp-drawable-transform-scale-default, if I understand what you are trying to do.

If the images are coming from a font you could also have the font scaled before rendering it -- e.g. use fontforge, or just assign a new fontmatrix in fontconfig (assuming Linux).

(if you're doing it for a Web page, note that most of the newest Web browsers can do transformations too now, using CSS)

Hope this helps.

Liam