How to save GIF frames into BufferedImage with TYPE_BYTE_INDEXED?

Hi All,
I have a code that saves every animated GIF frame into BufferedImage of TYPE_INT_ARGB. So an animated GIF will correspond to a list of images with 32-bit pixel size.
I mainly refer to the code in
http://forum.java.sun.com/thread.jspa?forumID=20&threadID=629277
But what I need to do now is to store each frame into TYPE_BYTE_INDEXED image instead. What I'm doing is I get the IndexColorModel from the first frame, and that color model will be shared for all frames.
As for the frames, I've been trying several ways:
*1.* read it per usual into 32-bit pixel size image
sourceImage        = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
RenderedImage renderedImg = reader.readAsRenderedImage(index, null);*reader is the ImageReader for the GIF file.
then trying to convert the image into 8-bit pixel size by creating new destination image
BufferedImage destImage = new BufferedImage(width, height, BufferedImage.TYPE_BYTE_INDEXED, ICM);and then draw the original (32-bit pixel size) onto the newly created image.
Graphics2D g = destImage.createGraphics();
g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC));
g.drawImage(sourceImage, imageLeft, imageTop, null);*2.* read it as:
BufferedImage sourceImage = reader.read(index);then create new 8-bit image and draw the source onto it as No. 1.
The problem is, for No. 1 , the destination image always lose its transparency. And No. 2 only works well with some GIFs. But mostly the destination image will lose the transparency as well.
I hope someone more familiar with java imaging can help point out to me where did I do wrong...
I'm thinking maybe the way I draw the source onto the destination. Or maybe there's another way of getting GIF frames into TYPE_BYTE_INDEXED images..
Thank you in advanced :)
Edited by: irma_k on Dec 12, 2007 8:42 PM

I found that java has weird issues with GIF's (ImageIO wont even write transparency to GIFs when writing to a file).
But PNGs seemed to work a lot better. Not sure if it will fix your problem, as I don't know all that much about java imaging, but using PNGs seemed to work a lot better for me when I needed to draw transparency.

