Anyone know how to make an "Index Transparent" gif

I have successfully made transparent PNGs and GIFusing an Alpha transparency but now I need to make images which would be the same as ueing fireworks / Photoshop to make a colour transparent. i.e. indexed transparency.
Does anyone know how to do this.
My code is as follows :
// configure all of the parameters
String text = "ABC abc XYZ xyz ["+ new Date()+"]";
String font_file = "./tst/Maiandb.TTF";
font_file = request.getRealPath(font_file);
float size = 30.0f;
Color background = Color.white;
Color color = Color.black;
Font font = Font.createFont(Font.TRUETYPE_FONT, new FileInputStream(font_file));
font = font.deriveFont(size);
buffer = new java.awt.image.BufferedImage(1,1,java.awt.image.BufferedImage.TYPE_INT_RGB);
Graphics2D g2 = buffer.createGraphics();
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
java.awt.font.FontRenderContext fc = g2.getFontRenderContext();
java.awt.geom.Rectangle2D bounds = font.getStringBounds(text,fc);
// calculate the size of the text
width = (int) bounds.getWidth();
height = (int) bounds.getHeight();
// prepare some output
buffer = new java.awt.image.BufferedImage(width, height, java.awt.image.BufferedImage.TYPE_INT_ARGB);
g2 = buffer.createGraphics();
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);
g2.setFont(font);
// actually do the drawing
Color transparent = new Color(0, 0, 0, 0);
g2.setColor(transparent);
g2.fillRect(0,0,width,height);
g2.setColor(color);
g2.setComposite(AlphaComposite.SrcOver);
g2.drawString(text,0,(int)-bounds.getY());
File file = new File ("./jsp1/tst/fred1.gif");
com.gif4j.light.GifImage gifImage = new com.gif4j.light.GifImage();
com.gif4j.light.GifFrame gifFrame = new com.gif4j.light.GifFrame(buffer);
gifImage.addGifFrame(gifFrame);
GifEncoder.encode(gifImage, file);Thanks in advance

^^EDIT^^
System admins updated iMac to OS X Mountain Lion (10.8.4).

