XSD Diagram to image file

Hi there,
Does anyone know if it is possible to get the graphical representation of an XSD into an image format such as BMP, JPG or PNG so that it can then be embedded into documentation (e.g. Word)

+1 ... for this enhancement request
(Today I received an MS Word document containing several JDeveloper screenshots showing several XML Schema's in design view ... but it isn't easy to work with, it doesn't look professional and it is big (I prefer smaller PNG files) ... now I think about it, maybe it should be possible to easily export parts of the design view "diagram" because it can get large (collapsing some of the elements or types before "publish" can be a workaround).)
regards
Jan Vervecken

Similar Messages

  • Help me to do this "IMAQ"-2 image file attached

    Dear friends
    In this i attach my image file in Tif format & jpeg format
    Please go through this vi
    this vi it will display a image window when u click inside that window a square box will create, where ever u click it will create multiple box. i used imaq windraw function, u can see another image window in the front pannel also.
    now my aim is to put a box over that spot with the spot as center and to extract the pixel values of the individual boxes,
    now whats happening is when i run this program a image window is opening from the imaq windraw function in that 1ly i can able to put multiple box but that box is displayed in the image display in the front pannel also. but i cant put the box in the image window in the front pannel. if u click the mouse in the image window in the front pannel it will display the 25x25pixel values.
    i want both to be done in a same window i want to put a multiple square box and the pixel values i want to extract seperately for the individual boxes. please help me give some ideas how to do this please modify this vi.
    thank u
    sasi
    Attachments:
    1.zip ‏279 KB

    Sasi,
    I am a little confused on what exactly you want to do and why you are using both WinDraw and an Image Display Control to show the image. It sounds like what you want to be able to do are the following 3 things:
    1) Display the Image
    2) Click on the image and have a rectangle overlay appear on image
    3) Get the pixel values from that rectangle into an array
    If I am understanding you correctly, then you should only display the image using one of the above display methods and have only a signal case structure in your code that adds the overlay to the image AND extracts the pixel values. I am a little unclear as to why you have decided to only get the pixel values if the user clicks on the Image Display and only draw the rectangle if the user clicks on the WinDraw display.
    I have attached an image of a block diagram, which is what I think that you are trying to do. In the block diagram you can see that I have combined everything into one case structure so that whenever a user clicks on the Image Display (no WinDraw) then I add a rectangle overlay to my image and also get the pixel values for that area. If you want to keep track of the pixel values for each rectangle then you could use a shift register and build up a 3-D array with all of this information ... or write the data to file ... or use another method to keep that data for future use.
    Regards,
    Michael
    Applications Engineer
    National Instruments

  • 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 file formats to use in print pdfs

    We receive images from several vendors in order to build our catalogs in Adobe InDesign CS2, and then we export print pdfs from InDesign. We want to standardize our requirements for receiving images from vendors, and we had a question related to file formats. Is it okay to use jpeg files as long as they are in high-resolution CMYK format?
    It is a part of our work flow to accept the images untouched from the vendor, no re naming of files, or changing f file formats. I understand that the safest bet is for EPS and TIFF formatted images, but will JPEG files be problematic in any way? Someone told me that because of their compressed format that some info could get lost when embedding into pdfs. Is there a book, or any printed documentation about what types of image file formats to use to create pdfs?
    Thanks,
    Elliott

    (1) There is nothing "unsafe" about JPEG-compressed images. However, JPEG compression is
    lossy and depending upon the type of image, its resolution, and the compression settings used when creating the JPEG file, the results at the end of the workflow may not be satisfactory. That having been said, if JPEG compression is used for a photographic image (not a screen shot or an image representation of what should be a vector diagram), the "maximum quality" setting is used in producing the JPEG image (
    not maximum compression), and the image is of appropriate resolution for its final purpose (at least 150 dpi, preferably closer to 300 dpi for printing) at full magnification, then there is nothing "unsafe" about JPEG.
    (2) You should be aware that saving images in EPS (Encapsulated PostScript) format from Photoshop may yield JPEG compression, depending upon options chosen. Thus, there is nothing inherently "safer" about EPS compared to JPEG. And ironically, you can also get JPEG compression in TIFF files if you aren't careful how you save them, although that is very uncommon.
    (3) CMYK is not necessary for image placement into InDesign as long as the image is tagged with the appropriate ICC color profile (such as sRGB, Adobe RGB, etc.). InDesign can convert those RGB images to whatever the final print conditions are or, if creating PDF, leave the images in RGB format with the ICC profile. How you create the output obviously depends heavily on what type of workflow your print service provider has. More "up to date" printers support color-managed workflows with ICC color profile tagged images in PDF files.
    (4) In terms of receiving images from vendors, if you require them to convert the images from whatever their native RGB color space is to CMYK, you really must specify
    which CMYK and provide the correct ICC color profile to them! Different print processes use different CMYK color spaces. If you convert RGB to the wrong color space, the results can be awful. You are probably best off requiring that vendors submit photos in their original RGB color space, but tagged with the appropriate ICC color profile.
    - Dov

  • If image file not exist in image path crystal report not open and give me exception error problem

    Hi guys my code below show pictures for all employees
    code is working but i have proplem
    if image not exist in path
    crystal report not open and give me exception error image file not exist in path
    although the employee no found in database but if image not exist in path when loop crystal report will not open
    how to ignore image files not exist in path and open report this is actually what i need
    my code below as following
    DataTable dt = new DataTable();
    string connString = "data source=192.168.1.105; initial catalog=hrdata;uid=sa; password=1234";
    using (SqlConnection con = new SqlConnection(connString))
    con.Open();
    SqlCommand cmd = new SqlCommand("ViewEmployeeNoRall", con);
    cmd.CommandType = CommandType.StoredProcedure;
    SqlDataAdapter da = new SqlDataAdapter();
    da.SelectCommand = cmd;
    da.Fill(dt);
    foreach (DataRow dr in dt.Rows)
    FileStream fs = null;
    fs = new FileStream("\\\\192.168.1.105\\Personal Pictures\\" + dr[0] + ".jpg", FileMode.Open);
    BinaryReader br = new BinaryReader(fs);
    byte[] imgbyte = new byte[fs.Length + 1];
    imgbyte = br.ReadBytes(Convert.ToInt32((fs.Length)));
    dr["Image"] = imgbyte;
    fs.Dispose();
    ReportDocument objRpt = new Reports.CrystalReportData2();
    objRpt.SetDataSource(dt);
    crystalReportViewer1.ReportSource = objRpt;
    crystalReportViewer1.Refresh();
    and exception error as below

    First: I created a New Column ("Image") in a datatable of the dataset and change the DataType to System.Byte()
    Second : Drag And drop this image Filed Where I want.
    private void LoadReport()
    frmCheckWeigher rpt = new frmCheckWeigher();
    CryRe_DailyBatch report = new CryRe_DailyBatch();
    DataSet1TableAdapters.DataTable_DailyBatch1TableAdapter ta = new CheckWeigherReportViewer.DataSet1TableAdapters.DataTable_DailyBatch1TableAdapter();
    DataSet1.DataTable_DailyBatch1DataTable table = ta.GetData(clsLogs.strStartDate_rpt, clsLogs.strBatchno_Rpt, clsLogs.cmdeviceid); // Data from Database
    DataTable dt = GetImageRow(table, "Footer.Jpg");
    report.SetDataSource(dt);
    crv1.ReportSource = report;
    crv1.Refresh();
    By this Function I merge My Image data into dataTable
    private DataTable GetImageRow(DataTable dt, string ImageName)
    try
    FileStream fs;
    BinaryReader br;
    if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + ImageName))
    fs = new FileStream(AppDomain.CurrentDomain.BaseDirectory + ImageName, FileMode.Open);
    else
    // if photo does not exist show the nophoto.jpg file
    fs = new FileStream(AppDomain.CurrentDomain.BaseDirectory + ImageName, FileMode.Open);
    // initialise the binary reader from file streamobject
    br = new BinaryReader(fs);
    // define the byte array of filelength
    byte[] imgbyte = new byte[fs.Length + 1];
    // read the bytes from the binary reader
    imgbyte = br.ReadBytes(Convert.ToInt32((fs.Length)));
    dt.Rows[0]["Image"] = imgbyte;
    br.Close();
    // close the binary reader
    fs.Close();
    // close the file stream
    catch (Exception ex)
    // error handling
    MessageBox.Show("Missing " + ImageName + "or nophoto.jpg in application folder");
    return dt;
    // Return Datatable After Image Row Insertion
    Mark as answer or vote as helpful if you find it useful | Ammar Zaied [MCP]

  • Error "A web exception has occurred during file upload" when trying to import ESXi image file into Update Manager

    I'm encountering this error and not sure how to fix, I'm quite new to vCenter so please bear with me.
    I'm trying out vCenter 5.1 with Update Manager 5.1 right now.  No license key has been entered and I still have 50 odd days to try it out.
    2 ESXi hosts are being managed by this vCenter, and they're both running ESXi 4.0
    I'm looking to use Update Manager to try to upgrade the ESXi 4.0 hosts to ESXi 5.1
    I downloaded the image file VMware-VIMSetup-all-5.1.0-799735.iso from VMWare website, and is looking to import it using the Update Manager so I can update the ESXi hosts, but I keep on getting the error:
    File name:     VMware-VIMSetup-all-5.1.0-799735.iso
    Failed to transfer data
    Error was: A web exception has occurred during file upload
    I tried importing it by using vSphere client to connect to vCenter server both remotely and locally, with firewall disabled.
    I've read http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1026602
    I've disabled firewall, and there is no anti-virus program on the server.  I've also restarted the machine several times, to no avail, I didn't reinstall update manager because the whole Windows and VCenter installations are clean from scratch.
    I logged into the vSphere Client using Active Directory credentials, and I've made all Domain Admins (which my account is a member of) part of the administrator group on the vCenter server. I can't log in using admin@System-Domain because it tells me I don't have permissions for it, I still haven't really had the chance to figure out why that is and not sure if that makes a difference.
    Also, I'm fairly certain I'm using the right image file, as I've burned some DVD's used that image file to upgrade some other ESXi hosts.  Unless there's a special image file I need to download?
    I'm at lost on what I can do to make it work.  Please advise.
    Thanks.

    The ISO file you mentioned is the one for vCenter Server. What you need is the "VMware-VMvisor-Installer-5.1.0-799733.x86_64.iso" (or VMware-VMvisor-Installer-201210001-838463.x86_64.iso) for the ESXi host.
    André

  • A generic error occurred in GDI+ while assing tiff image file to Bitmap and Image

    Hi,
    I am getting "A generic error occurred in GDI+" error while reading the tiff image file to Bitmap or Image.
    Below is my sample code.
    string filePath=@"c:\Images\sample.tif";
    Bitmap bmp=new Bitmap(filePath);   // here getting exception
    int totalpages=bmp.GetFrameCount(.....);
    etc......
    I tried using Bitmap.FromFile() and also from FromStream() even for Image also but there is no use.
    Moreover i m having full permissions for the file path and the tiff file is having multiple pages.
    Can anyone help me to solve this issue please.
    Thanks & Regards,
    Kishore
    Kishore

    Make sure that the Tif file is valid (can other software open it)?  If you are able to save a Tif using GDI+, try saving that Tif, then opening it.  Part of me wonders if there is something about that specific Tif that GDI+ doesn't like.
    You could also try using WIC to open the TIF, perhaps you would have better luck there.

  • Error: Unable to locate an image file browser...

    I get the error below when I insert an image element and try to associate a picture to it by either double clicking it or using the browse button in the Draw palette.
    I have looked in my install directory and the "FileSystemBrowser.dll" file is present as well as the "ImageFileBrowserIDL.dll" file, so what gives?
    Running LiveCycle ES2 9.0.0.2.20120627.2.874785

    Hi,
    you should be able to fix that problem by re-registering Designer file browser DLL.
    http://thelivecycle.blogspot.de/2014/02/diy-bugfix-image-file-browser.html

  • Publisher hangs when I try to open an image file

    Publisher hangs when I try to open an image file from:
    right-click on image->Change Picture->Change Picture
    The image is on my hard drive.
    It also happens with powerpoint

    Few Questions:
    a. What version of publisher/PowerPoint are you using ?
    b. Are you able to insert this image through Insert -> Image ? Image itself could be corrupt. Try to open it with some other editor ?

  • 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.

  • How to delete a jar file after loading image files from it

    Hi,
    How can I delete a jar file after some image files have been loaded? For example, say, I have "a.jar" which contains an image "a.gif" in the root directory of the c drive. I would like to get the image size and then delete the jar file. Here is the code snippet:
        URL url = new URL("jar:file:/C:\\a.jar!/a.gif");
        Icon icon = new ImageIcon(url);
        System.out.println("icon size ? " + icon.getIconHeight());
        File file = new File("c:\\a.jar");
        while(file.exists())
            file.delete();
            try
                Thread.sleep(100);
            catch (InterruptedException ignored)
        System.out.println("file deleted.");I get the image size correctly but just can not delete the jar file. Apparently the file handle is not released, but how to close it? Any hint will be appreciated.
    Justin Jan

    I am sure the URLConnection.defaultUseCaches is set before it is connected otherwise I should catch an IllegalStateException on conn.setUseCaches(false).
            try
                URL url = new URL("jar:file:/C:\\a.jar!/a.gif");           
             URLConnection conn = url.openConnection();
               conn.setDefaultUseCaches(false);
             conn.setUseCaches(false);
                Icon icon = new ImageIcon(url);
                System.out.println("icon size ? " + icon.getIconHeight());
                url.openConnection().getInputStream().close();
                System.gc();
             System.runFinalization();
                File file = new File("c:\\a.jar");
                while (file.exists())
                    file.delete();
                    try
                        Thread.sleep(10);
                    catch (InterruptedException ignored)
                System.out.println("file deleted.");
            catch (Throwable t)
                t.printStackTrace();

  • Disc image file & CSS encoding?

    I originally exported a project with CSS encoding from DVDSP to a DLT tape for replication. (DDP 2.0 with CSS)
    I then created a disc image file of this project and don't remember if I had checked CSS format. Is there a way to determine this by looking through the Video_TS folder or possibly another way.
    thanks,
    dave

    Dave,
    Disc Images, per se, cannot have CSS applied to them (they're fixed at 2048 bytes per sector). This is so you can write the Image to DVD-Recordables - which is not allowed to have CSS on them, or mount the Disc Image on various machines; again, no CSS allowed in that application.
    For sure, Disc Images do have CSS applied to them, but this is only during DDP 2.0, DDP 2.1, or CMF formatting. Though then, you'll have an unplayable Disc Image in that case, until the replicator applies the unscrambling keys during mastering.
    So, if you left the CSS option on, it would have no affect (setting ignored) if formatting a regular "img" to hard drive or Recordable.
    Take care,
    Trai
    TFDVD Research Labs

  • Disc image file exported from Encore CS4 won't work

    Hello,
    I have a problem concerning the export of a disc image file in Encore CS4. I recently upgraded to CS4 and wanted to continue my project which I started editing with CS3. While working with CS3 I already did image files from this project for burning and testing the DVD. Back then it worked with no problems.
    However, since using the CS4 version Encore does the image without any problem, but I can't use the image file in any way afterwards. I mounted it with Daemon Tools as I did before, but the DVD won't play in any software DVD player I have installed (Media Player Classic, Windows Media Player, Nero Showtime) nor can I access the file structure over a file manager. Nevertheless NeroInfoTool and ImgBurn say there is a DVD in the virtual drive. Then I exported the DVD project into a folder and now I can see the files in the file manger but again no player will play it.
    Has anyone experienced this before and is able to help? It would be very appreciated since I don't want to downgrade back to CS3 :-)
    It's Encore CS4, Version 4.0.1.048 on a 2,8 GHz HT CPU, 2 GB RAM, Nvidia Geforce 6800 UT, lots of HDD space, XP + SP3.
    Thank you,
    Chris...

    Hey,
    thank you both. As I said no player accepts the project exported to a folder. It doesn't matter if I point the player to the video_ts.ifo or just the folder - it won't play. As a consequence I re-installed Encore CS3 in which exporting worked fine and guess what - the exported image and folder output doesn't work either. Since it worked before in CS3 it comes down to the conclusion that either I did some editing to the project that screwed the project or Encore CS4 did. Checking for mistakes in the project and previewing in inside CS4 everything seems fine. So might it be CS4 that ****** up the project file??? I mean it's full of strange bugs so it could easily be that. I even updated my Daemon Tools yesterday and it won't make a difference.
    Or could it be something else I haven't considered yet? Any ideas? I just don't want to build the whole project again which might not even work if it's some other error. This is a desperate call for help
    Thanks,
    Chris...

  • How to make a image file from Pre installed Mac osx ? "PLEASE HELP :("?

    hey guys ..Thanks u for the time.
    So i have this eMac which has crashed and i have got may hands on another eMac.. and it works
    ... the only problem is.. I can take my eMac to the working eMac to do Target Mode or any thing...
    So Help me..
    My question is .. Is there a way to make a .DMG image file from pre installed mac osx OR
    Is there a way to may a recovery disc??

    You can use Carbon Copy Cloner to copy everything from the working eMac onto the non-working eMac while the working eMac is running. If your eMac will still do target mode into the working one, you can download the above software, select the booted drive as the source drive, and your eMac's drive as the target, however it is possible this will not work.
    When you say your eMac crashed, what exactly happened?  It is possible that the hard drive in your eMac failed or is failing, so in order to get it running again you would need to replace the hard drive.  On the eMac, this repair is somewhat involved, and you have to be very careful because it exposes the CRT, which has several areas which can be extremely dangerous to touch if not properly handled.  CRTs retain a great deal of voltage, even when unplugged, sometimes for weeks, and they can give you a nasty shock if you touch them in the wrong place.
    Also keep in mind that cloning from the working computer to the non-working computer will ERASE any data that you have stored on that eMac, so if you don't have it backed up anywhere, you may want to attempt that with target mode before proceeding.
    Good luck!

  • How to Copy an Image File from a Folder to another Folder

    i face the problem of copying an image file from a folder to another folder by coding. i not really know which method to use so i need some reference about it. hope to get reply soon, thx :)

    Try this code. Make an object of this class and call
    copyTo method.
    import java.io.*;
    import java.net.*;
    import java.util.*;
    public class FileUtil
    extends File {
    public FileUtil(String pathname) throws
    NullPointerException {
    super(pathname);
    public void copyTo(File dest) throws Exception {
    File parent = dest.getParentFile();
    parent.mkdirs();
    FileInputStream in = new FileInputStream(this); //
    Open the source file
    FileOutputStream out = new FileOutputStream(dest); //
    Open the destination file
    byte[] buffer = new byte[4096]; // Create an input
    buffer
    int bytes_read;
    while ( (bytes_read = in.read(buffer)) != -1) { //
    Keep reading until the end
    out.write(buffer, 0, bytes_read);
    in.close(); // Close the file
    out.close(); // Close the file
    This is poor object-oriented design. Use derivation only when you have to override methods -- this is just
    a static utility method hiding here.

Maybe you are looking for

  • Could someone help me figure out why after saving a form some subforms are hidden again

    I am asking this on behalf of a coworker.  We have a form she is working on with a drop down (ddlDropDown) with 1, 2, and 3 listed (same values,,1,2,3)  That trigger hidden subforms to appear (Employee1, Employee2, Employee3).  Initially, Employee1 i

  • Today, while working in Photoshop CC 2014

    I found that I couldn't change my file from 16 bit to 8 bit, even after flattening all the layers. I even saved the file as a jpeg and re-opened the file in Photoshop, and still couldn't change to 8 bit. Both Image mode and adjustment options are gra

  • Case When contruct in a trigger

    Hi gurus, I want to use the case when construct in a trigger instead of the regular select count(*) into statement to check the existence of a row but it does not work. I have used this extensively when I generate XML from many tables in a sproc and

  • Handling transactions from Tuxedo

    Hi!           I have a problem handling transactions within the WLS 8.1 when they are initiated from a Tuxedo-client.           I have an EJB handling a tuxedo call. If the caller has not begun a transaction, all works well, but if the caller starts

  • Menu Links Not Highlighting Completely Once Authored To Disc

    Hi,    I haven't been able to find anything answering this question as yet - apologies if it's something that's been covered already.. I'm using CS5, and I've gone via Dynamic Link to Encore.. All has been good - and it all looks sweet on the preview