Similar Messages

  • How can I load data into table with SQL*LOADER

    how can I load data into table with SQL*LOADER
    when column data length more than 255 bytes?
    when column exceed 255 ,data can not be insert into table by SQL*LOADER
    CREATE TABLE A (
    A VARCHAR2 ( 10 ) ,
    B VARCHAR2 ( 10 ) ,
    C VARCHAR2 ( 10 ) ,
    E VARCHAR2 ( 2000 ) );
    control file:
    load data
    append into table A
    fields terminated by X'09'
    (A , B , C , E )
    SQL*LOADER command:
    sqlldr test/test control=A_ctl.txt data=A.xls log=b.log
    datafile:
    column E is more than 255bytes
    1     1     1     1234567------(more than 255bytes)
    1     1     1     1234567------(more than 255bytes)
    1     1     1     1234567------(more than 255bytes)
    1     1     1     1234567------(more than 255bytes)
    1     1     1     1234567------(more than 255bytes)
    1     1     1     1234567------(more than 255bytes)
    1     1     1     1234567------(more than 255bytes)
    1     1     1     1234567------(more than 255bytes)

    Check this out.
    http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96652/ch06.htm#1006961

  • How to save image files into SQL Server?

    Hello, All:
    Does anyone know how to save image files into SQL Server? Does the file type have to be changed first?? Please help me! Thank you!

    You need a BLOB field (usually)... Then you can check this tutorial out:
    http://java.sun.com/developer/onlineTraining/Database/JDBC20Intro/exercises/BLOBPut/
    There are other exercises on that site, including one on reading the images back.

  • How can save 600 frames in photoshop CS6

    i have about 600 frames in timeline in photoshop cs6
    i want to make Create Frame Animatiom
    but photoshop not allow to save more 500 frames
    what can i do?
    thanks

    Photoshop does have limits. When you run into one of them you can summit a request to Adobe to up the limit.  I made such a request for Alpha channels I would be very happy with a limit like 500 instead of the Alpha channel limit of 53.  Adobe seems to feel that 53 is a large number and can not see where user would want more, 500 must be a huge number then.  My advice is to look for a small freeware program for doing timelaps sequences and use Photoshop to save your frame layers combos as frame file then use the freeware to make the animation.  It does not make much scene to make an Animated gif with something like 600 frames.  If you want a 600 frame animation on the web you would want to stream a video type file..

  • How to save BI report into normal excel sheet in Bex Analyzer

    Hi Experts,
    version of  Bex Analyzer:
    Bi addon 7.x
    support package 7,patch 1
    version 7004.4.0.5
    excel-2003
    when i am trying to save the report into excel in Bex Analyzer as below:
    file-save as->Microsoft excel work.
    when I open excel I am getting pop up windowu201Dthis file contains macros  with an expired or revoked signature.Since your running under  high security level,these macros will be disabled.u201D
    when I click ok I am getting one more pop upwindow as u201Cmacros  are diabled because the security level is set to high and a digitally signed trusted certificate is not attached to macros.to run the macros,change the security level to a lower setting(not recommended),or request the macros signed by the author  using a certificate  issued by a certificate authority.
    what are these macros? why i am getting this pop up windows
    When i opened  the excel report is not looks like general excel report.how can I generate general excel report .I should not want to get excel report as in bex analyzer.I donu2019t want to have author ,status of data,chart,filter,information in excel report.
    what settings I have to made to save the report in general excel format.
    As i am new to Bi please correct me if i am wrong.
    Anything is appreciable.
    regards,
    naresh.

    Macros in general are nothing but piece of code in excel.
    To allow unsigned macros to run, the Trust all installed add-ins and templates check box must be selected on the Trusted Publishers tab of the Security dialog box. This option is selected by default. If it is not selected (recommended), Excel allows you to run only macros that have trusted digital signatures.
    1. On the Tools menu, point to Macro, and then click Security.
    2. On the Trusted Publishers tab, select the Trust all installed add-ins and templates check box.

  • How to save User input into DB using webdynpro abap

    Hi,
    Im trying to create an application using webdynpro abap.
    I want to know how to save the data input by user, into a database table.
    In my UI, I have a table control which is editable and user inputs data into this. I need to know how i can transfer this data to a DB table.

    hello,
    u can do it by reading ur context node.
    we bind our UI elements to context attributes of appropriate type .
    we read their values using the code wizard or by pressing control+F7, click on radio button read node/attribute
    here for ur specific case , u must have binded ur table control with the context attribute , now u need to simply read this attribute
    eg suppose u have created a context node " cn_table"
      reading context node cn_table
       DATA : lo_nd_cn_table TYPE REF TO if_wd_context_node ,
             lo_el_cn_table TYPE REF TO if_wd_context_element ,
             ls_cn_table    TYPE wd_this->element_cn_table.
    *   navigate from <CONTEXT> to <CN_TABLE> via lead selection
      lo_nd_cn_table = wd_context->get_child_node(
                       name = wd_this->wdctx_cn_table ).
    **    get element via lead selection
      lo_el_cn_table = lo_nd_cn_table->get_lead_selection(  ).
      lo_el_cn_table->get_static_attributes( IMPORTING
                 static_attributes = wa_table ).
    here wa_table is the work area of structure type . u need to create a structure first with the same variables as there are the context attributes in ur node cn_table
    in ur
    now ur wa_tablecontains value
    u can nw use appropriate FM to update , delete and modify the DB table using the value
    u cn directly use SQL statements as well in the method of ur view , but direct SQL statements are nt recommende
    rgds,
    amit

  • How to save toll free no starts with 1800?

    Hi, today I came in front of a strange problem(bug) of IOS7. I am from India &amp; here all the toll free no starts with 1800. I can call my bank'a (Axis Bank) toll free no (1800 233 5577) from my iphone directly but whenever I am saving the no in my iphone it automatically converts the no into +1 (800) 233 5577; which is an US no &amp; the call could not be processed. Those toll free no doesn't work if u add '0' or India's country code '+91' at the beginning. How to save the no where I can make the call directly from the contacts.

    Hi Debdut,
    I jus found an answer in another thread. Re-posting in case if you are trying like me still!
    Just go to Settings -> Phone -> Dial Assist and disable it!
    This was a feature introduced from iOS6
    This solves the issues altogether!
    Cheers!

  • May someone know how to save my file into HTML5?

    Hello, I have Adobe After Effect CC 2014, and I wanted to save or export my files into HTML5 with out errors, does anyone knows how to do it?  Thank you!
    regards
    BI

    Thanks for your answer, but how to export into H.264 in MP4 format since I can only select MOV format.... please advise. 
    I was trying to create some animated logo and use it for website, I export the my file into .MOV but the file size was super large (1180x512pix, 24 films/sc, file size: 452.3MB)  how do I compress the file be able to use it for website?
    regards
    BI

  • How to save a CWGraph into a bitmap (.bmp) file in Visual C++?

    I plot (chart) data into a graph control on a MFC dialog in Visual C++ and I need to save the image into a bmp file. I found the ControlImage method, but did not find any way to use it in Visual C++.
    I would also like to retrieve the chart data (the point charted on the graph for each plot) and to use them to build data files. How to do it?

    Dealing with images in VC++ is far from easy. You would need to create the following objects: CBitmap, CArchive, CPictureHolder and a CDC.
    Then call the SelectObject function on the CDC and pass in the CBitmap object. Then you can put the image of the graph in the CPictureHolder with:
    ph.SetPictureDispatch((LPPICTUREDISP)m_CWGraph.Con​trolImage().m_lpDispatch);
    where ph is the CPictureHolder and m_CWGraph is the CWGraph.
    Then you can render the image to the bitmap CDC by calling the CPictureHolder::Render function. It will ask for the bounds of the picture in CRect form as well.
    Then you can call the CBitmap.Serialize function with the CArchive object which should be pointing to the appropriate BMP file. Don't you just love MFC?
    As for you second qu
    estion, you can't retrieve the data that has been plotted to the graph. We don't maintain the data that is sent in because it would be very inefficient memory usage since data is usually decimated for display. I would recommend that you just send your data to a global buffer at the same time as plotting.
    Best Regards,
    Chris Matthews
    Measurement Studio Support Manager

  • How to save VISA information into a configuration file

    Hi guys,
    I've got a problem that i can't quite figure out and I'm sure someone else has done this but i have searched the forums and didn't find anything suitable myself.
    I'm trying to save configuration files for my program and then reload them back in so that i can get the same state of the controls.  One of the controls I'd like to save into the configuration file is a VISA control.  has anyone figured out how to save this into configuration files?  I know that OpenG has a write variant to config but Id like to stay away from 3rd party stuff as much as possible.  Does anyone have any suggestions as to how to get around this?
    Thanks
    Brent 
    Solved!
    Go to Solution.

    The alternative to Write Keys, if you don't want a text file, is a BIN file. I do it this way when I don't want users poking around text file trying to change things, and/or for security. And it's fast.
    The attached picture shows, in general, how to do it.
    Richard
    Attachments:
    saveSettings.gif ‏11 KB

  • How to see .gif files in iOS with animations ?

    how can i view .gif files on iphone with animations

    Welcome to Apple Support Communities
    You can't see by default hidden files through Finder. However, you can do it with a command that you can copy in Terminal (in /Applications/Utilities). Open this application and type:
    defaults write com.apple.finder AppleShowAllFiles TRUE && killall Finder
    After doing it, you will be able to see hidden files through Finder in all the volumes connected to the MacBook Pro

  • How to package the runtime into APK with Flash Pro + AIR 3 SDK?

    Hi
    I'm very glad to update my AIR SDK from 2.7 to 3.0 and everything seems working well. But how can I package runtime into .apk file with Flash Pro?
    Should I change the XXXXX-app.xml manually?
    Thanks

    Thanks, that explains a lot.
    I'm afraid I'm a bit confused about what the preferred way of developing extensions is going ahead. There seems to be a lot of conflicting documentation on the adobe site, e.g. http://www.adobe.com/devnet/creativesuite.html  seems like the top page for extension documentation but it only talks about CS SDK 2.0 which uses CSXS and doesn't seem to be compatible with creative cloud apps.
    Then there's CS Extension Builder 2.1 which looks like it supports Flash Pro CC but isn't mentioned in the pages you linked too and it doesn't mention JSFL, but talks about the CSAW library.
    Do you know if:
    * The CS SDK has been dropped completely? 
    * CS Extenstion Builder is deprecated? (I can't see it as an option in the list of Creative Cloud apps)
    * Is then any documentation/utilities to help migrate existing CSXS extensions to work with creative cloud apps?
    Thanks,
    Stephen

  • How to save ALV data into DB after Editing values in WDA

    Hi All,
    I have created a WD application with and able to successfully make columns editable in ALV. But I failed when trying to save the edited data in database.
    I use ON_CELL_ACTION event but its not working as of now. I go through few blocks but ultimately i got confused. Please guide me in correct way.

    Hi Sanjib,
    ON_DATA_CHECK  event is triggered every time when you change the data in table
    For this event, you have to implement an Event Handler method in which the logic is written.
    There is already a thread where this question has been answered:
    ALV Edit how to save changes to DB??
    I would suggest that you search more on scn before starting a discussion
    Regards,
    Ashvin

  • How can i change video into pictures with labview

    hallo,i have video about 5 minutes and i want to change it into photos with labview,can you please help me?
    Solved!
    Go to Solution.

    Vision Assistant is part of the Vision Development Module and represents a Configuration Environment including Code Generation for Machine Vision Applications.
    Separeting Images in AVI files will lead into using some Low-Level VIs. However there are numerous examples for AVIs shipped with LabVIEW.
    Christian

  • How to save copyright information into Gif files?

    URGENT - can someone please help. i have photoshop cc and I need to know how to copyright my gif files

    c. is correct in that it's a little ambiguous what you're trying to achieve. Here are three ways:
    Under US law your image is already copyrighted at the moment you create it, but you greatly improve your legal standing in court if you register the image with the US Copyright Office.
    To add invisible copyright metadata inside an image, choose File > File Info in Photoshop, click the Description tab, and fill out Copyright Status and Copyright Notice. Then do what c. said in Save for Web to make sure it's included on export. However, while this works with most formats including JPG and PNG, I do not think it will work with a GIF. As far as I can tell, GIF doesn't support metadata. If you want better support for modern standards for non-photographic web graphics, use PNG instead of GIF.
    To add a visible copyright watermark over the image, download the Adobe Watermark panel and install it.

Maybe you are looking for

  • Down payment to vendors an open item?

    DDown payments to vendors: Is it considered as an open item during payment running?? Example: 1:Down payment $50 2 – Goods receipt/invoice $80 3 – Now when running the payment the open item to be paid should be $30, that’s the net of the two open ite

  • Javascript to validate a percentage

    Hello, Any one knows a way to vaidate that the number entered in text box is either a 1 or a percent. I have been trying to validate this using javascript and its not working. Please help

  • How can I watch this video?

    Guys, I have a MacBook (from around Christmas 2007). I downloaded Flip4Mac and have little trouble watching streaming video. I went to a CBS-affiliate website and can't see the video that I want to see. I can watch the featured video fine. But the vi

  • Edge Animate doesn't respond to trigger, auto-plays to the end while previewing in the browser.

    I've this strange problem with EA. I was working on a project which was doing pretty well. You may see it over here. This afternoon I wanted to make some progress, opened the file, clicked preview in browser. What I saw was the auto-play of animation

  • Safari 7.0.5 on OS X 10.9.4 doesn't to quit

    I can't the latest update of Flash Player (10.14.0.0145). It says I should quit Safari which is not running... Someone else has this problem ?