Jump to content
Sign in to follow this  
kev51773

Possible bug in GUICtrlSetImage

Recommended Posts

kev51773

I have created a Pic control using GUICtrlCreatePic, I use this control to display a gif image. All works well. If I try to update the image using GUICtrlSetImage, the same image will not display and the GUICtrlSetImage returns 0.

This only seems to occur with 3bit gif images and more specifically only in 3 bit gif images if they contain a value greater than 0 for all three of red, green and blue.

I'm probably not explaining this will so instead please see the following examples, the images are identical apart from the colour. All will display with GUICtrlCreatePic, but only the first three will work with GUICtrlSetImage.

post-13650-0-29626100-1378920948_thumb.g

post-13650-0-69640700-1378920947_thumb.g

post-13650-0-09100400-1378920947_thumb.g

post-13650-0-72891900-1378920948_thumb.g

The only way I can make this image display is by saving it as 8 bit, thereby increasing file size by over 13 times.

Share this post


Link to post
Share on other sites
JLogan3o13

Hi, kev51773. Please post your code, so we can see what you're doing. Otherwise, we first have to guess at what you're doing, and then try to troubleshoot it for you :)


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
kev51773

Actually, oops. It doesn't return 0 (I was getting the return value from my function). It just doesn't display anything. Now I'm suspecting it's a transparency problem but I can't for the life of me figure of a good way to sort it. I wanted 3 bit gifs for the smallest possible file size.

There doesn't seem much point in posting my code now I realise that I was wrong with the return value, the remainder of the problem can be recreated by

GUICreate("test")
$pic = GUICtrlCreatePic("C:\blah\Blue.gif",0,0)
GUISetState()

sleep(1000)

GUICtrlSetImage($pic,"C:\blah\White.gif")

sleep(1000)

exit

The blue image will not be replaced by the white. If you swap the two file names then it will successfully change from white to blue.

Edited by kev51773

Share this post


Link to post
Share on other sites
dragan

You cannot use gifs to set image to the button. You can save them as jpg though and then use them.

The other idea could be to load gif into gdi, convert to bmp, save as temporary file, use it for a button, and delete the temp bmp afterwards.

Share this post


Link to post
Share on other sites
kev51773

The gifs work fine in every other colour than white (It's even specified that it supported in the help file for GUICtrlCreatePic).

In fact, even the white works with GuiCtrlCreatePic, it's just the one colour variation of identical images that won't work with GuiCtrlSetImage.

I'd really rather not get into GDI. I started that way and found it very slow (probably my own fault)

I guess I have two choices

a) delete and recreate the picture control rather than updating the image in an existing picture control

B) use 8 bit gifs because they seem to work without issue and although they're larger they're still considerably smaller than bmp or jpg)

Edited by kev51773

Share this post


Link to post
Share on other sites
DW1

The gifs work fine in every other colour than white (It's even specified that it supported in the help file for GUICtrlCreatePic).

In fact, even the white works with GuiCtrlCreatePic, it's just the one colour variation of identical images that won't work with GuiCtrlSetImage.

I'd really rather not get into GDI. I started that way and found it very slow (probably my own fault)

I guess I have two choices

a) delete and recreate the picture control rather than updating the image in an existing picture control

B) use 8 bit gifs because they seem to work without issue and although they're larger they're still considerably smaller than bmp or jpg)

or c) use GDI+ as it seems to handle the files fine.

I agree that you should submit a bug report, and even if it turns out to be working as designed, it would be nice if you could come back to this thread and let us know the outcome.

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  

×