From: A_Omara on
xclip accepts only ASCII format files.

That's why I wrote in subject "non-ASCII"

On Jul 31, 4:54 am, pk <p...(a)pk.invalid> wrote:
> On Fri, 30 Jul 2010 17:14:50 -0700 (PDT)
>
> A_Omara <ahmad.abdulgh...(a)gmail.com> wrote:
> > Hi,
>
> > Is there any way that I can copy image file contents to clipboard from
> > command line in Linux?
>
> > I'm using a command line based screenshot program (scrot) but the
> > output from this command is put in file. I need to have a command to
> > further copy the snapped image file into clipboard, and encapsulate
> > this all into simple push button.
>
> > Any idea about how to use this?
>
> Try xclip, it reads from stdin and should allow you to do
>
> xclip < image.jpg
>
> to copy the image to the clipboard.
>
> *UNTESTED*

From: pk on
On Sat, 31 Jul 2010 07:14:44 -0700 (PDT) A_Omara
<ahmad.abdulghany(a)gmail.com> wrote:

> xclip accepts only ASCII format files.
>
> That's why I wrote in subject "non-ASCII"

That's why I wrote *UNTESTED*. But anyway it seems that images work:

$ xclip < bases.jpg
$ xclip -o > foo.jpg
$ diff foo.jpg bases.jpg
$


From: Janis Papanagnou on
On 31/07/10 16:14, pk wrote:
> On Sat, 31 Jul 2010 07:14:44 -0700 (PDT) A_Omara
> <ahmad.abdulghany(a)gmail.com> wrote:
>
>> xclip accepts only ASCII format files.
>>
>> That's why I wrote in subject "non-ASCII"
>
> That's why I wrote *UNTESTED*. But anyway it seems that images work:
>
> $ xclip < bases.jpg
> $ xclip -o > foo.jpg
> $ diff foo.jpg bases.jpg
> $
>
>

Using the same xclip application for import and export seems to me to
be of limited usefulness if you want to demonstrate effectiveness for
a certain purpose.

According to the man page it works (only?) with X applications. I wasn't
able to paste the X clipboard contents to an office application (OOorg)
or to an image processing application (gimp). What cut buffers do those
applications use?

Janis
From: pk on
On Sat, 31 Jul 2010 17:24:41 +0200 Janis Papanagnou
<janis_papanagnou(a)hotmail.com> wrote:

> On 31/07/10 16:14, pk wrote:
> > On Sat, 31 Jul 2010 07:14:44 -0700 (PDT) A_Omara
> > <ahmad.abdulghany(a)gmail.com> wrote:
> >
> >> xclip accepts only ASCII format files.
> >>
> >> That's why I wrote in subject "non-ASCII"
> >
> > That's why I wrote *UNTESTED*. But anyway it seems that images work:
> >
> > $ xclip < bases.jpg
> > $ xclip -o > foo.jpg
> > $ diff foo.jpg bases.jpg
> > $
> >
> >
>
> Using the same xclip application for import and export seems to me to
> be of limited usefulness if you want to demonstrate effectiveness for
> a certain purpose.
>
> According to the man page it works (only?) with X applications. I wasn't
> able to paste the X clipboard contents to an office application (OOorg)
> or to an image processing application (gimp). What cut buffers do those
> applications use?

My example was only to demonstrate that it doesn't seem to be true that
xclip "accepts only ASCII format files".

xclip copies data to the X clipboard, which is usually distinct from the
one your desktop environment or window manager uses (ie, the one you get by
right clicking or going to edit -> copy/paste in most applications).

The contents of the X clipboard are usually pasted (at least on the Linux
systems I'm familiar with) by clicking the middle mouse button (for
two-button mice, that is usually emulated by clicking both buttons
simultaneously).

For what it's worth, it works for me by doing something like

ls | xclip

and middle-clicking in OOwriter.

However, I don't have any graphical program to test X pasting of images.

From: A_Omara on
Well, after testing with ls | xclip, it seems that your are correct
about it copies to a special clipboard where you can past using the
middle mouse button click.

Now, what if i need to copy this special clipboard content to normal X
clipboard? To be able to paste in an email, office, or image
processing tool (e.g. gimp)?

Thanks,
Ahmad

On Jul 31, 9:11 am, pk <p...(a)pk.invalid> wrote:
> On Sat, 31 Jul 2010 17:24:41 +0200 Janis Papanagnou
>
>
>
> <janis_papanag...(a)hotmail.com> wrote:
> > On 31/07/10 16:14, pk wrote:
> > > On Sat, 31 Jul 2010 07:14:44 -0700 (PDT) A_Omara
> > > <ahmad.abdulgh...(a)gmail.com> wrote:
>
> > >> xclip accepts only ASCII format files.
>
> > >> That's why I wrote in subject "non-ASCII"
>
> > > That's why I wrote *UNTESTED*. But anyway it seems that images work:
>
> > > $ xclip < bases.jpg
> > > $ xclip -o > foo.jpg
> > > $ diff foo.jpg bases.jpg
> > > $
>
> > Using the same xclip application for import and export seems to me to
> > be of limited usefulness if you want to demonstrate effectiveness for
> > a certain purpose.
>
> > According to the man page it works (only?) with X applications. I wasn't
> > able to paste the X clipboard contents to an office application (OOorg)
> > or to an image processing application (gimp). What cut buffers do those
> > applications use?
>
> My example was only to demonstrate that it doesn't seem to be true that
> xclip "accepts only ASCII format files".
>
> xclip copies data to the X clipboard, which is usually distinct from the
> one your desktop environment or window manager uses (ie, the one you get by
> right clicking or going to edit -> copy/paste in most applications).
>
> The contents of the X clipboard are usually pasted (at least on the Linux
> systems I'm familiar with) by clicking the middle mouse button (for
> two-button mice, that is usually emulated by clicking both buttons
> simultaneously).
>
> For what it's worth, it works for me by doing something like
>
> ls | xclip
>
> and middle-clicking in OOwriter.
>
> However, I don't have any graphical program to test X pasting of images.