Re: [python-win32] windows images on clipboard

2021-08-12 Thread Mriswithe
Awesome, thank you so much for that info. That makes my tail chasing make
more sense! Thanks for saving me from additional posterior extension
pursuit.

Last question I think, how do I put a file path reference on the clipboard
similar to in explorer selecting a few files and hitting control c ?

I think I had tested that with discord and it worked, but not 100% on that.

On Thu, Aug 12, 2021, 11:57 AM Tim Roberts  wrote:

> Mriswithe wrote:
> >
> > I was looking at making a little helper app for Windows that will take
> > an image on your clipboard and ensure it is under 8MB for posting to
> > discord, and if it isn't, use Pillow to resize it until it is the
> > right size.
> >
> > I can use Pillow's ImageGrab.grabclipboard() to get the image off the
> > clipboard, but I am a little confused about writing it back. I have
> > been back and forth between the pywin32 source and the windows docs
> > for the windows C API, but I don't have any previous experience or
> > context to know what some pieces are intended to do.
> >
> > I found an example to write to it from StackOverflow
> > (https://stackoverflow.com/questions/34322132/copy-image-to-clipboard
> > ),
>
> > but I was wanting to dig a little deeper to see what formats other
> > than BMP I could use to put on the clipboard. My ignorance of C++ and
> > the Windows APIs and hell the Python C API is really biting me here.
>
> You can't.  You have to write it as a DIB (Device Independent Bitmap),
> which is the format in a .BMP file.
>
> The Windows clipboard was designed in roughly 1986, before GIF, before
> JPEG and way, way before PNG.  The clipboard is designed for universal
> interchange, so it really does need to spec the lowest common
> denominator.  If they allowed PNGs, then all of the graphics application
> in the world would have to be modified to decode PNG data.
>
> So, to make your app work, save the result as a BMP.
>
>
> > Is there a bit of an idiots example guide for how to say, put a PNG on
> > the clipboard or a JPG? Some example code? There is a ton of useful
> > info in the pywin32 repo, but I haven't found anything that has made
> > this click for me.
>
> There is no idiots guide, because it cannot be done.  Well, technically
> speaking you can put arbitrary binary data into the clipboard, but other
> graphics applications will not be able to read it.  When they look for
> image data, they look for format CF_DIB, and that means a .BMP.
>
> --
> Tim Roberts, t...@probo.com
> Providenza & Boekelheide, Inc.
>
>
> ___
> python-win32 mailing list
> python-win32@python.org
> https://mail.python.org/mailman/listinfo/python-win32
>
___
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] windows images on clipboard

2021-08-12 Thread Dennis Lee Bieber
On Wed, 11 Aug 2021 18:33:14 -0500, Mriswithe 
declaimed the following:

>
>Is there a bit of an idiots example guide for how to say, put a PNG on the
>clipboard or a JPG? Some example code? There is a ton of useful info in the
>pywin32 repo, but I haven't found anything that has made this click for me.
>
From a quick browse in Google -- IMAGES are only in one of the Windows
bitmap formats when on the clipboard; ie, they've been "rendered" to a
bitmap memory structure. PNG or JPG -- those are file formats, not rendered
images. There does appear to be a CF_TIFF format.


-- 
Wulfraed Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/

___
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32


[python-win32] Pywin32 local variable

2021-08-12 Thread Salih KUYUMCU via python-win32
Hello dear authorized,
I'm Salih from Abdullah Gül Univercity from Turkey. Now I'm tring to make a 
project with python and abap. I'm now using the pywin32 for com server in 
windows. I can send some variables to python from abap and get them. 
However, I have a problem with local variables. I create a String value 
before the methods and try to return these values in another method. I get 
the problem local variable 'xxx' referenced before assignment. I just want 
to take or change a variable that is not in the method. Please help me for 
this topic. If you want I can make more explanations. I used Stefan 
Schnell's page in SAP community.


 
___
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] windows images on clipboard

2021-08-12 Thread Tim Roberts

Mriswithe wrote:


I was looking at making a little helper app for Windows that will take 
an image on your clipboard and ensure it is under 8MB for posting to 
discord, and if it isn't, use Pillow to resize it until it is the 
right size.


I can use Pillow's ImageGrab.grabclipboard() to get the image off the 
clipboard, but I am a little confused about writing it back. I have 
been back and forth between the pywin32 source and the windows docs 
for the windows C API, but I don't have any previous experience or 
context to know what some pieces are intended to do.


I found an example to write to it from StackOverflow 
(https://stackoverflow.com/questions/34322132/copy-image-to-clipboard 
), 
but I was wanting to dig a little deeper to see what formats other 
than BMP I could use to put on the clipboard. My ignorance of C++ and 
the Windows APIs and hell the Python C API is really biting me here.


You can't.  You have to write it as a DIB (Device Independent Bitmap), 
which is the format in a .BMP file.


The Windows clipboard was designed in roughly 1986, before GIF, before 
JPEG and way, way before PNG.  The clipboard is designed for universal 
interchange, so it really does need to spec the lowest common 
denominator.  If they allowed PNGs, then all of the graphics application 
in the world would have to be modified to decode PNG data.


So, to make your app work, save the result as a BMP.


Is there a bit of an idiots example guide for how to say, put a PNG on 
the clipboard or a JPG? Some example code? There is a ton of useful 
info in the pywin32 repo, but I haven't found anything that has made 
this click for me.


There is no idiots guide, because it cannot be done.  Well, technically 
speaking you can put arbitrary binary data into the clipboard, but other 
graphics applications will not be able to read it.  When they look for 
image data, they look for format CF_DIB, and that means a .BMP.


--
Tim Roberts, t...@probo.com
Providenza & Boekelheide, Inc.




smime.p7s
Description: S/MIME Cryptographic Signature
___
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32