Jump to content

GIF Transparency Error


Bot
 Share

Recommended Posts

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 :) ?

Link to comment
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
Link to comment
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?

Link to comment
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 ?

Link to comment
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?

Link to comment
Share on other sites

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
Link to comment
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 ?

@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
Link to comment
Share on other sites

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
Link to comment
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 ? :)

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
Link to comment
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

Edited by Bot
Link to comment
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.

Link to comment
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 .
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...