Sign in to follow this  
Followers 0
Bot

GIF Transparency Error

20 posts in this topic

I have this GIF image :

Posted Image

And I tried to make it transparent

$gui=GUICreate("test transparentpic", 200, 100)
$pic=GUICreate("", 48, 48, 10, 10,$WS_POPUP,BitOr($WS_EX_LAYERED,$WS_EX_MDICHILD),$gui)
GUICtrlCreatePic("C:\start.gif",0,0, 0,0)

GUISetState(@SW_SHOW,$pic)
GUISetState(@SW_SHOW,$gui)

But the result is :

Posted Image

Can anyone help me please :) ?

Share this post


Link to post
Share on other sites



Or is this what you're looking for?

original code by lod3n ( http://www.autoitscript.com/forum/index.ph...st&p=356178 )

#include <GUIConstants.au3>
$pic = "c:\start.gif"
$width = 21
$height = 21
$gui = GUICreate("GUI Transparency", $width, $height, -1, -1, $WS_POPUP, $WS_EX_LAYERED)
$pic = GUICtrlCreatePic($pic, 0, 0, $width, $height,-1,$GUI_WS_EX_PARENTDRAG)
GUISetState(@SW_SHOW)
WinSetOnTop($gui, "",1)

While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
Wend

Share this post


Link to post
Share on other sites

What exactly do you mean by you're trying to make it transparent? Are you trying to make the window transparent and show only the gif or vice versa?

Share this post


Link to post
Share on other sites

No, I just want to make the GIF transparent and keep the window original. I have followed the link of dufran3 but this script required so much other resources :). The script by ResNullius show only my GIF without the window. Can you help me please :P ?

Share this post


Link to post
Share on other sites

No, I just want to make the GIF transparent and keep the window original. I have followed the link of dufran3 but this script required so much other resources :). The script by ResNullius show only my GIF without the window. Can you help me please :P ?

Is this what u want?

Share this post


Link to post
Share on other sites

Yes, that's right ! Can you pass it to me please :) ?

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Yes, that's right ! Can you pass it to me please :) ?

Bot...I didnt do anything different then what you did. I am using the 3.2.4.9 (Production) version of Autoit.

#include <GuiConstants.au3>

$gui=GUICreate("test transparentpic", 200, 100)
$pic=GUICreate("", 48, 48, 10, 10,$WS_POPUP,BitOr($WS_EX_LAYERED,$WS_EX_MDICHILD),$gui)
GUICtrlCreatePic(@ScriptDir & "\button.gif",0,0, 0,0)

GUISetState(@SW_SHOW,$pic)
GUISetState(@SW_SHOW,$gui)
Edited by DjDeep00

Share this post


Link to post
Share on other sites

I'm using the 3.2.4.9 too and I have tried the new beta version 3.2.5.1 but nothing change :). Maybe AutoIT GUI is different on each computer ?

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

I'm using the 3.2.4.9 too and I have tried the new beta version 3.2.5.1 but nothing change :). Maybe AutoIT GUI is different on each computer ?

@Bot,

Downloading the image in your first post and using your original script, I get the same results as DjDeep00.

That is, the square border of the gif doesn't show, but the inside of the arrow on the circle is white.

To reproduce the Gui snapshot you have in your first post where the inside of the arrow is grey, I have to edit the gif and make that part transparent.

Are you sure your using the same gif as you posted?

edit: spelling (it's border, not borfer!)

Edited by ResNullius

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

Yes, I can make sure that I'm using the same GIF as I posted. I also tried the original image and the image after uploading but the results are the same :) . Can you show me your edited GIF please ?

Edited : Aw I have tried on my Virtual PC and the result is same as you and DjDeep00 but when I tried on my VPS ( Windows 2003 Server ) ( I'm using Windows XP ) then the GIF went on error. So what is happening here ?

Edited by Bot

Share this post


Link to post
Share on other sites

OK, I think I have found it out. When I set my screen color depth to 16bit then there will be error, but if 32bit then no problem. Maybe it's a new bug ? :)

post-25790-1186566914_thumb.jpg

post-25790-1186566939_thumb.jpg

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

OK, I think I have found it out. When I set my screen color depth to 16bit then there will be error, but if 32bit then no problem. Maybe it's a new bug ? :)

I can verify this as reproducible on Win XP.

Funny thing is, which is the bug, the fact that it becomes transparent at the 16-bit level, or the fact it isn't at the 32-bit level?

If you open the graphic in an editor, the only region stored as transparent is the outside. The inside of the arrow is still white.

Also, if you want to see something else funky then run the sample and change (reduce or increase) your screen resolution.

Suddenly the gif is seperated from the main Gui!

EDIT: Well curiouser & curiouser- when I open the image in an editor and my colour depth is set to 16-bit, then both the outside border and the inside of the arrow show as transparent. Edited with colours set to 32-bit and only the outside shows as transparent, the inside of the arrow shows as white!

So, must be a windows & gif & colour depth weirdness independent of AutoIt.

Edited by ResNullius

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

Nah, I opened the GIF in GIMP in both 16bit and 32bit depth and no problem happened. The transparent problem also shows on Windows 2000 Professional and Windows 2003 Server ( I tested myself :) ), so I think it's must be something caused by AutoIT, not by Windows XP. :P

Edited by Bot

Share this post


Link to post
Share on other sites

A curious result. I opened the GIF provided in the first post, and in an icon editor, the outside showed as "inverted" (inverts the color behind it when used as a cursor or icon), and the arrow is white. Just though it might interest someone. When I opened it in a GIF editor, the outside was transparent and the arrow was still white.

Share this post


Link to post
Share on other sites

Nah, I opened the GIF in GIMP in both 16bit and 32bit depth and no problem happened. The transparent problem also shows on Windows 2000 Professional and Windows 2003 Server ( I tested myself :) ), so I think it's must be something caused by AutoIT, not by Windows XP. :P

Well, you're right about GIMP and several other editors. The first one I tried and which does show the results as I described above is PhotFiltre http://www.photofiltre.com .

Share this post


Link to post
Share on other sites

Well, so what is the reason for this problem ? Can anyone explain this please ? It's just a normal GIF file that I think it couldn't be any kind of mystery behind it. :)

Share this post


Link to post
Share on other sites

Hi everybody

@ Bot:

The zone outside the circle is white, but the triangle is not pure white: 254 255 252. For some reason (don't know why), when using 16 bit color depth, this color is "mapped" to white => it should be transparent too. As a workaround, try to make the triangle as far from white as posible, or viceversa. I think making the outer zone darker is better. Try 220 220 220.

alc

Share this post


Link to post
Share on other sites

Thanks for your explanation but what is happening with the position of the GIF as each time you change your screen resolution then the GIF will be moved ? :)

Share this post


Link to post
Share on other sites

Hi Bot:

It seems a bug to me, at least in the production release (I don't have Beta installed)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0