Jump to content
  • Advertisement
Sign in to follow this  
Spawned218

Small problem with VB6

This topic is 3851 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi guys... Im just getting back to my VB6 roots and was messing around with the internet transfer control. got it to download an image from a supplied url and saved it to a file. the file (no matter the format) can be imported into the picture property of a picture box. however, if i open the file in windows picture and fax view (paint works too) through windows explorer and save it again without make any changes, then try and import it, it works. heres my code:
Dim pic() As Byte
pic() = Inet1.OpenURL("http://www.website.com/image.png", icByteArray)
Open "C:\Program Files\Common Files\1.gif" For Binary Access Write As #1
Put #1, , pic()
Close #1
Set PictureBox1.Picture = LoadPicture("C:\Program Files\Common Files\1.gif")
i know that the image i am downloading is in png format and i am saving it in gif format. this works. the file saves normally. I think that VB6 still thinks the image is a png...? Any help appreciated! Spawned218.

Share this post


Link to post
Share on other sites
Advertisement
If you download it in PNG format, it'll still be in PNG format unless you explictly convert it (changing the file extension isn't enough).

Share this post


Link to post
Share on other sites
Quote:
Original post by Spawned218
how does one specifically convert it then?


You can open them in an editor and save them in another format. There are also programs written for the sole purpose of conversion, these tools usually have batch conversion and maybe renaming etc.

links to a few tools you could use if you don't already have something:
http://www.getpaint.net/
http://www.irfanview.com/
http://www.snapfiles.com/get/bimp.gif.html

Share this post


Link to post
Share on other sites
what i meant was, how do i convert them through VB6 code. doing it externally is easy... open and resave in paint/windows picture and fax viewer. image works perfectly after that. but the program is dynamic. the image will be different depending for each user...

can anybody aid me?

Share this post


Link to post
Share on other sites
You will need to convert the image from png to gif, so you'll need to know the layout of the gif format and png format.
To convert between the two you will need to change the bytes in the array you have downloaded (to change the byte array layout from the png into the gif format.)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!