Jump to content



Photo

GIF Transparency Error


  • Please log in to reply
19 replies to this topic

#1 Bot

Bot

    Wayfarer

  • Active Members
  • Pip
  • 61 posts

Posted 06 August 2007 - 10:43 AM

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





#2 dufran3

dufran3

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 463 posts

Posted 06 August 2007 - 03:56 PM

Try looking into this

http://www.autoitscript.com/forum/index.php?showtopic=47651

#3 ResNullius

ResNullius

    Drink Deep, or Taste Not the Pierian Spring

  • Active Members
  • PipPipPipPipPipPip
  • 1,031 posts

Posted 06 August 2007 - 05:13 PM

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


#4 dbzfanatic

dbzfanatic

    functional psychopath!!

  • Active Members
  • PipPipPipPipPipPip
  • 1,084 posts

Posted 07 August 2007 - 09:50 AM

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?

#5 Bot

Bot

    Wayfarer

  • Active Members
  • Pip
  • 61 posts

Posted 07 August 2007 - 10:01 AM

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 ?

#6 DjDeep00

DjDeep00

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 654 posts

Posted 07 August 2007 - 02:40 PM

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?

#7 Bot

Bot

    Wayfarer

  • Active Members
  • Pip
  • 61 posts

Posted 07 August 2007 - 02:58 PM

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

#8 DjDeep00

DjDeep00

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 654 posts

Posted 07 August 2007 - 08:57 PM

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, 07 August 2007 - 08:58 PM.


#9 Bot

Bot

    Wayfarer

  • Active Members
  • Pip
  • 61 posts

Posted 08 August 2007 - 04:36 AM

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 ?

#10 ResNullius

ResNullius

    Drink Deep, or Taste Not the Pierian Spring

  • Active Members
  • PipPipPipPipPipPip
  • 1,031 posts

Posted 08 August 2007 - 05:09 AM

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, 08 August 2007 - 05:10 AM.


#11 Bot

Bot

    Wayfarer

  • Active Members
  • Pip
  • 61 posts

Posted 08 August 2007 - 06:05 AM

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, 08 August 2007 - 06:16 AM.


#12 Bot

Bot

    Wayfarer

  • Active Members
  • Pip
  • 61 posts

Posted 08 August 2007 - 09:56 AM

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

Attached Thumbnails

  • 16bit.jpg
  • 32bit.jpg


#13 ResNullius

ResNullius

    Drink Deep, or Taste Not the Pierian Spring

  • Active Members
  • PipPipPipPipPipPip
  • 1,031 posts

Posted 09 August 2007 - 02:32 AM

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, 09 August 2007 - 02:41 AM.


#14 Bot

Bot

    Wayfarer

  • Active Members
  • Pip
  • 61 posts

Posted 09 August 2007 - 04:16 AM

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, 09 August 2007 - 04:23 AM.


#15 Richard Robertson

Richard Robertson

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 9,692 posts

Posted 09 August 2007 - 05:19 AM

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.

#16 ResNullius

ResNullius

    Drink Deep, or Taste Not the Pierian Spring

  • Active Members
  • PipPipPipPipPipPip
  • 1,031 posts

Posted 09 August 2007 - 07:10 AM

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 .

#17 Bot

Bot

    Wayfarer

  • Active Members
  • Pip
  • 61 posts

Posted 09 August 2007 - 08:20 AM

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

#18 alc

alc

    Wayfarer

  • Active Members
  • Pip
  • 74 posts

Posted 09 August 2007 - 03:27 PM

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

#19 Bot

Bot

    Wayfarer

  • Active Members
  • Pip
  • 61 posts

Posted 10 August 2007 - 04:23 AM

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

#20 alc

alc

    Wayfarer

  • Active Members
  • Pip
  • 74 posts

Posted 10 August 2007 - 01:59 PM

Hi Bot:

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




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users