Results 1 to 5 of 5

Thread: PPM in Java

  1. #1
    l426 is offline Member
    Join Date
    Mar 2009
    Posts
    1
    Rep Power
    0

    Default PPM in Java

    Hello!
    I would like just know how to work with ppm (portable pixmap) files. Do you know any exemplary codes?
    Thank you in advence and have a nice day.
    Last edited by l426; 03-30-2009 at 11:30 AM.

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,236
    Rep Power
    19

    Default

    Just another cross poster.
    Java Programming - PPM in Java

    db

  3. #3
    bouchnak is offline Member
    Join Date
    Apr 2009
    Posts
    3
    Rep Power
    0

    Default image processing

    now i'm doing my project .I need a help about displaying a ppm file from array of pixels values please can someone help me and thanks for all java forums member :cool::cool:

  4. #4
    OrangeDog's Avatar
    OrangeDog is offline Senior Member
    Join Date
    Jan 2009
    Location
    Cambridge, UK
    Posts
    838
    Rep Power
    6

    Default

    Don't forget to mark threads as [SOLVED] and give reps to helpful posts.
    How To Ask Questions The Smart Way

  5. #5
    kevinpeter Guest

    Default

    private BufferedImage parsePPM() throws IOException, PPMDecoderException {
    BufferedImage img =
    new BufferedImage(width, height, BufferedImage.TYPE_3BYTE_BGR);
    WritableRaster raster = img.getRaster();
    for (int y = 0; y < height; ++y)
    for (int x = 0; x < width; ++x)
    for (int i = 0; i < 3; ++i) {
    parser.nextToken();
    if (parser.ttype == StreamTokenizer.TT_EOF)
    throw new EOFException("image appears to be truncated");
    if (parser.ttype != StreamTokenizer.TT_NUMBER)
    throw new PPMDecoderException("non-numeric value for sample "
    + i + " of pixel at (" + x + "," + y + ")");
    raster.setSample(x, y, i, (int) parser.nval);
    }
    return img;

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •