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

Image cut-n-paste; Mac clipboard plugin

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.

14 of 14 messages available
Toggle history

Please log in to manage your subscriptions.

Image cut-n-paste; Mac clipboard plugin Brion Vibber 13 Jun 12:45
  Image cut-n-paste; Mac clipboard plugin Brion Vibber 05 Jul 10:00
   Image cut-n-paste; Mac clipboard plugin Sven Neumann 05 Jul 10:26
    Image cut-n-paste; Mac clipboard plugin Brion Vibber 06 Jul 01:37
     Image cut-n-paste; Mac clipboard plugin Sven Neumann 06 Jul 02:19
     Image cut-n-paste; Mac clipboard plugin Brion Vibber 06 Jul 07:51
   Image cut-n-paste; Mac clipboard plugin Sven Neumann 05 Jul 18:00
    Image cut-n-paste; Mac clipboard plugin Brion Vibber 06 Jul 00:32
     Image cut-n-paste; Mac clipboard plugin Sven Neumann 06 Jul 01:07
     Image cut-n-paste; Mac clipboard plugin Tor Lillqvist 06 Jul 02:48
      Image cut-n-paste; Mac clipboard plugin Brion Vibber 06 Jul 02:30
       Image cut-n-paste; Mac clipboard plugin Sven Neumann 06 Jul 02:55
        Image cut-n-paste; Mac clipboard plugin Tor Lillqvist 06 Jul 06:35
         Image cut-n-paste; Mac clipboard plugin Sven Neumann 06 Jul 10:25
Brion Vibber
2004-06-13 12:45:02 UTC (almost 20 years ago)

Image cut-n-paste; Mac clipboard plugin

So far as I recall, Gimp has always lacked the ability to copy and paste images to other applications. Is this something that still requires support from Gtk to do cleanly? I noticed that the Win32 port of Gimp ships with a plugin that hacks in some clipboard support, and have had a go at porting it to Mac OS X: http://leuksman.com/mac/gimp/clipboard/

It seems to work for me (on Mac OS X 10.3.4), though the whole method feels a bit hackish; requiring separate Copy and Paste menu items to access the system clipboard is unusual...

I'm not sure this is really the right place, but I'd appreciate any feedback, in particular bug reports and any advice on making a distributable binary that can be dropped into place for people using bundled binary distributions of Gimp.

-- brion vibber (brion @ pobox.com)

Brion Vibber
2004-07-05 10:00:24 UTC (over 19 years ago)

Image cut-n-paste; Mac clipboard plugin

On June 13 I wrote:

So far as I recall, Gimp has always lacked the ability to copy and paste images to other applications. Is this something that still requires support from Gtk to do cleanly? I noticed that the Win32 port of Gimp ships with a plugin that hacks in some clipboard support, and have had a go at porting it to Mac OS X: http://leuksman.com/mac/gimp/clipboard/

It's been brought to my attention that 2.1 now uses the GTK+ system clipboard for copying images, so it might be nice to integrate the native clipboard with that more directly.

After a lot of recompiling, I've managed to get 2.1 running from CVS. It seems to be doing _something_ with the clipboard, but I haven't yet gotten anything resembling an image out of it. Is there any X11-based program known to interoperate with it that I could test with to make sure it's working? GTK+ on Mac OS X is stuck in the X11 ghetto; Apple's X11 server tries to keep the X and Mac clipboards in sync, but seems to manage plain text only... on the Mac side I see only empty text on the clipboard after copying an image.

Either Gimp or GTK+ could be hacked up to use the Mac clipboard directly, I suppose. Any opinions on what's the correct place to do this?

The plugin I've been working on also provides access to the Grab and Image Capture services for screen capture and scanning (services communicate over the same NSPasteboard interface as the clipboard), so it'll likely continue to be independently useful even after a hypothetical Mac-clipboard-enabled Gimp 2.2.

-- brion vibber (brion @ pobox.com)

Sven Neumann
2004-07-05 10:26:12 UTC (over 19 years ago)

Image cut-n-paste; Mac clipboard plugin

Hi,

Brion Vibber writes:

After a lot of recompiling, I've managed to get 2.1 running from CVS. It seems to be doing _something_ with the clipboard, but I haven't yet gotten anything resembling an image out of it. Is there any X11-based program known to interoperate with it that I could test with to make sure it's working?

The easiest way to test is to use a second instance of GIMP. Another application that is known to work is the word-processor Abiword.

Here are some links that explain how the X clipboard is supposed to be used:

http://tronche.com/gui/x/icccm/ http://www.jwz.org/doc/x-cut-and-paste.html http://www.freedesktop.org/standards/clipboards-spec/clipboards.txt

GIMP passes image data in the PNG format and announces it using the "image/png" mimetype identifier.

Either Gimp or GTK+ could be hacked up to use the Mac clipboard directly, I suppose. Any opinions on what's the correct place to do this?

It definitely belongs into GTK+ in the long run. Perhaps it would be good to start a GDK backend for MacOS X that is based on the GDK-X11 backend but deals with clipboard and other interoperability issues.

Sven

Sven Neumann
2004-07-05 18:00:15 UTC (over 19 years ago)

Image cut-n-paste; Mac clipboard plugin

Hi Brion,

it would be very helpful if you could point us to some documentation about the MacOS X clipboard. I am particularily interested in the formats that are typically used to exchange data using the clipboard.

Sven

Brion Vibber
2004-07-06 00:32:41 UTC (over 19 years ago)

Image cut-n-paste; Mac clipboard plugin

Sven Neumann wrote:

it would be very helpful if you could point us to some documentation about the MacOS X clipboard. I am particularily interested in the formats that are typically used to exchange data using the clipboard.

http://developer.apple.com/documentation/Cocoa/Conceptual/CopyandPaste/index.html

Cocoa apps (those written with the NeXT-derived toolkit) use TIFF for transferring raster images. Older apps (like Photoshop) tend to use PICT, which is a metafile format encapsulating calls to the QuickDraw drawing library. Using the Cocoa NSPasteboard interface, I can copy a TIFF and it performs the conversion to PICT for me, but when pasting I need to handle both formats.

Additionally rich text data may contain TIFF images, which can be extracted (this is useful for copying images from an RTFD document in TextEdit).

Cocoa prefers premultiplied alpha, so there's some lossy conversion for images with partially transparent areas. (This could probably be eliminated between instances of the Gimp by using libtiff to create & read the TIFFs rather than NSBitmapImageRep which I'm using at the moment.)

How is image cut-n-paste handled on Win32? Windows apps use DIB (.bmp) format for clipboard transfer; does the GDK backend handle DIBPNG conversion? I took a quick look around gdkselection-win32.c & friends but didn't see anything obvious.

-- brion vibber (brion @ pobox.com)

Sven Neumann
2004-07-06 01:07:52 UTC (over 19 years ago)

Image cut-n-paste; Mac clipboard plugin

Hi,

Brion Vibber writes:

Cocoa apps (those written with the NeXT-derived toolkit) use TIFF for transferring raster images. Older apps (like Photoshop) tend to use PICT, which is a metafile format encapsulating calls to the QuickDraw drawing library. Using the Cocoa NSPasteboard interface, I can copy a TIFF and it performs the conversion to PICT for me, but when pasting I need to handle both formats.

We use gdk-pixbuf to handle the clipboard image data. So far we only use the PNG format but it would be reasonable to extend this to the full range of formats supported by gdk-pixbuf. There's an API that we can use that allows us to retrieve the list of supported formats and the associated mime-types.

There's a tiff loader in GTK+ but no way to save TIFF files. There doesn't seem to be support for PICT (except perhaps in a 3rd party pixbuf loader that I don't know about). So the best way to address this would probably be to write a PICT loader and either get it into GTK+ or bundle it with GIMP for MacOS X.

How is image cut-n-paste handled on Win32? Windows apps use DIB (.bmp) format for clipboard transfer; does the GDK backend handle DIBPNG conversion? I took a quick look around gdkselection-win32.c & friends but didn't see anything obvious.

It would not be the job of the backend to handle the format conversion. The backend only needs to expose the clipboard in a compatible manner (e.g. data with associated mime-types). It's the application's job to handle the actual clipboard data. Of course it would be nice if everyone could agree on using PNG but that's unfortunately not how it works. So in order to use the win32 clipboard we will need to support BMP support in gdk-pixbuf. This is there fortunately but it seems to be limited to reading.

Sven

Brion Vibber
2004-07-06 01:37:29 UTC (over 19 years ago)

Image cut-n-paste; Mac clipboard plugin

Sven Neumann wrote:
>> Is there any X11-based program known to interoperate with it that >> I could test with to make sure it's working?

The easiest way to test is to use a second instance of GIMP. Another application that is known to work is the word-processor Abiword.

Thanks, it seems to be working on the X11 side. I do sometimes get what looks like an RGBA/ARGB mixup copying from Abiword to Gimp though; I'll try to isolate that and report the bug to the guilty party... :P

-- brion vibber (brion @ pobox.com)

Sven Neumann
2004-07-06 02:19:35 UTC (over 19 years ago)

Image cut-n-paste; Mac clipboard plugin

Hi,

Brion Vibber writes:

The easiest way to test is to use a second instance of GIMP. Another application that is known to work is the word-processor Abiword.

Thanks, it seems to be working on the X11 side. I do sometimes get what looks like an RGBA/ARGB mixup copying from Abiword to Gimp though; I'll try to isolate that and report the bug to the guilty party... :P

I've seen that as well. I suspect it's the GIMP code that still assumes that a GimpBuffer is always RGBA while the clipboard code happily passes it a RGB tile-manager if the PNG data doesn't have an alpha channel. I am just not sure where this would best be fixed. We need to either remove that assumption or add an alpha channel when converting the pixbuf to a tile-manager.

Sven

Brion Vibber
2004-07-06 02:30:42 UTC (over 19 years ago)

Image cut-n-paste; Mac clipboard plugin

Tor Lillqvist wrote:

Brion Vibber writes:
> How is image cut-n-paste handled on Win32?

There is a (Windows-specific) GIMP plug-in that does the "paste from (Windows) Clipboard" and "copy to Clipboard". That code probably should move to GTK+. (I doubt it's straightforward, though, so it hardly will get done in GTK+ 2.6.)

Yeah, that's the plugin I ported to Mac OS X. :(

-- brion vibber (brion @ pobox.com)

Tor Lillqvist
2004-07-06 02:48:41 UTC (over 19 years ago)

Image cut-n-paste; Mac clipboard plugin

Brion Vibber writes:
> How is image cut-n-paste handled on Win32? Windows apps use DIB (.bmp) > format for clipboard transfer; does the GDK backend handle DIBPNG > conversion? I took a quick look around gdkselection-win32.c & friends > but didn't see anything obvious.

There is a (Windows-specific) GIMP plug-in that does the "paste from (Windows) Clipboard" and "copy to Clipboard". That code probably should move to GTK+. (I doubt it's straightforward, though, so it hardly will get done in GTK+ 2.6.)

--tml

Sven Neumann
2004-07-06 02:55:21 UTC (over 19 years ago)

Image cut-n-paste; Mac clipboard plugin

Hi,

Tor Lillqvist wrote:

There is a (Windows-specific) GIMP plug-in that does the "paste from (Windows) Clipboard" and "copy to Clipboard". That code probably should move to GTK+. (I doubt it's straightforward, though, so it hardly will get done in GTK+ 2.6.)

What is the state of support for the GDK clipboard in the win32 backend? Michael reported that he can't even copy and paste image data from one GIMP instance to the other on Win32. Would that be supposed to work?

Sven

Tor Lillqvist
2004-07-06 06:35:08 UTC (over 19 years ago)

Image cut-n-paste; Mac clipboard plugin

Sven Neumann writes:
> What is the state of support for the GDK clipboard in the win32 > backend?

For the *GDK* clipboard only cut&paste of text is supported. The winclipboard plug-in uses the Windows clipboard directly.

> Michael reported that he can't even copy and paste image data > from one GIMP instance to the other on Win32. Would that be supposed > to work?

Yes it does work. (Although I now notice that it always copies the whole drawable to the Windows clipboard, not just the selection as one would expect).

--tml

Brion Vibber
2004-07-06 07:51:31 UTC (over 19 years ago)

Image cut-n-paste; Mac clipboard plugin

I wrote:

Thanks, it seems to be working on the X11 side. I do sometimes get what looks like an RGBA/ARGB mixup copying from Abiword to Gimp though; I'll try to isolate that and report the bug to the guilty party... :P

Patch in bugzilla: http://bugzilla.gnome.org/show_bug.cgi?id=145482

-- brion vibber (brion @ pobox.com)

Sven Neumann
2004-07-06 10:25:51 UTC (over 19 years ago)

Image cut-n-paste; Mac clipboard plugin

Hi,

Tor Lillqvist writes:

Sven Neumann writes:
> What is the state of support for the GDK clipboard in the win32 > backend?

For the *GDK* clipboard only cut&paste of text is supported. The winclipboard plug-in uses the Windows clipboard directly.

> Michael reported that he can't even copy and paste image data > from one GIMP instance to the other on Win32. Would that be supposed > to work?

Yes it does work. (Although I now notice that it always copies the whole drawable to the Windows clipboard, not just the selection as one would expect).

I was actually asking about the newly added support for the system clipboard which is supposed to obsolete the winclipboard plug-in. Well, you basically answered that above. So the answer is that it is _not_ supposed to work :( This is rather unfortunate. When I started to implement the GDK clipboard functionality I was hoping there was better support for it in the win32 GDK backend.

Sven