Hi,

I'm trying to generate a black and whit barcode graphic image in a servlet.
I'm using the com.sun.image.codec.jpeg.JPEGImageEncoder.
This works fine but I get pretty good barcodes.

However if I look very closely at the image there are a number of grey
dots in areas that should be white.

Should I be looking for another type of encoder?
Any help with this would be really appreciated.

regards

Graham

.. here's the guts of the code


protected void doGet(HttpServletRequest request, HttpServletResponse
response)
    throws ServletException, java.io.IOException {

    // Set the correct content type
    response.setContentType("image/jpeg");

    // get the output stream
    ServletOutputStream out = response.getOutputStream();

    // Create a new image object
    java.awt.image.BufferedImage image = new
BufferedImage(WIDTH,HEIGHT,BufferedImage.TYPE_INT_RGB);

    // Get a Graphics object we can draw into
    java.awt.Graphics g = image.getGraphics();

    ////
    //  Draw the barcode using the Graphics object
    ////

    // Create the encoder on our output stream
    JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);

    // pump out our image
    encoder.encode(image);

    // we're done
    out.close();
}

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to