[Gimp-user] Copy png to clipboard via gimp-console

2017-02-17 Thread pUlI
Thanks for the response. It was helpful!

>That can't work. Big objects such as images are not copied to the 
>clipboard (on Linux and AFAIK also on Windows). When you copy an image
>the clipboard only contains a message that allows the receiving
>process
>to connect to the source process and get the data directly form it. In
>your case, since Gimp exits immediately after copying the data, the 
>receiving process cannot connect to it.
>
>Try this:
>
>  * Start another application (word processor)
>  * Open an image in Gimp
>  * Copy to clipboard (Ctrl-A, Ctrl-C)
>* Back to the word processor: Ctrl-V to copy the image: it should
>work
>  * Ctrl-V to copy the image a second time: it should work
>  * Close the Gimp image window (but keep Gimp up)
>  * Ctrl-V to copy the image a third time: it should work
>  * Close Gimp completely
>* Ctrl-V to copy the image a fourth time: it won't work, because
>Gimp
>is no longer here to service it.
>
>On a side note, having batch process use the clipboard is treacherous;
>while they run you cannot do anything on your system since they could 
>overwrite what you put in the clipboard.

-- 
pUlI (via www.gimpusers.com/forums)
___
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


Re: [Gimp-user] Copy png to clipboard via gimp-console

2017-02-14 Thread Ofnuts

On 14/02/17 12:03, pUlI wrote:

Hi all,

I would like to copy a png file to the clipboard using (for instance):

gimp-console-2.8 -i -d -f -b '(png-copy "snapshot1.png")' -b '(gimp-quit 0)'

The scheme code I have for the same is attached "png-copy.scm"

However, it does not work as expected. Only an empty "carriage return" newline
is copied to the clipboard. Can someone point out what needs to be changed in my
scheme file?

Thanks for your help!

Best regards,
pUlI

png-copy.scm:

(define (png-copy pattern)
   (let* (
   (filelist (cadr (file-glob pattern 1)))
 )
 (while (not (null? filelist))
   (begin
 (catch ()
   (let* (
   (filename (car filelist))
(image (car (file-png-load RUN-NONINTERACTIVE filename filename)))
  (drawablealpha (car (gimp-image-get-active-drawable image)))
  (gimp-selection-all image)
  (gimp-edit-copy-visible drawablealpha)
 )
 (begin
  (gimp-selection-all image)
  (gimp-edit-copy (car (gimp-image-get-active-layer image)))
 )
   )
 )
 (set! filelist (cdr filelist))
   )
 )
   )
)

Attachments:
* http://www.gimpusers.com/system/attachments/483/original/png-copy.scm

That can't work. Big objects such as images are not copied to the 
clipboard (on Linux and AFAIK also on Windows). When you copy an image 
the clipboard only contains a message that allows the receiving process 
to connect to the source process and get the data directly form it. In 
your case, since Gimp exits immediately after copying the data, the 
receiving process cannot connect to it.


Try this:

 * Start another application (word processor)
 * Open an image in Gimp
 * Copy to clipboard (Ctrl-A, Ctrl-C)
 * Back to the word processor: Ctrl-V to copy the image: it should work
 * Ctrl-V to copy the image a second time: it should work
 * Close the Gimp image window (but keep Gimp up)
 * Ctrl-V to copy the image a third time: it should work
 * Close Gimp completely
 * Ctrl-V to copy the image a fourth time: it won't work, because Gimp
   is no longer here to service it.

On a side note, having batch process use the clipboard is treacherous; 
while they run you cannot do anything on your system since they could 
overwrite what you put in the clipboard.



___
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] Copy png to clipboard via gimp-console

2017-02-14 Thread pUlI
Hi all,

I would like to copy a png file to the clipboard using (for instance):

gimp-console-2.8 -i -d -f -b '(png-copy "snapshot1.png")' -b '(gimp-quit 0)'

The scheme code I have for the same is attached "png-copy.scm"

However, it does not work as expected. Only an empty "carriage return" newline
is copied to the clipboard. Can someone point out what needs to be changed in my
scheme file?

Thanks for your help!

Best regards,
pUlI

png-copy.scm:

(define (png-copy pattern)
  (let* (
  (filelist (cadr (file-glob pattern 1)))
)
(while (not (null? filelist))
  (begin
(catch ()
  (let* (
  (filename (car filelist))
(image (car (file-png-load RUN-NONINTERACTIVE filename filename)))
  (drawablealpha (car (gimp-image-get-active-drawable image)))
  (gimp-selection-all image)
  (gimp-edit-copy-visible drawablealpha)
)
(begin
  (gimp-selection-all image)
  (gimp-edit-copy (car (gimp-image-get-active-layer image)))
)
  )
)
(set! filelist (cdr filelist))
  )
)
  )
)

Attachments:
* http://www.gimpusers.com/system/attachments/483/original/png-copy.scm

-- 
pUlI (via www.gimpusers.com/forums)
___
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