BBC BASIC for Windows
« Saving transparent GIFs »

Welcome Guest. Please Login or Register.
Apr 5th, 2018, 11:10pm



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

If you require a dump of the post on your message board, please come to the support board and request it.


Thank you Conforums members.

BBC BASIC for Windows Resources
Online BBC BASIC for Windows documentation
BBC BASIC for Windows Beginners' Tutorial
BBC BASIC Home Page
BBC BASIC on Rosetta Code
BBC BASIC discussion group
BBC BASIC for Windows Programmers' Reference

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: Saving transparent GIFs  (Read 521 times)
JGHarston
Junior Member
ImageImage


member is offline

Avatar




Homepage PM

Gender: Male
Posts: 52
xx Saving transparent GIFs
« Thread started on: Oct 9th, 2013, 11:47pm »

The Wiki article Saving a GIF image gives code to save a GIF. Is it possible to specify a transparent colour in the saved GIF?

I've spent about an hour trawling through online GDIPlus documentation, and actually ended up back at the Wiki! I could do it by manually opening the saved file and adding a GIF extension block with the required data, so if the GDIPlus functions don't support it I'll write an updated library function to let you specify a transparency.
User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: Saving transparent GIFs
« Reply #1 on: Oct 10th, 2013, 04:55am »

on Oct 9th, 2013, 11:47pm, JGHarston wrote:
The Wiki article Saving a GIF image gives code to save a GIF. Is it possible to specify a transparent colour in the saved GIF?

I believe it to be quite straightforward. The Microsoft documentation states of GDI+ that "The GIF encoder identifies the first color in the ColorPalette that has an Alpha value of ZERO as the transparent color".

So it should be sufficient to modify your colour palette (either in the source BMP file or in memory) such that the desired transparent colour has an alpha value of zero and all the others have an alpha value of 255.

However I have not tried this myself and with Windows graphics you can never be sure things will work 'sensibly'! So if you have difficulties or you find it doesn't work ask here again.

Richard.
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls