How to convert a 16-bit image to 8-bit

I am having difficulties in skeletonizing my image. Although I already threshold my image, it still cannot be skeletonized. When I create the image using IMAQ create, the image type must be set to 16-bit, otherwise it will create an error message. An enthusiast in the forum told me that the image must be 8-bit so that it can be skeletonized. But I do not know how to convert the image from 16-bit to 8-bit. So is there anybody out there that can provide me with a solution. Attached is the VI that I used. Really appreciate your help.
Attachments:
Image_Acquisition.vi ‏68 KB

Try using the IMAQ Cast Image function under Motion & Vision>>Vision Utilities>>Image Management>>IMAQ Cast Image.
Regards,
Steve

Similar Messages

  • How to convert Doc file into image

    hello frnds
                     Can any body guide me how to convert doc file into image and show into swf loader.
    actually i have to convert doc files into swf files in runtime so that i have to use this flow.
    is it possible to convert doc file into byte array and than convert into image.
    Thanks And Regards
        Vineet Osho

    You can convert any DisplayObject to byeArray using this function ImageSnapshot.captureBitmapData().getPixels()

  • HOW TO CONVERT RAW FILES TO JPEG RGB 8 BIT in iphoto

    Can someone please tell me how to convert RAW files to jpeg RGB 8 bit in iphoto on an iMac?

    How are you trying to "export to Mypics"? The only way to get a Raw out of iPhoto is to export with the Kind set to Original.
    Regards
    TD

  • Need conversion mechanism for converting 24 bit image to 16 bit

    In my java project I need to convert 24 bit image to 16 bit image. I don't have any clue. Please provide me the option to implement it.
    Thanks,
    jai

    That doesn't tell me much, and I know what you're talking about. I doubt that it tells the OP anything useful whatsoever.Sorry EJP, it was a mouthful I know. Maybe this will help instead, a ColorConversionOps class to work on *32 bit > 16 bit > 32 bit colors*. To help clarify where the 16 bit color input and output goes, some of the methods return or require parameters of type short. Also take notice the bitmask for variables of type short vs the bitmasks for int. AND pay particular attention to the unsigned right bit-shifting of the most-significant-digit.
    public class ColorConversionOps
      public static short convert32_16(int rgb) {
        int a = ((rgb & 0xF0000000) >>> 16);
        int r = ((rgb & 0x00F00000) >>  12);
        int g = ((rgb & 0x0000F000) >>   8);
        int b = ((rgb & 0x000000F0) >>   4);
        return (short)( a | r | g | b);
      public static int convert16_32(short rgb) {
        int a = ((rgb & 0xF000) << 16);
        int r = ((rgb & 0x0F00) << 12);
        int g = ((rgb & 0x00F0) <<  8);
        int b = ((rgb & 0x000F) <<  4);
        return (a | r | g | b);
      public static void printRGB_32(int rgb) {
        System.out.println("a="+((rgb & 0xFF000000) >>> 24));
        System.out.println("r="+((rgb & 0x00FF0000) >>  16));
        System.out.println("g="+((rgb & 0x0000FF00) >>  8));
        System.out.println("b="+ (rgb & 0x000000FF));
        System.out.println();
      public static void printRGB_16(short rgb) {
        System.out.println("a="+((rgb & 0xF000) >>> 12));
        System.out.println("r="+((rgb & 0x0F00) >>  8));
        System.out.println("g="+((rgb & 0x00F0) >>  4));
        System.out.println("b="+ (rgb & 0x000F));
        System.out.println();
    }Now to make the conversion from 32 bit color to 16 bit color and back. NOTICE there willl be a loss of precision -- just like someone else has already said.
    public class Test
      public static void main(String[] args)
        int rgb = 0xFFFFFFFF;
        ColorConversionOps.printRGB_32(rgb);
        //a=255
        //r=255
        //g=255
        //b=255
        rgb = ColorConversionOps.convert32_16(rgb);
        ColorConversionOps.printRGB_16((short)rgb);
        //a=15
        //r=15
        //g=15
        //b=15
        rgb = ColorConversionOps.convert16_32((short)rgb);
        ColorConversionOps.printRGB_32(rgb);
        //a=240
        //r=240
        //g=240
        //b=240
    }And now we see, the reason 16bit color is so unpopular to the rest of the world, but not for us here!

  • Can PSE8 for mac convert an 8 bit image to 16 bit?

    can Photoshop Elements 8 for mac convert an 8 bit image to 16 bit?
    I use Photomatix Pro and when I am working with a single image in Photomatix Pro, it has to be 16 bit.

    Yes, you can. These are the steps when using the elements editor.
    Depending on the file format:
    1. If this file is from a camera raw file, simply open the original
        raw file and at the bottom of the camera raw dialog choose 16 bits.
        This would open the file in pse editor as a 16 bit file.
        Then save as a tif file with no compression.
    2. If the file is a jpg or tif file, in the pse editor select: File>Open As>Camera Raw.
        This will open the file in the camera raw dialog. Then select 16 bit from the menu
        at the bottom of the camera raw dialog. After the file opens in pse editor, in 16 bits,
        save as a tif with no compression.
    3. If the file is a psd file with no layers, then step 2 will work. If the psd file has layers,
        open the the file in pse editor and resave the file using maximize compatibilty.
        This will allow the psd file to have both layers and open in the camera raw dialog as
        in step 2. When you open the file in the pse editor, it will just be a single layer and then
        just save as a tif file with no compression.
    Hope this helps.
    MTSTUNER

  • How to convert a jpeg file into a 1-bit bmp file (2 colors image)

    Hi. I�m having serious problems to convert a jpeg file into a 1-bit bmp file (2 colors image).
    I�m using FileSaver.saveAsBmp(String t) but what i get is a bmp image, but with 16M colors, but what i want is a 2 colors bmp file. A black and white image.
    Does anybody know how to do this? I�m really getting crazy with ths problem.
    Thanks in advance

    Hi opalo,
    this code may help you...
    import java.awt.*;
    import java.io.*;
    import java.awt.image.*;
    import javax.imageio.ImageIO;
    class Write1 extends Component {
    //--- Private constants
    private final static int BITMAPFILEHEADER_SIZE = 14;
    private final static int BITMAPINFOHEADER_SIZE = 40;
    //--- Private variable declaration
    //--- Bitmap file header
    private byte bitmapFileHeader [] = new byte [14];
    private byte bfType [] = {'B', 'M'};
    private int bfSize = 0;
    private int bfReserved1 = 0;
    private int bfReserved2 = 0;
    private int bfOffBits = BITMAPFILEHEADER_SIZE + BITMAPINFOHEADER_SIZE;
    //--- Bitmap info header
    private byte bitmapInfoHeader [] = new byte [40];
    private int biSize = BITMAPINFOHEADER_SIZE;
    private int biWidth = 50;
    private int biHeight = 70;
    private int biPlanes = 1;
    //private int biBitCount = 24;
    private int biBitCount = 1;
    private int biCompression = 0;
    private int biSizeImage = 0x030000;
    private int biXPelsPerMeter = 0x0;
    private int biYPelsPerMeter = 0x0;
    private int biClrUsed = 0;
    private int biClrImportant = 0;
    //--- Bitmap raw data
    private int bitmap [];
    //--- File section
    private FileOutputStream fo;
    //--- Default constructor
    public Write1() {
    public void saveBitmap (String parFilename, Image parImage, int
    parWidth, int parHeight) {
    try {
    fo = new FileOutputStream (parFilename);
    save (parImage, parWidth, parHeight);
    fo.close ();
    catch (Exception saveEx) {
    saveEx.printStackTrace ();
    * The saveMethod is the main method of the process. This method
    * will call the convertImage method to convert the memory image to
    * a byte array; method writeBitmapFileHeader creates and writes
    * the bitmap file header; writeBitmapInfoHeader creates the
    * information header; and writeBitmap writes the image.
    private void save (Image parImage, int parWidth, int parHeight) {
    try {
    convertImage (parImage, parWidth, parHeight);
    writeBitmapFileHeader ();
    writeBitmapInfoHeader ();
    writeBitmap ();
    catch (Exception saveEx) {
    saveEx.printStackTrace ();
    * convertImage converts the memory image to the bitmap format (BRG).
    * It also computes some information for the bitmap info header.
    private boolean convertImage (Image parImage, int parWidth, int parHeight) {
    int pad;
    bitmap = new int [parWidth * parHeight];
    PixelGrabber pg = new PixelGrabber (parImage, 0, 0, parWidth, parHeight,
    bitmap, 0, parWidth);
    try {
    pg.grabPixels ();
    catch (InterruptedException e) {
    e.printStackTrace ();
    return (false);
    pad = (4 - ((parWidth * 3) % 4)) * parHeight;
    biSizeImage = ((parWidth * parHeight) * 3) + pad;
    bfSize = biSizeImage + BITMAPFILEHEADER_SIZE +
    BITMAPINFOHEADER_SIZE;
    biWidth = parWidth;
    biHeight = parHeight;
    return (true);
    * writeBitmap converts the image returned from the pixel grabber to
    * the format required. Remember: scan lines are inverted in
    * a bitmap file!
    * Each scan line must be padded to an even 4-byte boundary.
    private void writeBitmap () {
    int size;
    int value;
    int j;
    int i;
    int rowCount;
    int rowIndex;
    int lastRowIndex;
    int pad;
    int padCount;
    byte rgb [] = new byte [3];
    size = (biWidth * biHeight) - 1;
    pad = 4 - ((biWidth * 3) % 4);
    if (pad == 4) // <==== Bug correction
    pad = 0; // <==== Bug correction
    rowCount = 1;
    padCount = 0;
    rowIndex = size - biWidth;
    lastRowIndex = rowIndex;
    try {
    for (j = 0; j < size; j++) {
    value = bitmap [rowIndex];
    rgb [0] = (byte) (value & 0xFF);
    rgb [1] = (byte) ((value >> 8) & 0xFF);
    rgb [2] = (byte) ((value >> 16) & 0xFF);
    fo.write (rgb);
    if (rowCount == biWidth) {
    padCount += pad;
    for (i = 1; i <= pad; i++) {
    fo.write (0x00);
    int b = 1200;
    fo.write(b);
    rowCount = 1;
    rowIndex = lastRowIndex - biWidth;
    lastRowIndex = rowIndex;
    else
    rowCount++;
    rowIndex++;
    //--- Update the size of the file
    bfSize += padCount - pad;
    biSizeImage += padCount - pad;
    catch (Exception wb) {
    wb.printStackTrace ();
    * writeBitmapFileHeader writes the bitmap file header to the file.
    private void writeBitmapFileHeader () {
    try {
    fo.write (bfType);
    fo.write (intToDWord (bfSize));
    fo.write (intToWord (bfReserved1));
    fo.write (intToWord (bfReserved2));
    fo.write (intToDWord (bfOffBits));
    catch (Exception wbfh) {
    wbfh.printStackTrace ();
    * writeBitmapInfoHeader writes the bitmap information header
    * to the file.
    private void writeBitmapInfoHeader () {
    try {
    fo.write (intToDWord (biSize));
    fo.write (intToDWord (biWidth));
    fo.write (intToDWord (biHeight));
    fo.write (intToWord (biPlanes));
    fo.write (intToWord (biBitCount));
    fo.write (intToDWord (biCompression));
    fo.write (intToDWord (biSizeImage));
    fo.write (intToDWord (biXPelsPerMeter));
    fo.write (intToDWord (biYPelsPerMeter));
    fo.write (intToDWord (biClrUsed));
    fo.write (intToDWord (biClrImportant));
    // DataOutputStream temp = new DataOutputStream(fo);
    // int m = 32;
    // temp.writeInt(m);
    catch (Exception wbih) {
    wbih.printStackTrace ();
    * intToWord converts an int to a word, where the return
    * value is stored in a 2-byte array.
    private byte [] intToWord (int parValue) {
    byte retValue [] = new byte [2];
    retValue [0] = (byte) (parValue & 0x00FF);
    retValue [1] = (byte) ((parValue >> 8) & 0x00FF);
    return (retValue);
    * intToDWord converts an int to a double word, where the return
    * value is stored in a 4-byte array.
    private byte [] intToDWord (int parValue) {
    byte retValue [] = new byte [4];
    retValue [0] = (byte) (parValue & 0x00FF);
    retValue [1] = (byte) ((parValue >> 8) & 0x000000FF);
    retValue [2] = (byte) ((parValue >> 16) & 0x000000FF);
    retValue [3] = (byte) ((parValue >> 24) & 0x000000FF);
    return (retValue);
    class Writebmp
         public static void main(String args[])
              //Image img = Toolkit.getDefaultToolkit().getImage("jatin.bmp");
              try
              File filename = new File("jatin_test.bmp");
              BufferedImage image = ImageIO.read(filename);
              Graphics graphics = image.getGraphics();
              graphics.drawString("&#2313;&#2332;&#2327;&#2352;",10,30);
              Write1 w = new Write1();
              Image img = Toolkit.getDefaultToolkit().getImage("jatin_test.bmp");
              w.saveBitmap("jatin_test.bmp",img,200,200);
              catch (IOException e)
    System.err.println ("Unable to write to file");
    System.exit(-1);
    }

  • Quicktime converting 24 bit images to 16 bit images on paste

    I am doing image processing of a QuickTime (7.1.5 pro) movie in Photoshop (CS2) using Applescript. When I copy an image (either with Applescript or manually) and paste it into a new QuickTime Player movie the image gets converted to a video depth of 16 (thousands) rather than 24. I have tried:
    set DestMovie to make new movie with properties {data rate:SourceRate, video depth:24, high quality:true} -- I also tried video depth:0
    paste
    I also try:
    tell movie 1
    paste given video depth:24 -- I've also tried just paste
    end tell
    and still it converts my images to thousands. The image gets to photoshop perfectly. If I paste it into a Pages document the image depth is correct. I have tried both RGB and CMYK in 8 and 16 bit depths in Photoshop. If I save the file as JPEG in high quality mode and then open the file with Quicktime and copy and paste it, it works great, the only problem is I then have to make a new file for every image I process because if I close the file, QuickTime keeps it open so Photoshop can't then save to the same file.....
    Will someone please help me figure out how to keep my image quality on pasting into Quicktime???
    Thanks
    Powerbook G4   Mac OS X (10.4.9)  

    I open my original movie in Quicktime. I make a new movie in Quicktime for the modified images to be pasted into.
    I copy the current frame from my source movie and paste it into Photoshop. I do my image processing and then save as a jpeg high quality and close my file (which strips out the audio from a muxed mpeg-1 file) then reopen the file in Photoshop. Now I have a good quality image in Photoshop. I have been using RGB 8 bit as my mode in Photoshop. I only tried CMYK to see if it would work better. It was exactly the same.
    I then do a select all and copy in Photoshop, then go to Quicktime and do a paste. This is when it gets converted to 16 bit depth. If I do the same exact sequence and paste into a Pages document the image stays 24 bit, so I am pretty sure it is something in Quicktime.
    Again, if I save the file in Photoshop and then open the same file in Quicktime, copy the image and then paste it into my destination movie, it works great. The only problem with this method is I have 15 minutes of video to process with is 27,000 jpeg files in the end. I prefer to use one file if I can. The reason for the 27,000 files is that when I open an image in Quicktime and paste it into a movie, it saves it as a track in the movie and even when I close the original file, Quicktime keeps it as in use. When I look at the movie properties, it keeps the original file in the list until I do a save as movie and it flattens the movie. If I flatten the movie once, then when I do another save, it keeps the original file open again. I would have to do a save as movie... again 27,000 movie files now. Geez...
    Thanks!

  • How to convert a folder of images to a Collection?

    Ques 1
    How do I convert a folder of images that has been sorted, files rejected, files hidden, and so on, to a Collection? When I create a New Collection and drag the images across from the folder, all editing is lost and the images appear in alphabetical order. I'm using CS6.
    Ques 2
    What is the location of the file that contains the sorted/rejected/hidden data for a folder?

    A Collection is just a saved search.  It does not contain any images.
    Wonder why your question went unanswered for so long?
    BOILERPLATE TEXT:
    Note that this is boilerplate text.
    If you give complete and detailed information about your setup and the issue at hand,
    such as your platform (Mac or Win),
    exact versions of your OS, of Photoshop (not just "CS6", but something like CS6v.13.0.6) and of Bridge,
    your settings in Photoshop > Preference > Performance
    the type of file you were working on,
    machine specs, such as total installed RAM, scratch file HDs, total available HD space, video card specs, including total VRAM installed,
    what troubleshooting steps you have taken so far,
    what error message(s) you receive,
    if having issues opening raw files also the exact camera make and model that generated them,
    if you're having printing issues, indicate the exact make and model of your printer, paper size, image dimensions in pixels (so many pixels wide by so many pixels high). if going through a RIP, specify that too.
    A screen shot of your settings or of the image could be very helpful too,
    etc.,
    someone may be able to help you (not necessarily this poster, who is not a Windows user).
    Please read this FAQ for advice on how to ask your questions correctly for quicker and better answers:
    http://forums.adobe.com/thread/419981?tstart=0
    Thanks!

  • How to convert HTML text to image

    Hi all!
    I&acute;m having this problem: I have a html code (dynamic generated) and I need to convert it to a image, any idea how to do that?
    Thanks, J.

    Im no Java2D expert but if you want the actual code as an image couldnt you just use 'drawString("<br>", x, y)' to display it and then allow it to be saved as an image, I know theres built in capability in Java to import/export common image formats. Or do you mean you want what the html actually produces as an image?
    Ken

  • Convert 256-bit image to one-bit

    I want to convert 256-bit bmp image to 1-bit.So please help me.

    armalcolm wrote:
    OK here's a frameworkUmm... Drawing onto a BI of TYPE_BYTE_BINARY should achieve this in just a few lines. The API says
    When color data is stored in an image of this type, the closest color in the colormap is determined by the IndexColorModel and the resulting index is stored. Approximation and loss of alpha or color components can result, depending on the colors in the IndexColorModel colormap.
    Of course, if this is homework then OP will probably be required to reinvent the wheel.
    db

  • How to convert BufferedImage back to Image

    I have an Image from ImageIcon and i want to cut it using BufferedImage.getSubImage(...) and now from BufferedImage i want to turn it to Image again so that i can put in ImageIcon.
    Here is my code:
    URL img = new URL(location);
    ImageIcon imgIcon = new ImageIcon(img);
    Image image = imgIcon.getImage();
    //turn image into bufferedImage via graphic draw
    BufferedImage bi = new BufferedImage(..);
    Graphics g = bi.createGraphics();
    g.drawImage(image,0,0,null);
    bi.getSubImage(...);
    // how to turn bi back to Image newImage
    any ideas??

    More correctly, BufferedImage extends Image as Image is an abstract class and not an interface.
    Shaun

  • How to convert color of bitmap image?

    I am programming with Acrobat 7.
    I'd like to change color of all object to CMYK color or gray.
    In case of plain object like path or font,
    I need to seek CMYK color from the object's RGB color.
    and I change the property of the object color space and value with it.
    but in case of bitmap image, i don't know how to at all.
    it has numerous colors.
    I hope your advice.

    Thank you both of you.
    by the way, Leonard, Could you tell me that APIs more detailly?
    I have look into the document for long time. it is still hard to find proper API.
    I have to say this again. I am trying to find APIs based on version 7.
    I am using custom function ACEconvertColorProfile which is placed in snippetrunner. it consists of these APIS ACMakeColorTransform, ACApplyTransform, and so on.
    but I can't find the way to convert bitmaps once and for all.
    I hope you give more hint.
    Thanks again.

  • How to Convert FLIR Gray Scale Image to a Temperatur​e Map in NI VBAI

    I have been working with a FLIR A315 Infra-Red camera and NI's VBAI software.  I need to determine the presence and continuity of a hot mastic foam that has been injected into the hollow bulb of a rubber weatherstrip seal in 4 adjacent locations that flow together inside the weatherstrip bulb to form a continuous foamed mastic plug.
    So far, I have been able to trigger image acquistions in VBAI from a FLIR IR camera by monitoring an Allen-Bradley PLC's status bit.   The communication with the FLIR A315 camera is via the IMAQdx GigE driver.  However, I haven't figured out how to detemine the temperatures from the gray scale images I receive from the FLIR camera.  I wonder if someone could give me some pointers on how to do this.
    I have attached some images below to illustrate what I am working with and how far I've gotten.
    iPhone_Photo.jpg - shows a photograph of the weatherstrip section that the FLIR IR camera is "looking" at.
    FLIR_IR_Monitor.jpg - a screen capture of a FLIR IR monitor utility that shows temperatures measured at a number of points and areas (showing it can be done)
    NI_VBAI.jpg - part of my VBAI 2010 project which shows the image I've acquired from the FLIR A315 IR Camera
    So, I am part of the way there, but so far have not found a way to map the gray scale image that VBAI is acquiring from the FLIR IR camera into a heat map from which I can determine temperatures - and would appreciate some help on how to do this.
    Kind regards,
    Nick
    Solved!
    Go to Solution.
    Attachments:
    iPhone_Photo.jpg ‏239 KB
    FLIR_IR_Monitor.jpg ‏113 KB
    NI_VBAI.jpg ‏205 KB

    Hello,
    Image provided by FLIR camera are unsigned 16bit.
    Depending on the FLIR temperature scale you selected (10mK or 100mK), you will have to divide by a 10 or 100 factor to get K values. Don't select radiometric output.
    So if your object is cold, the population of the histogram of your image will be on the left part of it and if the object is hot, the population of the histogram will be on the right part.
    If you want your temperature values in Celcius, just add 273,15 to the Kelvin Value.
    Then you can add a color palette in VBAI (FLIR iron is available)
    Hope this helps

  • How to convert simple text to image

    Hi,
    I needed to secure web form from automated form submission. Looking into some common website, they use image displaying random text, which is only readable by user. So the automated form submission can be avoided.
    I checked through lot of forum, but could not find help in doing it using java. So is there something in java api using which i can generate image of fly for each request by passing some random generated text of about 5-6 character length.
    Any help on this would be appreciated...
    Thanks,
    Naresh

    hi ican convert image ti html
    coding---------------
    import java.awt.*;
    import java.awt.image.*;
    import java.io.*;
    import java.awt.event.*;
    public class img2html extends Frame
         static Image im=null;
         static int W=-1,H=-1;
         public img2html()     {}
         public static void main(String args[])
              String infile,outfile;
              infile="c:\\micky.jpg";
              outfile="c:\\micky.html";
              boolean paramsOK=false,mode=false;
              //if (args.length <= 1) {
              //     usage();
              //     paramsOK=false;
         //     if (args.length == 2) {
              //     infile = args[0];
              //     outfile = args[1];
                   paramsOK=true;
              if (paramsOK) {
                   //System.out.println("img2html :");
                   System.out.println(" image file " + infile);
                   System.out.println(" data file " + outfile);
                   img2html widow = new img2html();
                   System.out.println("img2html : Loading image file");
                   if (widow.processFile(infile)==false) {
                        System.exit(0);
                   //System.out.println("img2html : Saving data file");
                   saveByteData(outfile,mode);
                   System.exit(0);
         public static void saveByteData(String fn,boolean i)
              int[] grabMapXY;
              grabMapXY          =      new int[(W * H)];
              int pix;
              PixelGrabber pg = new PixelGrabber(im,0,0,W,H,grabMapXY,0,W);                
    //     PixelGrabber pg =
    // new PixelGrabber(image, 0, 0, -1, -1, false);
              // start grab
              try {
                   pg.grabPixels();
              } catch (InterruptedException e) {
                   System.out.println("Map grab failed : " + e);
                   return;
              if ((pg.status() & ImageObserver.ABORT) != 0) {
                   System.out.println("Map grab failed !");
                   return;
              // need to base r on number of valid pixels
              writeToFn(fn,"<HTML>");
              writeToFn(fn,"");
              writeToFn(fn,"<BODY>");
              writeToFn(fn,"");
              writeToFn(fn,"<TABLE border=0 cellspacing=0 cellpadding=0>");
              int red,green,blue,p;
              String r,g,b;
              Color c;
              for (int y =0; y < H; y++) {     
                   writeToFn(fn," <TR>");
                   for (int x =0; x < W; x++) {
                        pix=grabMapXY[ y * W + x ];
                        c = new Color(pix);
                        red=c.getRed();
                        blue=c.getBlue();
                        green=c.getGreen();
                        r=Integer.toHexString(red);
                        g=Integer.toHexString(green);
                        b=Integer.toHexString(blue);
                        if (r.length()==1) { r="0"+r; }
                        if (g.length()==1) { g="0"+g; }
                        if (b.length()==1) { b="0"+b; }
                        writeToFn(fn," <TD WIDTH=1 HEIGHT=1 BGCOLOR=#" + r + g + b + ">", " " + x + "," + y + " - of - " + W + "," + H);
                        writeToFn(fn," </TD>");
                   writeToFn(fn," </TR>");
              writeToFn(fn,"");
              writeToFn(fn,"</TABLE>");
              writeToFn(fn,"");
              writeToFn(fn,"</BODY>");
              writeToFn(fn,"</HTML>");
         public static void writeToFn(String fn,String Dbytes,String status) {
              try {
                   //System.out.println(Dbytes + " pixel " + status);
                   DataOutputStream dos = new DataOutputStream( new FileOutputStream(fn,true));
                   dos.writeBytes(Dbytes); //
                   dos.writeByte(13); // line feed for each line
              dos.writeByte(10); // line feed for each line
                   // close here
                   dos.close();
              } catch (IOException e) {
                   System.err.println("File error: " + e.getMessage());
         public static void writeToFn(String fn,String Dbytes) {
              try {
                   //System.out.println(Dbytes );
                   DataOutputStream dos = new DataOutputStream( new FileOutputStream(fn,true));
                   dos.writeBytes(Dbytes); //
                   dos.writeByte(13); // line feed for each line
              dos.writeByte(10); // line feed for each line
                   // close here
                   dos.close();
              } catch (IOException e) {
                   System.err.println("File error: " + e.getMessage());
         public boolean processFile(String fn)
              boolean OK=false;
              int exitcounter;
              try {
                   im = getToolkit().getImage(fn);
              catch (Exception e)
                   System.out.println("1HOLY MOLY THIS NEVER HAPPENS!!!! "+e);
              MediaTracker tracker= new MediaTracker(this);
              tracker.addImage(im,0);
              try {
                   tracker.waitForID(0);
              catch (InterruptedException e)
                   System.out.println("2HOLY MOLY THIS NEVER HAPPENS "+e);
              if (tracker.isErrorID(0)) {
                   System.out.println("IMAGE FILE COULD NOT BE LOADED");
                   System.out.println(fn);
              } else {
                   exitcounter=0;
                   while ( ((W==-1)||(H==-1)) && (exitcounter<=16000000) )
                        W=im.getWidth(null);
                        H=im.getHeight(null);
                        exitcounter++;
                   if (exitcounter>15999999)
                        System.out.println("Timeout attempting to load image, is it to big?");
                   else
                        OK=true;
              return(OK);
         public static void usage() {
              //System.out.println("Usage:");
              //System.out.println("java img2html infile outfile ");
              //System.out.println(" infile : image file .gif ");
              //System.out.println(" outfile : html file to be created");
              //System.out.println(" /i : Inverse data ");
    }     // end of class

  • How To Convert Multi Page Tiff Image Through open office in application

    I will Appreciate Any Effort Or Reply Which Can Tell Me , To convert a multi-page tiff image in pdf format in application i.e not on desktop using simple open -office but through coding. I doubt if there Exists Ny Plugin Or Separate Library Which Can Do Tht.  Code Or Library inJava Language will Be Preferable

    Your question does not make any sense. First, PDF does not support multi-page TIFFs. DO you have a PDF that you are trying to convert to WORD or what. It is unclear of what you are starting with and what your end goal is. If you are dealing with coding, you may need to check the SDK forum, but trying to understand what you are trying to do would be a good idea first.

Maybe you are looking for

  • I need help getting my P965 Platinum board to work

    ok, I've tried researching it and searching the forums but I'm still having a lot of trouble and it's all a tad bit confusing. I've finally gotten all the stuff hooked up but I've run into trouble. My dvd drive and hard drive are both IDE and they ar

  • What is a "Abstract Interface" ?

    According to JavaDoc, <code>HttpSession</code> is described as public abstract interface HttpSession. What is an "abstract interface" ?

  • Trying to understand Keychain in iCloud setup

    Trying to get this figured out. I want to set up Keychain in iCloud, but since my Mac Pro is too old and not the corret firmware to upgrade to Mavericks and I just have the recently purchased iPhone 5S I tried the code. For example 1234, used on the

  • Help Apache not working since 10.4.10 upgrade

    Hello I have web sharing turned on and I run a small web page on my mac to host photos and such. It was working great until I upgraded to 10.4.10. Now nothing will connect to my web server at all. I have a power PC mac. When I turn on web sharing on

  • Unable to write data into excel file when it's close

    Hi, I'm facing this problem and it's a bit weird. I'm using the following method to insert data into excel file. But when excel file is close, it unable to write data into the excel sheet. But it was able to write the data into the excel sheet if i o