How to animate from a png tile based image file

Hi all,
I would like to know is there any way to animate from a tile based .png image file? I have multiple images in 1 png file having slight changes in each image, which if cropped and put into layers one over the other, will give the feel of animation or a character moving or walking etc...
I want to know can we do that kind of animation in flash as we do it in C++ or Java and how can we do it.
Any help will be highly appreciated.
Thank you
Shanz - Iceheros

I want to use action script to externally call/access  the png file with url request and url loader and animate the images from the tile based png image file.
Anybody know how to do this in flash with as3.
Here is the image for example:
i want to animate this images and call it externally and access each tile 1 after another.
Any Help???
Thanks,
Shanz - Iceheros

Similar Messages

  • How can I get the resolution of an image file in JSP?

    how can I get the resolution of an image file like jpg,gif,png in JSP ?

    Hii,
    If by the resolution, u mean size..this is how u can come to know....
    String add = "path/to/some.jpeg";
    javax.swing.ImageIcon chain = new javax.swing.ImageIcon(add);
    int height = chain.getIconHeight();
    int width = chain.getIconWidth();
    Hope that helps.
    regards
                   

  • How to migrate from forms to web based application

    Hi,
    I did a form for Oracle applications, but client need a web based form for this application how can i migrate this to web based form. If it is possible can u give me suggestion how migrate.
    Kishore B

    Not sure if that's possible, as developing forms for Oracle Applications requires the use of TEMPLATE.fmb to start with, and the use of certain standards to adhere to the look and feel of the applications. Review the Oracle Applications Developer's guide for more details.
    What You may do now is to upload the form to the Application Server and compile it to the adequate directory $PRODUCT_TOP/forms/[LANG], register the form, associate to a function and use it in a menu to see it trough Oracle Applications standard interface, but it may show a very different L&F and not all standard functionality may be available. With the Dev Guide's on hand, apply required changes and test Your form in the application.

  • How to animate through 5 png's

    Not clear how I would do this.  But I have png's that I would like to iterate thru.  I would assume this kind of functionality would exist in flash somewhere.  My, incomplete, as3 code, is a brute force hack.
    [Embed("...")]
    image1
    [Embed("...")]
    image2
    [Embed("...")]
    image3
    [Embed("...")]
    image4
    images=[image1, image2, image3, image4]
    currentFrame = 0;
    onTimer(..) {
      how to I set the image of a flex xml component? = images[currentFrame++];
    Any advice (especially how I created the array of images, would think there is a more direct way to place into array w/o having to creating imageX vars) appreciated.
    Monty

    1. On timer, just modify the source attribute of your <mx:Image /> so as to point to a different image each time. The source attribute values (location of images) can be put in an array.
    2. Use a loader object to load the images. You could name your image files as image1.jpg, image2.jpg, ... so that you can put the loader.load("image"+i+".jpg") inside a loop. Handle the loader result and use the loader.content property and box it into a Bitmap object and successively push these objects into an array.
    Does this help ?
    Thanks
    balakrishnan v

  • How to read from and write into the same file from multiple threads?

    I need to read from and write into a same file multiple threads.
    How can we do that without any data contamination.
    Can u please provide coding for this type of task.
    Thanks in advance.

    Assuming you are using RandomAccessFile, you can use the locking functionality in the Java NIO library to lock sections of a file that you are reading/writing from each thread (or process).
    If you can't use NIO, and all your threads are in the same application, you can create your own in-process locking mechanism that each thread uses prior to accessing the file. That would take some development, and the OS already has the capability, so using NIO is the best way to go if you can use JDK 1.4 or higher.
    - K
    I need to read from and write into a same file
    multiple threads.
    How can we do that without any data contamination.
    Can u please provide coding for this type of task.
    Thanks in advance.

  • How to save or save a drawing in a PNG or any Image file format ?

    Hi,
    I am working on a signature capturing application using J2ME MIDP 2.0 for Palm Treo 750 with Windows Mobile 6.0
    I am taking signatures as a drawing on a CustomItem.
    Now, i want to send it to a php script running on Apache server to save this signature as a PNG, jpeg or any image file at server end.
    or how can i save this drawing on my local file system as a png or any other type of image file.
    Plz help if anybody knows the right way....
    Thanks.

    Hi Hithayath,
    Thnx for the reply.
    Actually, i hv no problem in storing a data locally or sending it on a web server. The problem in related with the formats.
    I mean, how can we create a png or jpg file using the raw bytes of an image drawn on a canvas or CustomItem.. ?
    We can get the integer array of RGB points using getRGB() method of image object. Now, if i will write this data after converting to binary in a file then that file
    will show a message like "Preview not available". It means the format is not recognized.
    So, my question is how can we convert this raw data in a png or jpg format so it can be displayed on a web page or stored in a png or jpg file..?
    I think now u can better understand the problem.
    Waiting for the reply....
    Thanks. :)

  • How to convert from SQL Server table to Flat file (txt file)

    I need To ask question how convert from SQL Server table to Flat file txt file

    Hi
    1. Import/Export wizened
    2. Bcp utility
    3. SSIS 
    1.Import/Export Wizard
    First and very manual technique is the import wizard.  This is great for ad-hoc and just to slam it in tasks.
    In SSMS right click the database you want to import into.  Scroll to Tasks and select Import Data…
    For the data source we want out zips.txt file.  Browse for it and select it.  You should notice the wizard tries to fill in the blanks for you.  One key thing here with this file I picked is there are “ “ qualifiers.  So we need to make
    sure we add “ into the text qualifier field.   The wizard will not do this for you.
    Go through the remaining pages to view everything.  No further changes should be needed though
    Hit next after checking the pages out and select your destination.  This in our case will be DBA.dbo.zips.
    Following the destination step, go into the edit mappings section to ensure we look good on the types and counts.
    Hit next and then finish.  Once completed you will see the count of rows transferred and the success or failure rate
    Import wizard completed and you have the data!
    bcp utility
    Method two is bcp with a format file http://msdn.microsoft.com/en-us/library/ms162802.aspx
    This is probably going to win for speed on most occasions but is limited to the formatting of the file being imported.  For this file it actually works well with a small format file to show the contents and mappings to SQL Server.
    To create a format file all we really need is the type and the count of columns for the most basic files.  In our case the qualifier makes it a bit difficult but there is a trick to ignoring them.  The trick is to basically throw a field into the
    format file that will reference it but basically ignore it in the import process.
    Given that our format file in this case would appear like this
    9.0
    9
    1 SQLCHAR 0 0 """ 0 dummy1 ""
    2 SQLCHAR 0 50 "","" 1 Field1 ""
    3 SQLCHAR 0 50 "","" 2 Field2 ""
    4 SQLCHAR 0 50 "","" 3 Field3 ""
    5 SQLCHAR 0 50 ""," 4 Field4 ""
    6 SQLCHAR 0 50 "," 5 Field5 ""
    7 SQLCHAR 0 50 "," 6 Field6 ""
    8 SQLCHAR 0 50 "," 7 Field7 ""
    9 SQLCHAR 0 50 "n" 8 Field8 ""
    The bcp call would be as follows
    C:Program FilesMicrosoft SQL Server90ToolsBinn>bcp DBA..zips in “C:zips.txt” -f “c:zip_format_file.txt” -S LKFW0133 -T
    Given a successful run you should see this in command prompt after executing the statement
    Starting copy...
    1000 rows sent to SQL Server. Total sent: 1000
    1000 rows sent to SQL Server. Total sent: 2000
    1000 rows sent to SQL Server. Total sent: 3000
    1000 rows sent to SQL Server. Total sent: 4000
    1000 rows sent to SQL Server. Total sent: 5000
    1000 rows sent to SQL Server. Total sent: 6000
    1000 rows sent to SQL Server. Total sent: 7000
    1000 rows sent to SQL Server. Total sent: 8000
    1000 rows sent to SQL Server. Total sent: 9000
    1000 rows sent to SQL Server. Total sent: 10000
    1000 rows sent to SQL Server. Total sent: 11000
    1000 rows sent to SQL Server. Total sent: 12000
    1000 rows sent to SQL Server. Total sent: 13000
    1000 rows sent to SQL Server. Total sent: 14000
    1000 rows sent to SQL Server. Total sent: 15000
    1000 rows sent to SQL Server. Total sent: 16000
    1000 rows sent to SQL Server. Total sent: 17000
    1000 rows sent to SQL Server. Total sent: 18000
    1000 rows sent to SQL Server. Total sent: 19000
    1000 rows sent to SQL Server. Total sent: 20000
    1000 rows sent to SQL Server. Total sent: 21000
    1000 rows sent to SQL Server. Total sent: 22000
    1000 rows sent to SQL Server. Total sent: 23000
    1000 rows sent to SQL Server. Total sent: 24000
    1000 rows sent to SQL Server. Total sent: 25000
    1000 rows sent to SQL Server. Total sent: 26000
    1000 rows sent to SQL Server. Total sent: 27000
    1000 rows sent to SQL Server. Total sent: 28000
    1000 rows sent to SQL Server. Total sent: 29000
    bcp import completed!
    BULK INSERT
    Next, we have BULK INSERT given the same format file from bcp
    CREATE TABLE zips (
    Col1 nvarchar(50),
    Col2 nvarchar(50),
    Col3 nvarchar(50),
    Col4 nvarchar(50),
    Col5 nvarchar(50),
    Col6 nvarchar(50),
    Col7 nvarchar(50),
    Col8 nvarchar(50)
    GO
    INSERT INTO zips
    SELECT *
    FROM OPENROWSET(BULK 'C:Documents and SettingstkruegerMy Documentsblogcenzuszipcodeszips.txt',
    FORMATFILE='C:Documents and SettingstkruegerMy Documentsblogzip_format_file.txt'
    ) as t1 ;
    GO
    That was simple enough given the work on the format file that we already did.  Bulk insert isn’t as fast as bcp but gives you some freedom from within TSQL and SSMS to add functionality to the import.
    SSIS
    Next is my favorite playground in SSIS
    We can do many methods in SSIS to get data from point A, to point B.  I’ll show you data flow task and the SSIS version of BULK INSERT
    First create a new integrated services project.
    Create a new flat file connection by right clicking the connection managers area.  This will be used in both methods
    Bulk insert
    You can use format file here as well which is beneficial to moving methods around.  This essentially is calling the same processes with format file usage.  Drag over a bulk insert task and double click it to go into the editor.
    Fill in the information starting with connection.  This will populate much as the wizard did.
    Example of format file usage
    Or specify your own details
    Execute this and again, we have some data
    Data Flow method
    Bring over a data flow task and double click it to go into the data flow tab.
    Bring over a flat file source and SQL Server destination.  Edit the flat file source to use the connection manager “The file” we already created.  Connect the two once they are there
    Double click the SQL Server Destination task to open the editor.  Enter in the connection manager information and select the table to import into.
    Go into the mappings and connect the dots per say
    Typical issue of type conversions is Unicode to non-unicode.
    We fix this with a Data conversion or explicit conversion in the editor.  Data conversion tasks are usually the route I take.  Drag over a data conversation task and place it between the connection from the flat file source to the SQL Server destination.
    New look in the mappings
    And after execution…
    SqlBulkCopy Method
    Sense we’re in the SSIS package we can use that awesome “script task” to show SlqBulkCopy.  Not only fast but also handy for those really “unique” file formats we receive so often
    Bring over a script task into the control flow
    Double click the task and go to the script page.  Click the Design script to open up the code behind
    Ref.
    Ahsan Kabir Please remember to click Mark as Answer and Vote as Helpful on posts that help you. This can be beneficial to other community members reading the thread. http://www.aktechforum.blogspot.com/

  • How to decoding and encoding PNG and GIF images?

    I could decode and encode JPEG images using following create functions which are in com.sun.image.codec.jpeg package.
    JPEGImageDecoder decoder = JPEGCodec          .createJPEGDecoder(inputStream);
    JPEGImageEncoder encoder = JPEGCodec                    .createJPEGEncoder(outputStream);
    But I dont know required package and functions to decode and encode PNG and GIF images. Please help me.

    Is the API that hard to follow?
    ImageIO.read( file/stream/url)
    ImageIO.write( image, format (e.g. PNG, GIF(1), JPEG), file/stream what have you)
    1) Not sure if Java supports GIF saving, it might if you install JAI, or Java 6.

  • How do I get a list of all image files for a user?

    The Finder folder windows have changed the sidebar. I no longer see any way to configure the Finder window to display a quick search for all images. How do I easily run a search for all image files owned by a user?
    I am just starting to set up a brand new system that came with Yosemite and it's user interface has many changes from my older Snow Leopard system. I have many image files from many different sources that I wish to consolidate on the new system. I do not wish to rely on iPhoto at this point. I prefer to use the file system or Finder  or Spotlight.
    Model Name:
    Mac mini
      Model Identifier:
    Macmini7,1
      Processor Name:
    Intel Core i5
      Processor Speed:
    1.4 GHz
      Number of Processors:
    1
      Total Number of Cores:
    2
      L2 Cache (per Core):
    256 KB
      L3 Cache:
    3 MB
      Memory:
    8 GB
      Boot ROM Version:
    MM71.0220.B00
      SMC Version (system):
    2.24f32
    Model Name: M

    0. find the user id.
        a. log in as that specific user.
        b. run terminal
        c. type "echo $UID"
        d. write down the user id that will be displayed
    1. Go to the finder
    2. go to the user home folder
    3. click the box with the magnifying glass (upper right corner of the window)
    4. type .jpg
    5. a menu will pop under the magnifying glass box, select "jpg image"
    6. click the "plus" sign that's displayed to the right of the word "save"
    7. two pull down menus will appear, select "other" from the first one
    8. a new window will pull down, scroll to "owner" and select it
    9. back in the original window type the user id (a number) to the right of "owner" "equals"
    Hope this helps

  • IMPORTING: How do I set IP 09 to Copy image files into iPhoto09 on import?

    I have a number of image files stored in folders on my desktop.
    How do I set iPhoto 09 to copy the files from these folders on import and not just reference the image files in the spot they currently reside? After importing these files I would like to trash the folders on my desktop....

    iPhoto Menu -> Preferences -> Advanced tab
    Make sure the box at 'Copy Items to the iPhoto Library' is checked.
    Regards
    TD

  • How do i save my drawing as an image file?

    hiee
    I have made a drawing panel on an Internal frame.
    I can draw basic 2D shapes on it.
    Now , i wanted to save this as an image file (ie.gif or jpeg).
    How do i do that??

    * SaveAsGif_Demo.java
    * Created on 13 mars 2005, 11:26
    import java.awt.*;
    import java.awt.image.*;
    import java.io.*;
    import java.util.Dictionary;
    import java.util.Enumeration;
    import java.util.Hashtable;
    import java.util.NoSuchElementException;
    import javax.swing.*;
    * @author  Andr� Uhres
    public class SaveAsGif_Demo extends javax.swing.JFrame {
        /** Creates new form SaveAsGif_Demo */
        public SaveAsGif_Demo() {
            initComponents();
            myPanel = new MyPanel();
            getContentPane().add(myPanel, BorderLayout.CENTER);
        /** This method is called from within the constructor to
         * initialize the form.
         * WARNING: Do NOT modify this code. The content of this method is
         * always regenerated by the Form Editor.
        private void initComponents() {                         
            jToolBar1 = new javax.swing.JToolBar();
            jButton1 = new javax.swing.JButton();
            jLabel1 = new javax.swing.JLabel();
            setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
            setTitle("Save as .gif Demo");
            jToolBar1.setFloatable(false);
            jButton1.setText("Save");
            jButton1.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jButton1ActionPerformed(evt);
            jToolBar1.add(jButton1);
            jToolBar1.add(jLabel1);
            getContentPane().add(jToolBar1, java.awt.BorderLayout.NORTH);
            java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
            setBounds((screenSize.width-400)/2, (screenSize.height-300)/2, 400, 300);
        private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                        
            File file = new File("c:\\test.gif");
            if(SaveAsPic.saveGif(file, myPanel.captureJPanel(myPanel))){
                jLabel1.setText("The diagram was saved as " + file.getAbsolutePath());
                return;
            jLabel1.setText("Error:failed to save as gif");
         * @param args the command line arguments
        public static void main(String args[]) {
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    new SaveAsGif_Demo().setVisible(true);
        // Variables declaration - do not modify                    
        private javax.swing.JButton jButton1;
        private javax.swing.JLabel jLabel1;
        private javax.swing.JToolBar jToolBar1;
        // End of variables declaration                  
        private MyPanel myPanel;
    class MyPanel extends JPanel {
        MyPanel(){
            super();
        public void paint(Graphics g){
            g.drawRect(10, 10, 100,100);
        Image i ;
        public Image captureJPanel( JPanel jp ) {
            i = this.createImage( jp.getSize().height, jp.getSize().width );
            Graphics g = i.getGraphics();
            jp.paint( g );
            return i;
    class SaveAsPic {
        public static boolean saveGif(File file, Image image) {
            boolean flag = true;
            try {
                FileOutputStream fileoutputstream = new FileOutputStream(file);
                GifEncoder gifencoder = new GifEncoder(image, fileoutputstream);
                gifencoder.encode();
                fileoutputstream.close();
            catch(IOException ioexception) {
                System.out.println("Error encoding Gif-file: " + ioexception.getMessage());
                flag = false;
            return flag;
        SaveAsPic() {
    class IntHashtableEnumerator
        implements Enumeration {
        IntHashtableEnumerator(IntHashtableEntry ainthashtableentry[], boolean flag) {
            table = ainthashtableentry;
            keys = flag;
            index = ainthashtableentry.length;
        public boolean hasMoreElements() {
            if(entry != null)
                return true;
            while(index-- > 0)
                if((entry = table[index]) != null)
                    return true;
            return false;
        public Object nextElement() {
            if(entry == null)
                while(index-- > 0 && (entry = table[index]) == null) ;
            if(entry != null) {
                IntHashtableEntry inthashtableentry = entry;
                entry = inthashtableentry.next;
                if(keys)
                    return new Integer(inthashtableentry.key);
                else
                    return inthashtableentry.value;
            } else {
                throw new NoSuchElementException("IntHashtableEnumerator");
        boolean keys;
        int index;
        IntHashtableEntry table[];
        IntHashtableEntry entry;
    class IntHashtableEntry {
        protected Object clone() {
            IntHashtableEntry inthashtableentry = new IntHashtableEntry();
            inthashtableentry.hash = hash;
            inthashtableentry.key = key;
            inthashtableentry.value = value;
            inthashtableentry.next = next == null ? null : (IntHashtableEntry)next.clone();
            return inthashtableentry;
        IntHashtableEntry() {
        int hash;
        int key;
        Object value;
        IntHashtableEntry next;
    class IntHashtable extends Dictionary
        implements Cloneable {
        public IntHashtable(int i, float f) {
            if(i <= 0 || (double)f <= 0.0D) {
                throw new IllegalArgumentException();
            } else {
                loadFactor = f;
                table = new IntHashtableEntry;
    threshold = (int)((float)i * f);
    return;
    public IntHashtable(int i) {
    this(i, 0.75F);
    public IntHashtable() {
    this(101, 0.75F);
    public int size() {
    return count;
    public boolean isEmpty() {
    return count == 0;
    public synchronized Enumeration keys() {
    return new IntHashtableEnumerator(table, true);
    public synchronized Enumeration elements() {
    return new IntHashtableEnumerator(table, false);
    public synchronized boolean contains(Object obj) {
    if(obj == null)
    throw new NullPointerException();
    IntHashtableEntry ainthashtableentry[] = table;
    for(int i = ainthashtableentry.length; i-- > 0;) {
    for(IntHashtableEntry inthashtableentry = ainthashtableentry[i]; inthashtableentry != null; inthashtableentry = inthashtableentry.next)
    if(inthashtableentry.value.equals(obj))
    return true;
    return false;
    public synchronized boolean containsKey(int i) {
    IntHashtableEntry ainthashtableentry[] = table;
    int j = i;
    int k = (j & 0x7fffffff) % ainthashtableentry.length;
    for(IntHashtableEntry inthashtableentry = ainthashtableentry[k]; inthashtableentry != null; inthashtableentry = inthashtableentry.next)
    if(inthashtableentry.hash == j && inthashtableentry.key == i)
    return true;
    return false;
    public synchronized Object get(int i) {
    IntHashtableEntry ainthashtableentry[] = table;
    int j = i;
    int k = (j & 0x7fffffff) % ainthashtableentry.length;
    for(IntHashtableEntry inthashtableentry = ainthashtableentry[k]; inthashtableentry != null; inthashtableentry = inthashtableentry.next)
    if(inthashtableentry.hash == j && inthashtableentry.key == i)
    return inthashtableentry.value;
    return null;
    public Object get(Object obj) {
    if(!(obj instanceof Integer)) {
    throw new InternalError("key is not an Integer");
    } else {
    Integer integer = (Integer)obj;
    int i = integer.intValue();
    return get(i);
    protected void rehash() {
    int i = table.length;
    IntHashtableEntry ainthashtableentry[] = table;
    int j = i * 2 + 1;
    IntHashtableEntry ainthashtableentry1[] = new IntHashtableEntry[j];
    threshold = (int)((float)j * loadFactor);
    table = ainthashtableentry1;
    for(int k = i; k-- > 0;) {
    for(IntHashtableEntry inthashtableentry = ainthashtableentry[k]; inthashtableentry != null;) {
    IntHashtableEntry inthashtableentry1 = inthashtableentry;
    inthashtableentry = inthashtableentry.next;
    int l = (inthashtableentry1.hash & 0x7fffffff) % j;
    inthashtableentry1.next = ainthashtableentry1[l];
    ainthashtableentry1[l] = inthashtableentry1;
    public synchronized Object put(int i, Object obj) {
    if(obj == null)
    throw new NullPointerException();
    IntHashtableEntry ainthashtableentry[] = table;
    int j = i;
    int k = (j & 0x7fffffff) % ainthashtableentry.length;
    for(IntHashtableEntry inthashtableentry = ainthashtableentry[k]; inthashtableentry != null; inthashtableentry = inthashtableentry.next)
    if(inthashtableentry.hash == j && inthashtableentry.key == i) {
    Object obj1 = inthashtableentry.value;
    inthashtableentry.value = obj;
    return obj1;
    if(count >= threshold) {
    rehash();
    return put(i, obj);
    } else {
    IntHashtableEntry inthashtableentry1 = new IntHashtableEntry();
    inthashtableentry1.hash = j;
    inthashtableentry1.key = i;
    inthashtableentry1.value = obj;
    inthashtableentry1.next = ainthashtableentry[k];
    ainthashtableentry[k] = inthashtableentry1;
    count++;
    return null;
    public Object put(Object obj, Object obj1) {
    if(!(obj instanceof Integer)) {
    throw new InternalError("key is not an Integer");
    } else {
    Integer integer = (Integer)obj;
    int i = integer.intValue();
    return put(i, obj1);
    public synchronized Object remove(int i) {
    IntHashtableEntry ainthashtableentry[] = table;
    int j = i;
    int k = (j & 0x7fffffff) % ainthashtableentry.length;
    IntHashtableEntry inthashtableentry = ainthashtableentry[k];
    IntHashtableEntry inthashtableentry1 = null;
    for(; inthashtableentry != null; inthashtableentry = inthashtableentry.next) {
    if(inthashtableentry.hash == j && inthashtableentry.key == i) {
    if(inthashtableentry1 != null)
    inthashtableentry1.next = inthashtableentry.next;
    else
    ainthashtableentry[k] = inthashtableentry.next;
    count--;
    return inthashtableentry.value;
    inthashtableentry1 = inthashtableentry;
    return null;
    public Object remove(Object obj) {
    if(!(obj instanceof Integer)) {
    throw new InternalError("key is not an Integer");
    } else {
    Integer integer = (Integer)obj;
    int i = integer.intValue();
    return remove(i);
    public synchronized void clear() {
    IntHashtableEntry ainthashtableentry[] = table;
    for(int i = ainthashtableentry.length; --i >= 0;)
    ainthashtableentry[i] = null;
    count = 0;
    public synchronized Object clone() {
    try {
    IntHashtable inthashtable = (IntHashtable)super.clone();
    inthashtable.table = new IntHashtableEntry[table.length];
    for(int i = table.length; i-- > 0;)
    inthashtable.table[i] = table[i] == null ? null : (IntHashtableEntry)table[i].clone();
    return inthashtable;
    catch(CloneNotSupportedException _ex) {
    throw new InternalError();
    public synchronized String toString() {
    int i = size() - 1;
    StringBuffer stringbuffer = new StringBuffer();
    Enumeration enumeration = keys();
    Enumeration enumeration1 = elements();
    stringbuffer.append("{");
    for(int j = 0; j <= i; j++) {
    String s = enumeration.nextElement().toString();
    String s1 = enumeration1.nextElement().toString();
    stringbuffer.append(s + "=" + s1);
    if(j < i)
    stringbuffer.append(", ");
    stringbuffer.append("}");
    return stringbuffer.toString();
    private IntHashtableEntry table[];
    private int count;
    private int threshold;
    private float loadFactor;
    abstract class ImageEncoder
    implements ImageConsumer {
    public ImageEncoder(Image image, OutputStream outputstream) throws IOException {
    this(image.getSource(), outputstream);
    public ImageEncoder(ImageProducer imageproducer, OutputStream outputstream) throws IOException {
    width = -1;
    height = -1;
    started = false;
    accumulate = false;
    producer = imageproducer;
    out = outputstream;
    abstract void encodeStart(int i, int j) throws IOException;
    abstract void encodePixels(int i, int j, int k, int l, int ai[], int i1, int j1) throws IOException;
    abstract void encodeDone() throws IOException;
    public synchronized void encode() throws IOException {
    encoding = true;
    iox = null;
    producer.startProduction(this);
    while(encoding)
    try {
    wait();
    catch(InterruptedException _ex) { }
    if(iox != null)
    throw iox;
    else
    return;
    private void encodePixelsWrapper(int i, int j, int k, int l, int ai[], int i1, int j1) throws IOException {
    if(!started) {
    started = true;
    encodeStart(width, height);
    if((hintflags & 2) == 0) {
    accumulate = true;
    accumulator = new int[width * height];
    if(accumulate) {
    for(int k1 = 0; k1 < l; k1++)
    System.arraycopy(ai, k1 * j1 + i1, accumulator, (j + k1) * width + i, k);
    return;
    } else {
    encodePixels(i, j, k, l, ai, i1, j1);
    return;
    private void encodeFinish() throws IOException {
    if(accumulate) {
    encodePixels(0, 0, width, height, accumulator, 0, width);
    accumulator = null;
    accumulate = false;
    private synchronized void stop() {
    encoding = false;
    notifyAll();
    public void setDimensions(int i, int j) {
    width = i;
    height = j;
    public void setProperties(Hashtable hashtable) {
    props = hashtable;
    public void setColorModel(ColorModel colormodel) {
    public void setHints(int i) {
    hintflags = i;
    public void setPixels(int i, int j, int k, int l, ColorModel colormodel, byte abyte0[], int i1,
    int j1) {
    int ai[] = new int[k];
    for(int k1 = 0; k1 < l; k1++) {
    int l1 = i1 + k1 * j1;
    for(int i2 = 0; i2 < k; i2++)
    ai[i2] = colormodel.getRGB(abyte0[l1 + i2] & 0xff);
    try {
    encodePixelsWrapper(i, j + k1, k, 1, ai, 0, k);
    catch(IOException ioexception) {
    iox = ioexception;
    stop();
    return;
    public void setPixels(int i, int j, int k, int l, ColorModel colormodel, int ai[], int i1,
    int j1) {
    if(colormodel == rgbModel) {
    try {
    encodePixelsWrapper(i, j, k, l, ai, i1, j1);
    return;
    catch(IOException ioexception) {
    iox = ioexception;
    stop();
    return;
    int ai1[] = new int[k];
    for(int k1 = 0; k1 < l; k1++) {
    int l1 = i1 + k1 * j1;
    for(int i2 = 0; i2 < k; i2++)
    ai1[i2] = colormodel.getRGB(ai[l1 + i2]);
    try {
    encodePixelsWrapper(i, j + k1, k, 1, ai1, 0, k);
    catch(IOException ioexception1) {
    iox = ioexception1;
    stop();
    return;
    public void imageComplete(int i) {
    producer.removeConsumer(this);
    if(i == 4)
    iox = new IOException("image aborted");
    else
    try {
    encodeFinish();
    encodeDone();
    catch(IOException ioexception) {
    iox = ioexception;
    stop();
    protected OutputStream out;
    private ImageProducer producer;
    private int width;
    private int height;
    private int hintflags;
    private boolean started;
    private boolean encoding;
    private IOException iox;
    private static final ColorModel rgbModel = ColorModel.getRGBdefault();
    private Hashtable props;
    private boolean accumulate;
    private int accumulator[];
    class GifEncoderHashitem {
    public GifEncoderHashitem(int i, int j, int k, boolean flag) {
    rgb = i;
    count = j;
    index = k;
    isTransparent = flag;
    public int rgb;
    public int count;
    public int index;
    public boolean isTransparent;
    class GifEncoder extends ImageEncoder {
    public GifEncoder(Image image, OutputStream outputstream) throws IOException {
    super(image, outputstream);
    interlace = false;
    maxbits = 12;
    maxmaxcode = 4096;
    htab = new int[5003];
    codetab = new int[5003];
    hsize = 5003;
    clear_flg = false;
    accum = new byte[256];
    public GifEncoder(Image image, OutputStream outputstream, boolean flag) throws IOException {
    super(image, outputstream);
    interlace = false;
    maxbits = 12;
    maxmaxcode = 4096;
    htab = new int[5003];
    codetab = new int[5003];
    hsize = 5003;
    clear_flg = false;
    accum = new byte[256];
    interlace = flag;
    public GifEncoder(ImageProducer imageproducer, OutputStream outputstream) throws IOException {
    super(imageproducer, outputstream);
    interlace = false;
    maxbits = 12;
    maxmaxcode = 4096;
    htab = new int[5003];
    codetab = new int[5003];
    hsize = 5003;
    clear_flg = false;
    accum = new byte[256];
    public GifEncoder(ImageProducer imageproducer, OutputStream outputstream, boolean flag) throws IOException {
    super(imageproducer, outputstream);
    interlace = false;
    maxbits = 12;
    maxmaxcode = 4096;
    htab = new int[5003];
    codetab = new int[5003];
    hsize = 5003;
    clear_flg = false;
    accum = new byte[256];
    interlace = flag;
    void encodeStart(int i, int j) throws IOException {
    width = i;
    height = j;
    rgbPixels = new int[j][i];
    void encodePixels(int i, int j, int k, int l, int ai[], int i1, int j1) throws IOException {
    for(int k1 = 0; k1 < l; k1++)
    System.arraycopy(ai, k1 * j1 + i1, rgbPixels[j + k1], i, k);
    void encodeDone() throws IOException {
    int i = -1;
    int j = -1;
    colorHash = new IntHashtable();
    int k = 0;
    for(int l = 0; l < height; l++) {
    for(int i1 = 0; i1 < width; i1++) {
    int j1 = rgbPixels[l][i1];
    boolean flag = j1 >>> 24 < 128;
    if(flag)
    if(i < 0) {
    i = k;
    j = j1;
    } else
    if(j1 != j)
    rgbPixels[l][i1] = j1 = j;
    GifEncoderHashitem gifencoderhashitem = (GifEncoderHashitem)colorHash.get(j1);
    if(gifencoderhashitem == null) {
    if(k >= 256)
    throw new IOException("too many colors for a GIF");
    gifencoderhashitem = new GifEncoderHashitem(j1, 1, k, flag);
    k++;
    colorHash.put(j1, gifencoderhashitem);
    } else {
    gifencoderhashitem.count++;
    byte byte0;
    if(k <= 2)
    byte0 = 1;
    else
    if(k <= 4)
    byte0 = 2;
    else
    if(k <= 16)
    byte0 = 4;
    else
    byte0 = 8;
    int k1 = 1 << byte0;
    byte abyte0[] = new byte[k1];
    byte abyte1[] = new byte[k1];
    byte abyte2[] = new byte[k1];
    for(Enumeration enumeration = colorHash.elements(); enumeration.hasMoreElements();) {
    GifEncoderHashitem gifencoderhashitem1 = (GifEncoderHashitem)enumeration.nextElement();
    abyte0[gifencoderhashitem1.index] = (byte)(gifencoderhashitem1.rgb >> 16 & 0xff);
    abyte1[gifencoderhashitem1.index] = (byte)(gifencoderhashitem1.rgb >> 8 & 0xff);
    abyte2[gifencoderhashitem1.index] = (byte)(gifencoderhashitem1.rgb & 0xff);
    GIFEncode(super.out, width, height, interlace, (byte)0, i, byte0, abyte0, abyte1, abyte2);
    byte GetPixel(int i, int j) throws IOException {
    GifEncoderHashitem gifencoderhashitem = (GifEncoderHashitem)colorHash.get(rgbPixels[j][i]);
    if(gifencoderhashitem == null)
    throw new IOException("color not found");
    else
    return (byte)gifencoderhashitem.index;
    static void writeString(OutputStream outputstream, String s) throws IOException {
    byte abyte0[] = s.getBytes();
    outputstream.write(abyte0);
    void GIFEncode(OutputStream outputstream, int i, int j, boolean flag, byte byte0, int k, int l,
    byte abyte0[], byte abyte1[], byte abyte2[]) throws IOException {
    Width = i;
    Height = j;
    Interlace = flag;
    int k1 = 1 << l;
    int j1;
    int i1 = j1 = 0;
    CountDown = i * j;
    Pass = 0;
    int l1;
    if(l <= 1)
    l1 = 2;
    else
    l1 = l;
    curx = 0;
    cury = 0;
    writeString(outputstream, "GIF89a");
    Putword(i, outputstream);
    Putword(j, outputstream);
    char c = '\uFF80';
    c |= 'p';
    c |= (byte)(l - 1);
    Putbyte((byte)c, outputstream);
    Putbyte(byte0, outputstream);
    Putbyte((byte)0, outputstream);
    for(int i2 = 0; i2 < k1; i2++) {
    Putbyte(abyte0[i2], outputstream);
    Putbyte(abyte1[i2], outputstream);
    Putbyte(abyte2[i2], outputstream);
    if(k != -1) {
    Putbyte((byte)33, outputstream);
    Putbyte((byte)-7, outputstream);
    Putbyte((byte)4, outputstream);
    Putbyte((byte)1, outputstream);
    Putbyte((byte)0, outputstream);
    Putbyte((byte)0, outputstream);
    Putbyte((byte)k, outputstream);
    Putbyte((byte)0, outputstream);
    Putbyte((byte)44, outputstream);
    Putword(i1, outputstream);
    Putword(j1, outputstream);
    Putword(i, outputstream);
    Putword(j, outputstream);
    if(flag)
    Putbyte((byte)64, outputstream);
    else
    Putbyte((byte)0, outputstream);
    Putbyte((byte)l1, outputstream);
    compress(l1 + 1, outputstream);
    Putbyte((byte)0, outputstream);
    Putbyte((byte)59, outputstream);
    void BumpPixel() {
    curx++;
    if(curx == Width) {
    curx = 0;
    if(!Interlace) {
    cury++;
    return;
    switch(Pass) {
    default:
    break;
    case 0: // '\0'
    cury += 8;
    if(cury >= Height) {
    Pass++;
    cury = 4;
    return;
    break;
    case 1: // '\001'
    cury += 8;
    if(cury >= Height) {
    Pass++;
    cury = 2;
    return;
    break;
    case 2: // '\002'
    cury += 4;
    if(cury >= Height) {
    Pass++;
    cury = 1;
    return;
    break;
    case 3: // '\003'
    cury += 2;
    return;
    int GIFNextPixel() throws IOException {
    if(CountDown == 0) {
    return -1;
    } else {
    CountDown--;
    byte byte0 = GetPixel(curx, cury);
    BumpPixel();
    return byte0 & 0xff;
    void Putword(int i, OutputStream outputstream) throws IOException {
    Putbyte((byte)(i & 0xff), outputstream);
    Putbyte((byte)(i >> 8 & 0xff), outputstream);
    void Putbyte(byte byte0, OutputStream outputstream) throws IOException {
    outputstream.write(byte0);
    final int MAXCODE(int i) {
    return (1 << i) - 1;
    void compress(int i, OutputStream outputstream) throws IOException {
    g_init_bits = i;
    clear_flg = false;
    n_bits = g_init_bits;
    maxcode = MAXCODE(n_bits);
    ClearCode = 1 << i - 1;
    EOFCode = ClearCode + 1;
    free_ent = ClearCode + 2;
    char_init();
    int j1 = GIFNextPixel();
    int i2 = 0;
    for(int j = hsize; j < 0x10000; j *= 2)
    i2++;
    i2 = 8 - i2;
    int l1 = hsize;
    cl_hash(l1);
    output(ClearCode, outputstream);
    int i1;
    label0:
    while((i1 = GIFNextPixel()) != -1) {
    int k = (i1 << maxbits) + j1;
    int l = i1 << i2 ^ j1;
    if(htab[l] == k) {
    j1 = codetab[l];
    continue;
    if(htab[l] >= 0) {
    int k1 = l1 - l;
    if(l == 0)
    k1 = 1;
    do {
    if((l -= k1) < 0)
    l += l1;
    if(htab[l] == k) {
    j1 = codetab[l];
    continue label0;
    } while(htab[l] >= 0);
    output(j1, outputstream);
    j1 = i1;
    if(free_ent < maxmaxcode) {
    codetab[l] = free_ent++;
    htab[l] = k;
    } else {
    cl_block(outputstream);
    output(j1, outputstream);
    output(EOFCode, outputstream);
    void output(int i, OutputStream outputstream) throws IOException {
    cur_accum &= masks[cur_bits];
    if(cur_bits > 0)
    cur_accum |= i << cur_bits;
    else
    cur_accum = i;
    for(cur_bits += n_bits; cur_bits >= 8; cur_bits -= 8) {
    char_out((byte)(cur_accum & 0xff), outputstream);
    cur_accum >>= 8;
    if(free_ent > maxcode || clear_flg)
    if(clear_flg) {
    maxcode = MAXCODE(n_bits = g_init_bits);
    clear_flg = false;
    } else {
    n_bits++;
    if(n_bits == maxbits)
    maxcode = maxmaxcode;
    else
    maxcode = MAXCODE(n_bits);
    if(i == EOFCode) {
    for(; cur_bits > 0; cur_bits -= 8) {
    char_out((byte)(cur_accum & 0xff), outputstream);
    cur_accum >>= 8;
    flush_char(outputstream);
    void cl_block(OutputStream outputstream) throws IOException {
    cl_hash(hsize);
    free_ent = ClearCode + 2;
    clear_flg = true;
    output(ClearCode, outputstream);
    void cl_hash(int i) {
    for(int j = 0; j < i; j++)
    htab[j] = -1;
    void char_init() {
    a_count = 0;
    void char_out(byte byte0, OutputStream outputstream) throws IOException {
    accum[a_count++] = byte0;
    if(a_count >= 254)
    flush_char(outputstream);
    void flush_char(OutputStream outputstream) throws IOException {
    if(a_count > 0) {
    outputstream.write(a_count);
    outputstream.write(accum, 0, a_count);
    a_count = 0;
    private boolean interlace;
    int width;
    int height;
    int rgbPixels[][];
    IntHashtable colorHash;
    int Width;
    int Height;
    boolean Interlace;
    int curx;
    int cury;
    int CountDown;
    int Pass;
    static final int EOF = -1;
    static final int BITS = 12;
    static final int HSIZE = 5003;
    int n_bits;
    int maxbits;
    int maxcode;
    int maxmaxcode;
    int htab[];
    int codetab[];
    int hsize;
    int free_ent;
    boolean clear_flg;
    int g_init_bits;
    int ClearCode;
    int EOFCode;
    int cur_accum;
    int cur_bits;
    int masks[] = {
    0, 1, 3, 7, 15, 31, 63, 127, 255, 511,
    1023, 2047, 4095, 8191, 16383, 32767, 65535
    int a_count;
    byte accum[];

  • How do i save a frame to a image file?

    im trying to save a frame from Final Cut Pro 5 to my hard disk to save and edit with an editor such as Photoshop. how do i save it. what menu options do i use?

    The first thing you should do is check out the manual. This is a very, very basic export procedure; File->Export->Using QuickTime Conversion. Then choose still image from the format menu and your file type (JPG, TIF, PSD, etc) from the Option Menu.
    -DH

  • How can I read and display a ATR image file?

    Hello,
       Does anyone have any ideas on how to read a atr image file? 
    Regards,
    Kaspar
    Regards,
    Kaspar

    Hello,
      The ATR file is one of three files that are outputed as a result of a test that is performed with UnHoltz Dickie test equipment  that is used in a vibration lab. Does this help answer the question is there are any viewers?
    Regards,
    Kaspar
    Regards,
    Kaspar

  • How to hyperlink the web-address in an image file

    I have created a document on Keynote, which I saved as "Image" so I can send it out as mail.
    How can I make a Hyperlink for our www.com address on the Image file?
    I know already that Hyperlink works on PDF, however I don't want to send my document as an attachment, but scroll down.
    thanks

    How do you get it to default to the account that the email arrived in.   My exchange server email is my primary account.  But the reply keeps defaulting to my 2nd email account which is a SBCglobal.net account.   Why does it do this and how do I correct this.  
    Seems like it would be simple and automatically default to the account the mail came in on.   What am I missing.

  • From byte[] that rapp an image file TO a byte[] of the same file but in jpg

    Hello
    I've a byte[]. These bytes are of an image file with any extension (gif, png, jpeg etc.)
    I want to convert these byte[] in another byte[] array that has the same image but represented in jpeg format.
    I've found something like
    JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder .... and others
    but I've a lot of confusion about what are the steps to do something like that..
    Someone can post some sample code?
    thanks a lot guys
    giada

    Check out this thread. I had a similar problem awhile back, and that thread has pretty much everything you'd need to know about working with byte[] image streams. Although my problem was not exactly what yours is, I know the answer to your problem lies in that thread. Read it over a bit, and check out the links provided.

Maybe you are looking for

  • IOS8 on iPhone 5: Apps not Loading; Frequent Crashing

    Hey All, I've never posted on the support forum before, because I rarely have issues with my apple products. I recently downloaded the iOS8 upgrade onto my iPhone 5 and have been having severe issues with the functionality of my phone: 1) Apps will n

  • How can I reset My Number in settings-phone-my number

    how can I reset My Number in settings-phone-my number

  • [SOLVED] Trackpad only working as root

    I just installed arch on my late 2011 macbook pro. Almost everything worked fine out of the box but I have an issue with the trackpad, it does not work at all if I startx as a regular user. If I start X as root it seems to work fine. The only unusual

  • Corrupted package errors with pacman

    I'm trying to install ardour with pacman.  I issue the sudo pacman -S ardour command and get the following pakages are corrupted. liblo-0.25-1-i686.pkg.tar.gz libsamplerate-0.1.7-1-i686.pkg.tar.gz aubio-0.3.2-3-i686.pkg.tar.gz ardour-2.5-1-i686.pkg.t

  • Table of contents in Crsytal Reports 2008

    Hi, I have a requirement to create table of contents showing pagenumbers along with the titles in report.I tried using below formula: WhilePrintingRecords; StringVar Array catArry; NumberVar Array pageArry; IF NOT (GroupName({ARTIST.LAST_NM}) IN catA