AWT + JServer to produce image files

According to the documentation it's possible to use AWT with JServer provided that no user interface is materialized. This makes sense seen that we're running in the server.
However, it does make sense to use AWT for in-memory rendering of graphical stuff and then producing an image file or something. I'm looking at a pure Java report generator that I'm trying to load into the database, but when I run my program that calls the report generator (no user interface) I get a NullPointerException after the report generator has tried to initialize a font, which provocates a call to GraphicsEnvironment.getLocalGraphicsEnvironment().
Has anyone tried this or something similar? Do you have any sample code that demonstrates how it's possible to use AWT objects to accomplish this?
Thanks.
Finn Ellebaek Nielsen
ChangeGroup ApS
null

I recently tried to do the same thing - tried to produce an image file in memory using AWT on Oracle server side. I was trying to write a Java Stored Procedure. I got help from a third party tool which create images without any graphical environment for support.
The company is
VisualizeInc located in Phoenix, Arizona www.visualizeinc.com
(602)-861-0999
They have a product called JVPub which does this - produces GIF images without requiring a graphical environment for support. You can go to there website and they may have JVPub for download for you to evaluate. Or you can call them and they will give you an evaluation copy. They are very helpful and prompt in replying to your queries.
<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Finn Ellebaek Nielsen ([email protected]):
According to the documentation it's possible to use AWT with JServer provided that no user interface is materialized. This makes sense seen that we're running in the server.
However, it does make sense to use AWT for in-memory rendering of graphical stuff and then producing an image file or something. I'm looking at a pure Java report generator that I'm trying to load into the database, but when I run my program that calls the report generator (no user interface) I get a NullPointerException after the report generator has tried to initialize a font, which provocates a call to GraphicsEnvironment.getLocalGraphicsEnvironment().
Has anyone tried this or something similar? Do you have any sample code that demonstrates how it's possible to use AWT objects to accomplish this?
Thanks.
Finn Ellebaek Nielsen
ChangeGroup ApS<HR></BLOCKQUOTE>
null

Similar Messages

  • 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[];

  • Image Charts not producing images

    Hi all,
    We are using Oracle8i 8.1.7 database on Sun Solaris 9 and Portal 3.0.9.8.4 on the same server, I am trying the Image charts, it is not producing images, any ideas ?

    Hi,
    Are you getting any errors in the log? Look for errors in the log file of jserv.

  • How to display a dynamic image file from url?

    Hey,I want to display a dynamic image file from url in applet.For example,a jpg file which from one video camera server,store one frame pictur for ever.My java file looks like here:
    //PlayJpg.java:
    import java.awt.*;
    import java.applet.*;
    import java.net.*;
    public class PlayJpg extends Applet implements Runnable {
    public static void main(String args[]) {
    Frame F=new Frame("My Applet/Application Window");
    F.setSize(480, 240);
    PlayJpg A = new PlayJpg();
    F.add(A);
    A.start(); // Web browser calls start() automatically
    // A.init(); - we skip calling it this time
    // because it contains only Applet specific tasks.
    F.setVisible(true);
    Thread count = null;
    String urlStr = null;
    int sleepTime = 0;
    Image image = null;
    // called only for an applet - unless called explicitely by an appliaction
    public void init() {
                   sleepTime = Integer.parseInt(getParameter("refreshTime"));
              urlStr = getParameter("jpgFile");
    // called only for an applet - unless called explicitely by an appliaction
    public void start() {
    count=(new Thread(this));
    count.start();
    // called only for applet when the browser leaves the web page
    public void stop() {
    count=null;
    public void paint(Graphics g) {
    try{
    URL location=new URL(urlStr);
    image = getToolkit().getImage(location);
    }catch (MalformedURLException mue) {
                   showStatus (mue.toString());
              }catch(Exception e){
              System.out.println("Sorry. System Caught Exception in paint().");
              System.out.println("e.getMessage():" + e.getMessage());
              System.out.println("e.toString():" + e.toString());
              System.out.println("e.printStackTrace():" );
              e.printStackTrace();
    if (image!=null) g.drawImage(image,1,1,320,240,this);
    // called each time the display needs to be repainted
    public void run() {
    while (count==Thread.currentThread()) {
    try {
    Thread.currentThread().sleep(sleepTime*1000);
    } catch(Exception e) {}
    repaint(); // forces update of the screen
    // end of PlayJpg.java
    My Html file looks like here:
    <html>
    <applet code="PlayJpg.class" width=320 height=240>
    <param name=jpgFile value="http://Localhost/playjpg/snapshot0.jpg">
    <param name=refreshTime value="1">
    </applet>
    </html>
    I only get the first frame picture for ever by my html.But the jpg file is dynamic.
    Why?
    Can you help me?
    Thanks.
    Joe

    Hi,
    Add this line inside your run() method, right before your call to repaint():
    if (image != null) {image.flush();}Hope this helps,
    Kurt.

  • Opening an Image File

    Hi! I'm trying to open an image file in an application using JFileChooser. As I open the file, I know that the file has already been selected but I don't know how to put it on the correct container. I'm trying to show the image on the upper box such that it would look like it is currently showing the current image and the lower box would show the filmstrip view of the images in the folder. Basically I have a JFrame and then a JPanel1 on the JFrame. I also have another JPanel2 inside the JPanel1 and it is in the place of JPanel1 that I want to put the image. Anyway, I'm stuck as to what should I use to contain the image on the upper box (JPanel1, currently it doesn't work for a JPanel). I can't see the image I'm trying to open. Any idea or help will be appreciated.
    private void openMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_openMenuItemActionPerformed
        // TODO add your handling code here:
        //ImageCanvas canvas = new ImageCanvas();
        //JFileChooser chooser = new JFileChooser();
        if (chooser == null)     {
              chooser = new JFileChooser();
              canvas = new ImageCanvas();
              chooser.setDialogTitle("Images");
              chooser.setFileFilter(new ImageFilter());
              //orangePanel.add(chooser);
        chooser.addActionListener(new java.awt.event.ActionListener() {
           public void actionPerformed(java.awt.event.ActionEvent evt) {
                chooserOptionsActionPerformed(evt);
        setVisible(true);
        chooser.showOpenDialog(null);
    }//GEN-LAST:event_openMenuItemActionPerformed
    public class ImageFilter extends FileFilter {
        public boolean accept(File file) {
            if (file.toString().toLowerCase().endsWith("jpg")) {
                return true;
            return false;
        public String getDescription() {
            return "JPEG Files";
    private void nextButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_nextButtonActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_nextButtonActionPerformed
    private void previousButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_previousButtonActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_previousButtonActionPerformed
    private void zoomOutButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_zoomOutButtonActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_zoomOutButtonActionPerformed
    private void zoomInButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_zoomInButtonActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_zoomInButtonActionPerformed
    private void chooserOptionsActionPerformed(java.awt.event.ActionEvent evt)    {
        String command = evt.getActionCommand();
        if (command.equals(JFileChooser.APPROVE_SELECTION))   {
            System.out.println("open was pressed");
            File chosen = chooser.getSelectedFile();
                if (chosen != null && chosen.exists() && chosen.isFile()) {
                    try {
                        ImageIcon icon = new ImageIcon(chosen.toURL());
                        canvas.setImageIcon(icon);
                             getContentPane().validate();
                        setTitle(chosen.getName());
                    } catch (Exception e) {
                        setTitle(e.getLocalizedMessage());
        else if (command.equals(JFileChooser.CANCEL_SELECTION))   {
        //else {
            System.out.println("cancel was pressed");
            chooser.setEnabled(false);
    public class ImageCanvas extends JPanel {
        private ImageIcon imageIcon = null;
        private Dimension size = null;
        public ImageCanvas() {
            setBackground(Color.white);
        public void setImageIcon(ImageIcon icon) {
            this.imageIcon = icon;
            if (icon != null) {
                size = new Dimension(icon.getIconWidth(), icon.getIconHeight());
            repaint();
        public ImageIcon getImageIcon() {
            return this.imageIcon;
        public void paint(Graphics g) {
            super.paint(g);
            if (imageIcon != null) {
                imageIcon.paintIcon(this, g, 0, 0);
        public Dimension getPreferredSize() {
            if (imageIcon == null) {
                return super.getPreferredSize();
            } else {
                return size;
    }Sorry for the code snippets.. I coudn't put the entire code since its too long (netbeans). some lines are just for printing

    1. For Swing components, the method to override is paintComponent, not paint.
    2. Why use ImageIcon when you can paint an Image?
    -- Load the image using ImageIO.read(File input)
    -- For the rest, go through The Java&#8482; Tutorials: [Performing Custom Painting|http://java.sun.com/docs/books/tutorial/uiswing/painting/index.html]
    db

  • Please add support for JPEG Exchangeable Image File Format (EXIF)

    It seems that now Adobe® Illustrator® can export only to the JPEG File Interchange Format (JFIF). We should have an option to produce the JPEG Exchangeable image file format (EXIF) as well (just like Photoshop does!). Why this is so important to me? I generally work under Illustrator and I often post my work on Behence. I work with 'sRGB IEC61966-2.1' color profile. When publishing I use *.jpg with embedded ICC Color Profile. But it looks like Behence doesn’t fully support the JPEG JFIF – for example it cannot read its icc data correctly. The effect is that my work looses its quality! The only option to produce the JPEG EXIF I have now is to: Export *.ai file to JPEG (under Adobe Illustrator) > go to Photoshop > Create new project > Paste the *.jpg > and Sava As JPEG with icc embedded. This guarantees my files are being processed correctly.
    (JPEG) Formally, the EXIF and JFIF standards are incompatible. This is because both specify that their particular application segment (APP0 for JFIF, APP1 for Exif) must be the first in the image file. In practice, many programs and digital cameras produce files with both application segments included. This will not affect the image decoding for most decoders, but poorly designed JFIF or Exif parsers may not recognize the file properly. ( http://en.wikipedia.org/wiki/JPEG_File_Interchange_Format#Exif_comparison )
    I’ve analyzed my files using JPEGsnoop 1.6.1 (an app by Calvin Hass, http://www.impulseadventure.com/photo/) and here is the result:
    A) an *.jpg file produced with Adobe Illustrator > File > Export > JPEG > ICC profile embedded:
    *** Marker: SOI (xFFD8) ***
    OFFSET: 0x00000000
    *** Marker: APP0 (xFFE0) ***
    OFFSET: 0x00000002
    length     = 16
    identifier = [JFIF]
    version    = [1.2]
    density    = 72 x 72 DPI (dots per inch)
    thumbnail  = 0 x 0
    B) an *.jpg file produced with Adobe Illustrator > File > Save For Web > JPEG > ICC profile embedded:
    *** Marker: SOI (xFFD8) ***
    OFFSET: 0x00000000
    *** Marker: APP0 (xFFE0) ***
    OFFSET: 0x00000002
    length     = 16
    identifier = [JFIF]
    version    = [1.2]
    density    = 100 x 100 (aspect ratio)
    thumbnail  = 0 x 0
    C) an *.jpg file produced with Adobe Photoshop > File > Save As > JPEG > ICC Profile embedded
    *** Marker: SOI (xFFD8) ***
    OFFSET: 0x00000000
    *** Marker: APP1 (xFFE1) ***
    OFFSET: 0x00000002
    length          = 1320
    Identifier      = [Exif]
    Identifier TIFF = 0x[4D4D002A 00000008]
    Endian          = Motorola (big)
    TAG Mark x002A  = 0x002A
    EXIF IFD0 @ Absolute 0x00000014
    Dir Length = 0x0007
    [Orientation ] = Row 0: top, Col 0: left
    [XResolution ] = 720000/10000
    [YResolution ] = 720000/10000
    [ResolutionUnit ] = Inch
    [Software ] = "Adobe Photoshop CC 2014 (Windows)"
    [DateTime ] = "2014:08:02 17:21:15"
    [ExifOffset ] = @ 0x00A8
    Offset to Next IFD = 0x000000D4
    EXIF IFD1 @ Absolute 0x000000E0
    Dir Length = 0x0006
    [Compression ] = JPEG
    [XResolution ] = 72/1
    [YResolution ] = 72/1
    [ResolutionUnit ] = Inch
    [JpegIFOffset ] = @ +0x0132 = @ 0x013E
    [JpegIFByteCount ] = 1006
    Offset to Next IFD = 0x00000000
    EXIF SubIFD @ Absolute 0x000000B4
    Dir Length = 0x0003
    [ColorSpace ] = sRGB
    [ExifImageWidth ] = 200
    [ExifImageHeight ] = 200
    Regards,
    Pawel Kuc

    This is a user-to-user forum and is not monitored by Apple for feedback purposes. You can give feedback to Apple here: Apple - Mac OS X - Feedback

  • Saving PDF files as image files using the Preview application

    I'm converting PDF files into image files for use with OCR software. The problem is that changing the pixels/inch option from 150 to say 300 does not improve the resolution of the resulting image file. E.g. if I save at 150 p/i and then 300p/i both image files are the same size and resolution. I've tried JPG, JPG-2000, TIFF, and GIF. All produce the same fuzzy result. What am I doing wrong?

    The schematic file is made up from vector graphics. There are no images embedded in it. For some reason the OCR software (PDF pen) will not recognize the vector drawn characters near the various components. e.g. There may be a resistor with "R5" written next to it. This is the resistors designator. The designator is what I am trying to do the search on. Since PDF pen can perform OCR on scanned (image) documents I thought that turning the PDF schematic into an image file e.g. JPG using Preview would do the trick. Unfortunately as I have already mentioned I can not seem to get Preview to improve the resolution on the resulting image file - the OCR software struggles to recognize any print.

  • Exist an easy way to convert base64 code in XML files into the original image file on forms

    I've made a form in lifecycle that will be distributed by email as a pdf, and submitted back to me as an XML file and then that data imported into the pdf form template to view the data. Issue is I have an "attach image" field on the form and in XML it gets written to a base64 encoded format. Is there convenient way to extract this code from the XML file so that I would have a workable jpeg image file that I can save and open in other apps? Thank you in advance!  -Robert Tampa

    I tried to make John Brinkman's sample working in reverse.
    This script will grab an image field's value and produce an attachment (png-file), which then can be saved to the hard drive.
    //Get Base64 data of the image field
    var b64Data = ImageField1.value.image.value;
    //Convert to a read stream
    var ReadStream = util.streamFromString(b64Data);
    //Decode from Base64
    var DecodedStream = Net.streamDecode(ReadStream, "base64");
    //Attach an empty image file
    event.target.createDataObject("MyExportImage.png", "", "image/png");
    //Update attached image file with stream data
    event.target.setDataObjectContents("MyExportImage.png", DecodedStream);
    //Show attachment pane
    event.target.viewState = {overViewMode:7};
    This works so far, but the produced images are always cutted off.
    No idea what's the reason for this behavior.

  • Reading Image File into 6i Form

    I am attempting to read an image file and display it on an Oracle Form (created in Forms 6i) using the READ_IMAGE_FILE builtin. I have tried it with the same image in several different formats: JPG, TIFF and GIF. The call reads as follows: READ_IMAGE_FILE('D:\mugshot\mug23456.gif','GIF','DESCRIPTION.IMAGE_ITEM'); The file is located in the indicated path on the application server, i.e. the same machine where the form is being run. DESCRIPTION.IMAGE_ITEM is, of course, an Item of type Image. The PL/SQL procedure containing the above call is invoked by an ON-POPULATE-DETAILS trigger defined at the block level (DESCRIPTION is the block in question). Here is the problem: after logging into my Forms 6i application via a login screen, which then runs the form which would be displaying the image item, the form does not appear; all we see is a blank screen. When I remove the DESCRIPTION.IMAGE_ITEM field from the canvas, the form runs as expected, except of course that the image is not read. Is there something special that has to be done to read or display an image, other than what I have already done as described above?

    Plz don't Reply
    i am able to do it on my own here is the sample code for that
    import javax.swing.*;
    import java.awt.*;
    import javax.swing.event.*;
    import java.awt.event.*;
    import java.util.*;
    import java.io.*;
    import javax.swing.text.*;
    // this is a function u can use it in a class
    private void addEditScroll(){
    try{
    BufferedReader infile = new BufferedReader(new FileReader("c:\\WS_FTP.log"));
    editor =new JEditorPane();
    editor.setEditable(false);
    editor.read(infile,new PlainDocument());
    editor.setSize(new Dimension(450,510));
    editorscroll = new JScrollPane(editor);
    editorscroll.setSize(new Dimension(450,510));
    }catch(Exception ex){
    ex.printStackTrace();
    -ashish

  • Load JP2 image file with GeoRasterLoader

    Hi to all,
    We are trying to set up Oracle GeoRaster tools (stand-alone client-side java Executables found in %ORACLE_HOME%\md\...) in order to view and load JP2 image files to Oracle.
    Our test environment has Oracle 11g r2 (11.2.0.3.0) EE with Spatial Option on Microsoft Windows XP Professional 2002 SP3.
    Following the instructions for loading JP2 we download and install jai_imageio-1_1-lib-windows-i586.exe from: http://download.java.net/media/jai-imageio/builds/release/1.1/
    1.     Please find an example of the command we use to invoke GeoRasterLoader from command line:
    java oracle.spatial.georaster.tools.GeoRasterLoader SE004 ORCL 1521 RD RD thin 32 T OKXE_ORTHOS GEORASTER "blocking=true blocksize=(256,256,3) spatialExtent=TRUE" "C:\Temp\0458041985\0458041985.jp2,1,OKXE_ORTHOS_RDT,C:\Temp\0458041985\0458041985.j2w,2100"
    Got connection
    Loading image: C:\Temp\0458041985\0458041985.jp2
    java.lang.NullPointerException
    at oracle.spatial.georaster.rasterio.JGeoRasterAdapter.setSRS(JGeoRasterAdapter.java:4509)
    at oracle.spatial.georaster.rasterio.JGeoRasterAdapter.setMetadataStream(JGeoRasterAdapter.java:4520)
    at oracle.spatial.georaster.rasterio.JGeoRasterAdapter.storeFromStream(JGeoRasterAdapter.java:4921)
    at oracle.spatial.georaster.rasterio.GeoRasterAdapter.doImport(GeoRasterAdapter.java:632)
    at oracle.spatial.georaster.rasterio.GeoRasterAdapter.loadFromFile(GeoRasterAdapter.java:1863)
    at oracle.spatial.georaster.tools.GeoRasterLoader.load(GeoRasterLoader.java:458)
    at oracle.spatial.georaster.tools.GeoRasterLoader.main(GeoRasterLoader.java:243)
    java.lang.NullPointerException: null
    The georaster object is not loaded correctly!!
    Loader Finished.
    2.     When using the GeoRaster Viewer for retrieving jp2 file from file we get an error message “ Can’t load Image” The error messages that appear in the command prompt are as follows:
    C:\Oracle\product\11.2.0\dbhome_1\md\demo\georaster\java>java -Xms128m -Xmx564m oracle.spatial.georaster.tools.GeoRasterTool
    java.lang.RuntimeException: - Unable to render RenderedOp for this operation.
    at javax.media.jai.RenderedOp.createInstance(RenderedOp.java:827)
    at javax.media.jai.RenderedOp.createRendering(RenderedOp.java:867)
    at javax.media.jai.RenderedOp.getWidth(RenderedOp.java:2179)
    at oracle.spatial.georaster.tools.GeoRasterTool.actionPerformed(GeoRasterTool.java:1471)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849)
    at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169)
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
    at javax.swing.AbstractButton.doClick(AbstractButton.java:302)
    at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1051)
    at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1092)
    at java.awt.Component.processMouseEvent(Component.java:5517)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3135)
    at java.awt.Component.processEvent(Component.java:5282)
    at java.awt.Container.processEvent(Container.java:1966)
    at java.awt.Component.dispatchEventImpl(Component.java:3984)
    at java.awt.Container.dispatchEventImpl(Container.java:2024)
    at java.awt.Component.dispatchEvent(Component.java:3819)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
    at java.awt.Container.dispatchEventImpl(Container.java:2010)
    at java.awt.Window.dispatchEventImpl(Window.java:1791)
    at java.awt.Component.dispatchEvent(Component.java:3819)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
    PS. He have no problems in viewing and loading other type of image files like tif
    TIA,
    George

    Hi Tomek,
    3 to 4 MB with the following image header. Anyway, we also tried jp2 image files from other sources
    Thanks,
    BR / George
    Output from Display Header
    File Name: I:\Okxe\Orthos_June\0438042165\0438042165.jp2
    File Information:
    Standard : : Jpeg 2000 File
    Format : Lossless JPEG 2000 compression
    Pixels per Line : 1600
    Number of Lines : 1200
    Samples per pixel : 3
    File bits per sample : 8
    Actual bits per sample : 8
    Untiled file
    Number of overviews : 5
    Overview sampling method: Gaussian
    Scanning device resolution : 84 : microns
    Orientation : 4 : Row major order, origin at top left
    NO scan line headers : non-scannable file
    Packet size (16-bit words) : 0
    Free vlt space (16-bit words) : 0
    Free packet space (16-bit words) : 0
    Raster to UOR matrix:
    Identity Matrix (ones on the diagonal, zero otherwise)
    Raster to World Matrix:
    Units: Unknown or Unspecified
    amx[ 0]= 0,25, amx[ 1]= 0, amx[ 2]= 438000
    amx[ 3]= 0, amx[ 4]= -0,25, amx[ 5]= 4216800
    438000 , 4216800
    438400 , 4216800
    438400 , 4216500
    438000 , 4216500
    Geotiff_Information:
    Version: 1
    Key_Revision: 1.0
    Tagged_Information:
    ModelTiepointTag (2,3):
    0 0 0
    438000 4216800 0
    ModelPixelScaleTag (1,3):
    0.25 0.25 0
    End_Of_Tags.
    Keyed_Information:
    GTRasterTypeGeoKey (Short,1): RasterPixelIsArea
    End_Of_Keys.
    End_Of_Geotiff.
    Corner Coordinates:
    Upper Left ( 438000.000, 4216800.000)
    Lower Left ( 438000.000, 4216799.750)
    Upper Right ( 438000.250, 4216800.000)
    Lower Right ( 438000.250, 4216799.750)
    Center ( 438000.125, 4216799.875)

  • Render PDF Pages As Images - File names are gibberish

    I have a workflow that takes a folder of PDF's and converts them to JPG's.
    The problem is that Automator is giving the converted files random gibberish filenames such as Kft56Fvg.jpeg and not the names of the original files.
    Anyone know what's going on?

    At the bottom of the list of actions in Automator is an area with the description of the selected action in the listing (but not the workflow). If this description isn't visible, there is a button at the bottom of the window near the bottom left corner of the window for revealing the description.
    If you need to see the description of an action that is in the workflow on the right side of the window, there is a button on the action itself at its bottom left that will reveal the description of the action. This is so you won't have to find it again in the listing just to review its description.
    For you're immediate convenience and peace of mind, this is the description you'll find for "Render PDF Pages as Images":
    ---- Begin description ----
    This action will render each page of the passed PDF files as images.
    Note: As the names of the resulting images are randomly generated, this action is often followed by the Rename Finder Items > Make Sequential action.
    Input: PDF files
    Options: Image format, color model, resolution, and compression
    Result: (Image files) References to the rendered image files.
    ---- End description ----
    Since a PDF can contain many pages, this action could produce many images from the same PDF. So, that could further complicate naming the new images when multiple PDFs are involved if you need special names.

  • CREATING IMAGE FILE

    Hi there,
    I have an "java.awt.Image" object with me. I am trying to create a file by using this "Image" object.
    Please help me by showing some code or by giving some tip.
    thanks in advance
    sudhakar

    hi,
    I am using the below code to copy the image from system Clipboard.
    // If an image is on the system clipboard, this method returns it;
    // otherwise it returns null.
    public static Image getClipboard() {
    Transferable t = Toolkit.getDefaultToolkit().getSystemClipboard().getContents(null);
    try {
    if (t != null && t.isDataFlavorSupported(DataFlavor.imageFlavor)) {
    Image text = (Image)t.getTransferData(DataFlavor.imageFlavor);
    return text;
    } catch (UnsupportedFlavorException e) {
    } catch (IOException e) {
    return null;
    when i call this method then it is returning an "Image" object. Just I am trying to copy that image into an image file like "myImage.gif" something like that.
    Actually i am taking this clipboard image from the "printscreen" button function form the system.
    thankyou
    batta

  • Convert xml file into Image file

    Hi,
    How to transform xml file into image file?.
    i don want to transform the xml file into html file.
    Thanks,
    nithi

    One way I can think of is to create a java.awt.BufferedImage, and use its Graphics object to print out the xml (count the lines first, and space them to your liking). Then if you want to save it to e.g. png or jpg there are free libraries for that, whose names I don't remember at the moment... Dunno why you'd wanna do this though :)

  • Is it possible to save a picture/image file that is within an iOS app?

    Is it possible to save a picture/image file that is within an app?
    The image in question cannot be shrunk, so using the iPhone built-in Screenshot function (by pressing both "Home" & "On/OffSleep/Wake" buttons simultaneously) only produces part of the image.
    Thanks.

    Generally in all Apple iOS apps, you can hold down on the image and the save image dialogue will pop up. Many third party developers adopt this method, but some also have other weird ways of doing it through menus. What appa re you trying to do this with?

  • My program always displays the same image, even when I change th image file

    I'm making a program that chooses an image file from a dialog, resize it and copy it into a folder. When the image is needed to be displayed, the image file is read and a JLabel displays it on screen.
    When I upload the first image, everything works fine. The problem appears when I upload another picture: the displayed image is still the first image, even when the old file doesn't exist anymore (because it has been overwritten). It looks like the image has been "cached", and no more image are loaded after the first one.
    This function takes the image picture chosen by the user, resizes it, and copy it into the pictures folder:
        private void changeProfilePicture() {
            JFileChooser jFileChooser = new JFileChooser();
            jFileChooser.setMultiSelectionEnabled(false);
            jFileChooser.setFileFilter(new ImageFileFilter());
            int result = jFileChooser.showOpenDialog(sdbFrame);
            if (JFileChooser.APPROVE_OPTION == result) {
                try {
                    //upload picture
                    File file = jFileChooser.getSelectedFile();
                    InputStream is = new BufferedInputStream(new FileInputStream(file));
                    //resize image and save
                    BufferedImage image = ImageIO.read(is);
                    BufferedImage resizedImage = resizeImage(image, 96, 96);
                    String newFileName = sdbDisplayPanel.getId() + ".png";
                    String picFolderLocation = db.getDatabaseLocation() + "/" +
                            PROFILE_PICTURE_FOLDER;
                    java.io.File dbPicFolder = new File(picFolderLocation);
                    if(!dbPicFolder.exists())  {
                        dbPicFolder.mkdir();
                    String newFilePath = picFolderLocation + "/" + newFileName;
                    File newFile = new File(newFilePath);
                    FileOutputStream fos = new FileOutputStream (newFilePath);
                    DataOutputStream dos = new DataOutputStream (fos);
                    ImageIO.write(resizedImage, "png", dos);
                    dos.close();
                    fos.close();
                    //set picture
                    sdbDisplayPanel.setImagePath(newFilePath);
                } catch (IOException ex) {
                    System.err.println("Could'nt print picture");
                }This other class actually displays the image file in a JLabel:
        public void setImagePath(String imagePath) {
            count++;
            speaker.setImagePath(imagePath);
            this.imagePath = imagePath;
            if(imagePath != null)   {
                //use uploaded picture
                try {
                    File tempFile = new File(imagePath);
                    System.out.println(tempFile.length());
                    java.net.URL imgURL = tempFile.toURI().toURL();
                    ImageIcon icon = new ImageIcon(imgURL);
                    pictureLbl.setIcon(icon);
                    // Read from a file
                } catch (IOException ex) {
                    Logger.getLogger(SDBEventClass.class.getName()).log(Level.SEVERE, null, ex);
            else    {
                //use default picture
                URL imgURL = this.getClass().getResource("/edu/usal/dia/adilo/images/noProfile.jpg");
                ImageIcon icon = new ImageIcon(imgURL, "Profile picture");
                pictureLbl.setIcon(icon);
        }

    When you flush() the image, you don't need to construct a new ImageIcon each time, a simple repaint() will suffice.
    Run this example after changing the URL to an image you can edit and update while the program is running.import java.awt.BorderLayout;
    import java.awt.Image;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.net.MalformedURLException;
    import java.net.URL;
    import javax.swing.*;
    public class FlushImage {
       Image image;
       JLabel label;
       public static void main(String[] args) {
          SwingUtilities.invokeLater(new Runnable() {
             @Override
             public void run() {
                new FlushImage().makeUI();
       public void makeUI() {
          try {
             ImageIcon icon = new ImageIcon(new URL("file:///e:/java/dot.png"));
             image = icon.getImage();
             label = new JLabel(icon);
             JButton button = new JButton("Click");
             button.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                   image.flush();
                   label.repaint();
             JFrame frame = new JFrame("");
             frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
             frame.add(label, BorderLayout.NORTH);
             frame.add(button, BorderLayout.SOUTH);
             frame.pack();
             frame.setLocationRelativeTo(null);
             frame.setVisible(true);
          } catch (MalformedURLException ex) {
             ex.printStackTrace();
    }db

Maybe you are looking for

  • Issue with Period Control 03 for Depri key MSTL with 6446

    Hi Gurus, We want to use mid-month calculation for Dep. key MSTL using period control 03 (i.e. 03/03/03/03). We are also using 6446 as year-depedent Fiscal year (i.e. Jan and Dec 6 weeks other rest 4 weeks).  period control 03 is pro rata at mid peri

  • Developing, Deploying, Managing Web Services with Oracle9i

    HOWTO: The "Hello, World!" Sample Project Follow these steps to create, compile, and run a simple Java program in JDeveloper: 1.Create a project. Choose File | New Empty Project. A new project node, with a name resembling MyProject1.jpr will appear i

  • Ipod Photo and Ipod dock

    I have a question:Does the Ipod Dock only work with Mac Computers? I want to get one but not sure if it will work with windows XP SP2. Can somebody help me out.

  • Share visualization without story board

    Hi, Can we share only the Visualization to Lumira cloud without the story board?  Is it possible? Regards. Anjan

  • Call sql statement from JComboBox component

    Hi there, I Have created a frame to populate two JComboBoxs, I'm populating the first one from a database using SQL, this datable is showing the category to below every report. anybody know how can I select from my first JComboBox a record a call a s