Notice: This forum has been recovered from an old backup, so some content, links, and dates may be outdated. The forum is currently read-only while we restore sign-in and registration functionality. Details

If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.

Show picture+Make it disapear after a Delay

If you have a question or need help, this is the place to be.
User avatar
WharfRat
Experienced User
Posts: 159
Joined: Wed Dec 25, 2013 11:56 am

Re: Show picture+Make it disapear after a Delay

Post by WharfRat »

Hi guys,

I am not having any success with the alpha channel of a PNG using this script.

Enclosed is the PNG file in a ZIP, because it seems that the forum strips the alpha channel.
alpha.zip
alpha.png
(38.39 KiB) Downloaded 197 times
The alpha.png file in the ZIP has an alpha channel which is a horizontal gradient.

The file is correct, because I tested it on a web page with a background image:
test.png
test.png (140.2 KiB) Viewed 6494 times
However, this is the result I get with this script when showing the file on the desktop:
result.png
result.png (60.91 KiB) Viewed 6494 times
All I get is the transparency showing some kind of grey background instead.

Am I doing something wrong, or is there some limitation of wxPython that I am not aware of. Right now I have no experience with wxPython. I need to finish learning Python first.

Eventually I want to implement a semitransparent screen overlay with text and graphics. Without semitransparency, the idea is dead in the water. It would be great if it could become some sort of GDI plugin, if you see what I mean.

Anyway, thanks for your time...
EventGhost 0.4.1.r1640
PHX01RN plugin v3.0.1
Windows XP 32bit (v5.1 Build 2600 Service Pack 2)
Windows7 64bit (v6.1 Build 7601 Service Pack 1)
User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: Show picture+Make it disapear after a Delay

Post by Pako »

You're right, I can confirm.
Both actions (System.ShowPicture and System.DisplayImage) displays the file incorrectly.
I tried a simple thing. I used it as an "icon" in PushBullet plugin (action Push mirror) and it looked like this:
AlphaTestMirror.png
AlphaTestMirror.png (8.13 KiB) Viewed 6477 times
This means properly.
And since I'm the author PushBullet plugin and also the action System.DisplayImage, so it should not be a big problem to fix it.

Pako
User avatar
WharfRat
Experienced User
Posts: 159
Joined: Wed Dec 25, 2013 11:56 am

Re: Show picture+Make it disapear after a Delay

Post by WharfRat »

Aah, thanks Pako

I was thinking that I would have to learn ctypes to program GDI and DCs directly...

I will take a look at PushBullet sometime since I am not familiar with it.

Thanks for everything that you do...
You can have one of the roses in my hand over there while I go out to buy you a beer.
EventGhost 0.4.1.r1640
PHX01RN plugin v3.0.1
Windows XP 32bit (v5.1 Build 2600 Service Pack 2)
Windows7 64bit (v6.1 Build 7601 Service Pack 1)
User avatar
WharfRat
Experienced User
Posts: 159
Joined: Wed Dec 25, 2013 11:56 am

Re: Show picture+Make it disapear after a Delay

Post by WharfRat »

Okay, so I should be looking at PIL then... thanks for pointing me in the right direction.
I'll have to get the docs for that too.
EventGhost 0.4.1.r1640
PHX01RN plugin v3.0.1
Windows XP 32bit (v5.1 Build 2600 Service Pack 2)
Windows7 64bit (v6.1 Build 7601 Service Pack 1)
User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: Show picture+Make it disapear after a Delay

Post by Pako »

I'm a bit improved behavior of Display Image action.
Now is better taken into account the value of the alpha channel:
alpha.png on a yellow background
alpha.png on a yellow background
alpha_yellow.jpg (23.25 KiB) Viewed 6456 times
However, I do not think it will be sometime in the future so perfect that will be rendered semi-transparent image on a transparent background.
I'm not saying it's impossible. But it is at least very difficult, and I have no interest in spending more time on it.
Modified System plugin can be downloaded here.

Pako
Attachments
__init__.py
Plugin System
(68.22 KiB) Downloaded 198 times
User avatar
WharfRat
Experienced User
Posts: 159
Joined: Wed Dec 25, 2013 11:56 am

Re: Show picture+Make it disapear after a Delay

Post by WharfRat »

Thanks Pako, I'll take a look at it
EventGhost 0.4.1.r1640
PHX01RN plugin v3.0.1
Windows XP 32bit (v5.1 Build 2600 Service Pack 2)
Windows7 64bit (v6.1 Build 7601 Service Pack 1)
User avatar
WharfRat
Experienced User
Posts: 159
Joined: Wed Dec 25, 2013 11:56 am

Re: Show picture+Make it disapear after a Delay

Post by WharfRat »

Thanks for your effort Pako, you don't need to spend any more time with this.

I just want to clarify what I said earlier.

The result.png image obtained previously did not use System.ShowPicture or System.DisplayImage, but used the script that you posted here for themaster1 in 2011.

System.ShowPicture ignores all transparency and alpha values:
ShowPicture
ShowPicture
ShowPicture.png (27.31 KiB) Viewed 6434 times
The original System.DisplayImage:
old DisplayImage
old DisplayImage
DisplayImage_old.png (63.47 KiB) Viewed 6434 times
The new System.DisplayImage:
new DisplayImage
new DisplayImage
DisplayImage_new.png (85.73 KiB) Viewed 6434 times
In the old and new System.DisplayImage cases, alpha < 127 is opaque, and alpha > 127 is transparent.
There is a slight visible difference between the two versions, but I don't think the modification is worth releasing.

The script from the 2011 post was more effective, it resulted in displaying the whole image.

An interesting observation about the script: you can only drag and click the non-transparent regions... Cool! I can already envision OnScreen Sliders and other GUI controls.
Try the script with this image:
(see the next post)

Anyway, back to the alpha channel. I will start with the script implementation and see if I can do anything with that. A look at the WxPython website is probably a good idea, but it looks like it might have to be GDI and DCs. If I get anywhere, then this will continue in the Coding forum, with a note about that here.
EventGhost 0.4.1.r1640
PHX01RN plugin v3.0.1
Windows XP 32bit (v5.1 Build 2600 Service Pack 2)
Windows7 64bit (v6.1 Build 7601 Service Pack 1)
User avatar
WharfRat
Experienced User
Posts: 159
Joined: Wed Dec 25, 2013 11:56 am

Re: Show picture+Make it disapear after a Delay

Post by WharfRat »

Here is the other image for the previous post:
transparent.zip
transparent.gif
(1.38 KiB) Downloaded 178 times
(I just found out that each post can only have 3 attachments)
EventGhost 0.4.1.r1640
PHX01RN plugin v3.0.1
Windows XP 32bit (v5.1 Build 2600 Service Pack 2)
Windows7 64bit (v6.1 Build 7601 Service Pack 1)
User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: Show picture+Make it disapear after a Delay

Post by Pako »

WharfRat wrote:In the old and new System.DisplayImage cases, alpha < 127 is opaque, and alpha > 127 is transparent.
Yes this is the default behavior.
It would be possible to add the option to choose the threshold (from 0 to 255).
WharfRat wrote:There is a slight visible difference between the two versions, but I don't think the modification is worth releasing.
I think that you are not right.
The difference is especially noticeable when the Shaped window (if alpha channel exists) option is unchecked.

Note: The difference between the old and the new version is more:
  • Background color behavior
  • Doubleclick behavior [when Shaped window (if alpha channel exists) option is unchecked]
Pako
User avatar
WharfRat
Experienced User
Posts: 159
Joined: Wed Dec 25, 2013 11:56 am

Re: Show picture+Make it disapear after a Delay

Post by WharfRat »

I must apologize for not testing the modification more thoroughly. Yes, System.DisplayImage does work better now:
Shaped window unchecked
Shaped window unchecked
Shaped_window_unchecked.png (55.19 KiB) Viewed 6406 times
I was also not aware of the double-click feature. So sorry...
EventGhost 0.4.1.r1640
PHX01RN plugin v3.0.1
Windows XP 32bit (v5.1 Build 2600 Service Pack 2)
Windows7 64bit (v6.1 Build 7601 Service Pack 1)
User avatar
WharfRat
Experienced User
Posts: 159
Joined: Wed Dec 25, 2013 11:56 am

Re: Show picture+Make it disapear after a Delay

Post by WharfRat »

Something just occurred to me...

All this time I have been wanting a partially transparent image.
Maybe I should use a chessboard pattern in the alpha channel instead.
I think the technique is called 'half-toning' or something like that.
Better get back to GIMP.

This seems to be the easiest solution, I'll try it now.
EventGhost 0.4.1.r1640
PHX01RN plugin v3.0.1
Windows XP 32bit (v5.1 Build 2600 Service Pack 2)
Windows7 64bit (v6.1 Build 7601 Service Pack 1)
User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: Show picture+Make it disapear after a Delay

Post by Pako »

WharfRat wrote:I was also not aware of the double-click feature. So sorry...
You do not have to apologize.
I think that almost nobody knows.
I did no promotion for it: New action System\Display Image
But I've long ago given up. Usually when I do something new, most people have no interest in it.
So why would I bother (write English is difficult for me).

Pako
User avatar
WharfRat
Experienced User
Posts: 159
Joined: Wed Dec 25, 2013 11:56 am

Re: Show picture+Make it disapear after a Delay

Post by WharfRat »

:D
DisplayImage result with chessboard alpha
DisplayImage result with chessboard alpha
result_chessboard.png (184.99 KiB) Viewed 6389 times
Here is the PNG file in the archive:
alpha_chessboard.zip
alpha_chessboard.png
(31.63 KiB) Downloaded 166 times
So, it works.
Sadly, on my system, the DisplayImage action takes about 10 seconds to process before the image is displayed. I can only guess that it has to calculate the shaped window thing.
Let me also say that this was using the original System.DisplayImage and not the newer one, although I will test it with that one later.

By the way, I am always very interested in what you do.
No one can afford to miss a thing.
I understand everything you have written perfectly.
Even your humour comes through clearly (uncle Google, the problem is on the other side of the screen, etc.), I still laugh at those two.
EventGhost 0.4.1.r1640
PHX01RN plugin v3.0.1
Windows XP 32bit (v5.1 Build 2600 Service Pack 2)
Windows7 64bit (v6.1 Build 7601 Service Pack 1)
Post Reply