Similar Messages

  • My subscribed calendar does not display in today view in iOS7. Does anyone know how to make it show up?

    I have a subscribed calendar on my iPhone. The today view in notification center shows that I have an event at xxxx and tomorrow view says I have x events but the calendar day view does not display any of the events. I need this so I can easily see which rooms my events are in. Dows anyone know how to make the subscribed calendar show up in calendar day view?

    Interesting. May have uncovered a bug. It seems that limited duration events will display, but all day events wont on mine. (iPhone 5). Does that compare to what you are seeing (unfortunately, I have nothing in a subscribed calendar until the week end, so difficult to check. I do seem to recall seeing an event from one this past week end on the iPad, however).

  • Does anyone know how to make an appoitment on the net?  My iphone has died and I need to take it in tomorrow but don't know how to book in???

    Does anyone know how to make an appointment with a genius on the net please?   Also is there a chat room that can be accessed on the net?   My iphone has died and I desperately need to take it in to get fixed/replaced.   I can't find anything..............help!!!

    Apple Retail Store - Genius Bar
    What kind of chat room?
    Have you tried basics from the manual?  restart, reset, restore

  • HT201270 MORNING COMMUNITY, anyone know how to make the i4s forget a network - when the device won't give you that option?

    MORNING COMMUNITY, anyone know how to make the i4s forget a network - when the device won't give you that option?

    if you dont have the options to forget network you can reset your network settings, but than the device forget all networks
    settings > general > reset > reset network settings

  • Anyone know how to make vertical text in a table in keynote?

    anyone know how to make vertical text in a table in keynote?

    Just to add a bit more about this question. I have seen in other related questions that this feature (vertical text) is not available in (apparently) the whole iWork09. someone even said that it should be asked to the developers, so they include this feature in iWork10. I find this issue a bit sad. This feature has been present in msOffice since a while, and at least for me, this is quite important for my work. It is also apparently not possible to have different page orientation in the same document, meaning portrait and landscape, so one can have wide tables in a whole page, for example. If this is true, it is again sad, and I just cannot understand why such a basic feature is not available in an already 09 version. I am using only the trial version of iWork, but already in the first day I have discovered that I actually cannot do what I was used to. Again sadly I (and many others I guess) will have to stick to Office until the mac software is fully developed.

  • Anyone knows how to make this code to netbeans??

    anyone knows how to make this code to netbeans?? i just want to convert it into netbeans... im not really advance with this software... anyway..just reply if you have any idea...or steps how to build it... etc.... thanks guys...
       import javax.swing.*;
       import javax.swing.table.*;
       import java.awt.*;
       import java.awt.event.*;
       import java.util.regex.*;
       public class FilterTable {
         public static void main(String args[]) {
           Runnable runner = new Runnable() {
             public void run() {
               JFrame frame = new JFrame("Sorting JTable");
               frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
               Object rows[][] = {
                 {"AMZN", "Amazon", 41.28},
                 {"EBAY", "eBay", 41.57},
                 {"GOOG", "Google", 388.33},
                 {"MSFT", "Microsoft", 26.56},
                 {"NOK", "Nokia Corp", 17.13},
                 {"ORCL", "Oracle Corp.", 12.52},
                 {"SUNW", "Sun Microsystems", 3.86},
                 {"TWX",  "Time Warner", 17.66},
                 {"VOD",  "Vodafone Group", 26.02},
                 {"YHOO", "Yahoo!", 37.69}
               Object columns[] = {"Symbol", "Name", "Price"};
               TableModel model =
                  new DefaultTableModel(rows, columns) {
                 public Class getColumnClass(int column) {
                   Class returnValue;
                   if ((column >= 0) && (column < getColumnCount())) {
                     returnValue = getValueAt(0, column).getClass();
                   } else {
                     returnValue = Object.class;
                   return returnValue;
               JTable table = new JTable(model);
               final TableRowSorter<TableModel> sorter =
                       new TableRowSorter<TableModel>(model);
               table.setRowSorter(sorter);
               JScrollPane pane = new JScrollPane(table);
               frame.add(pane, BorderLayout.CENTER);
               JPanel panel = new JPanel(new BorderLayout());
               JLabel label = new JLabel("Filter");
               panel.add(label, BorderLayout.WEST);
               final JTextField filterText =
                   new JTextField("SUN");
               panel.add(filterText, BorderLayout.CENTER);
               frame.add(panel, BorderLayout.NORTH);
               JButton button = new JButton("Filter");
               button.addActionListener(new ActionListener() {
                 public void actionPerformed(ActionEvent e) {
                   String text = filterText.getText();
                   if (text.length() == 0) {
                     sorter.setRowFilter(null);
                   } else {
                     try {
                       sorter.setRowFilter(
                           RowFilter.regexFilter(text));
                     } catch (PatternSyntaxException pse) {
                       System.err.println("Bad regex pattern");
               frame.add(button, BorderLayout.SOUTH);
               frame.setSize(300, 250);
               frame.setVisible(true);
           EventQueue.invokeLater(runner);
       }

    its okay onmosh.....what we need to
    this...forum....is to have a good......relationship
    of programmers......and to start with .....we need to
    have a good attitude........right.....???.....no
    matter how good you are in programming but if you did
    not posses the right kind of attitude....everything
    is useless.....in the first place....all we
    want....is just to ask...some....help....but
    conflicts......but unluckily......we did not expect
    that there are members in here which......not
    good...to follow.....just as suggestion for those
    people not having the right kind of attidude...why
    can't you do in a very nice message sharing in a very
    nice....way....why we need to put some
    stupid....stuff...words.....can't you live with out
    ******* ****....its not.....lastly especially you
    have your children right now and people around...that
    somehow......idiolize...you even me....is one of
    them......but showing but attitude....is not
    good......tnx....hope you'll take it this....in the
    positive side.....be optimistic...guys....the
    world..is not yours....all of us will just past
    away....always..remember that one.....treasure..our
    stay in this....temporary home.....which...is
    world....Whoa. That post seems to be killing my brain.
    URK
    Join........us..........do not be..........afraid.......

  • I have my iPhone locked and I don't want the music controls to pop up when I double click the home button. Does anyone know how to make it stop?

    I have my iPhone locked and I don't want the music controls to pop up when I double click the home button. Does anyone know how to make it stop?

    what exactly are you trying to accomplish here? i understand that you don't want to see the music status come up on your lock screen, but what are you trying to do by clicking your home button at all?

  • I just installed an update on my iPhone and since then the choice to repeat music, or not, has disappeared and it automatically plays songs and albums on a loop. Anyone know how to make it play an album or song just once?

    I just installed an update on my iPhone and since then the choice to repeat music, or not, has disappeared and it automatically plays songs and albums on a loop. Anyone know how to make it play an album or song just once?

    Basics from the manual are restrt, reset, restore.
    Have you tried each of these?

  • My backlight will not turn off automatically.  I have to manually turn it off and forget to sometimes and that drains my battery.  Does anyone know how to make it turn of automatically after a few seconds?

    My backlight will not turn off automatically.  I have to manually turn it off and forget to sometimes and that drains my battery.  Does anyone know how to make it turn of automatically after a few seconds?

    Use the Settings app.
    Settings > General > Auto Lock
    Is Auto Lock set to Never? Change it to less time.

  • Does anyone know how to make songs in your playlist play directly after each other with no break between then, ie no silent period?

    Does anyone know how to make songs in your playlist play directly after each other with no break between then, ie no silent period?

    you cannot.

  • Does anyone know how to make Safari send e-mail? Mine won't and hasn't for some time.

    I have been having trouble for some time sending e-mails by Safari - no problems with Mail - Does anyone know how to make Safari send e-mails?

    When we first got our new iMac we were able to send e-mail through Safari - somewhere in the last 2-3 years it stopped and we got the failure to deliver message. We then sent e-mails through Mail - it works well and we have gotten used to doing this. However, every once in a while I retry send e-mails through Safari and we still get the  failure to deliver notice. This has also happened when we try to forward some e-mails we receive (not all; most get forwarded).

  • TS1702 I cannot get an unlocked version of drivesafe.ly to operate on any accounts on my iphone 4S and have had no help when I asked them for support.  I am now trying to figure out how to refund the product.  Anyone know how to make that request through

    I cannot get an unlocked version of drivesafe.ly to operate on any accounts on my iphone 4S and have had no help when I asked them for support.  I am now trying to figure out how to refund the product.  Anyone know how to make that request through itunes?

    Try assigning Queen as the Album Artist on the compilations in iTunes on your computer.

  • Why can't Apple and HP get Mountain Lion 10.8.4 to work with the HP OfficeJet 7610?  Does anyone know how to make the wireless scanning work?

    Does anyone know how to make the HP OfficeJet 7610 (latest version) and iMac 3.4 GHz i7 running 10.8.4 work together correctly?  Print function seems to work ok.  Just can't find the scanner in any setup.

    In System Preferences/Print & Scan is there a scan option?

  • Does anyone know how to make SmallCaps out of a font in Muse?

    I am using Palatino and would like to make SmallCaps and SmallCaps Italic.
    Does anyone know how to do this in Muse?
    Thank you for the help.

    Hi,
    An update: Adobe Muse CC 2014.1 (released earlier today) includes support for self-hosted web fonts. To use a specific font in your Muse site, you will need to install the system font (properly licensed for desktop use) and provide the corresponding web font files (properly licensed for use on a website).
    Give it a try and let us know if you need help or run into issues.
    Abhishek

  • Camera shutter stays closed.  Does anyone know how to make it open or reset it?

    When opening camera app, the shutter stays closed on the display and I can not take picture.  Does anyone know how to reset it to make it work?

    Close Camera apps
    1. Double tap the home button to bring up the multi-tasking view
    2. Swipe the Camera app upwards to close
    3. The app will fly off the screen
    4. Test Camera again

Maybe you are looking for

  • Script Task : exception has been thrown by the target of an invocation

    Having a simple SSIS package that downloads a file from SharePoint using client object model. the task runs successfully through VS2010 IDE and SQL Agent on development workstation but fails when running through SQL Agent on the server. there are oth

  • Can anyone help with this safari error, unexpectedly quits COMSOLMultiphysics tmp plugin

    I have a continual error (15times in 2 days) with safari quitting and this Plugin error. Is anyone familiar with it and can offer any suggestions as to going about sorting it. Thanks

  • Reducing in CS3

    Mac/OS X/InDesign CS3 Trying to reduce a 27 page document to 47%. Using a program called "Gluon". Reducing 6 pages at a time. Some items are not reducing, tabs are not reducing, embedded images are not reducing. Is there a script for this or am I mis

  • SAP, VBScript, import data to solution manager

    Hi, I'm  trying to import to Solution Manager a testset-structure (from Excel, but Excel is no problem) I could not find out, how to allocate in SOLAR01/02 a folder structure, testpackages and last but not least testcases, I did not even succeed to e

  • HT1338 Why do my apps not work?

    I updated my OSX from Leopard to Snow Leopard and now my mail doesnt work and a few other programs...what do I do?