#7 3rd party vendor not reading barcode

R. Seifert


We have been using barcodefj in combination with
tasman barcode reader very successfully for a while

We have now encountered a 3rd party vendor that needs
to read our barcode tif images and cannot. Tasman
reads the barcode tif images fine. We are trying
either code128 or code39.

As a test, if we open up the tiff created in
barcode4j in adobe acrobat and/or ms document imaging
and re-save it as a tif, their software reads it.
The re-save almost doubles the file size of the image.

This indicates to me that the barcode is fine but
something about the file format itself is not
friendly to their reader.

We have attempted to get a spec of the format they
want but they cannot produce one.

Are there any parameters in barcode4j that would
change how it is being to saved to compensate for the
above issue.

I thank anyone in advance for any information that
would push is in the right direction.

-Rodney Seifert


  • Logged In: YES

    Unfortunately, you didn't say how you create the barcodes
    (command-line or from Java). Anyway, the bitmap formats can
    be generated as grayscale images
    (BufferedImage.TYPE_BYTE_GRAY) and monochrome (1-bit,
    BufferedImage.TYPE_BYTE_BINARY) images. You should find out
    if either of the two works. Other than that, there's not
    much you can do. The TIFF images get created without any
    compression so that can't be the problem. I have no trouble
    opening both TIFF variants (gray and b/w) in a number of
    bitmap editors. So if that 3rd party tool can't open the
    images I really can't help.

    • status: open --> closed
  • R. Seifert
    R. Seifert

    Logged In: YES

    Thank you for the Prompt response. I apologize for not
    providing enough information.

    We are using java to generate the barcodes. I will attach
    the code here.

    I have tried both of the grayscale options you mentioned
    and it could not read either.

    It must have something to do with the file type not the
    barcode image itself. I will also attach here a before
    and after tif. The before was created using the java code
    atttached and cannot be read by the 3rd party. The After
    tif version was created by re-saving the before using MS
    document imaging tool.

    Can any info be gained from the differences in the 2 tifs
    that could be controlled by barcode4j or the way we are
    using java's bitmap encoder?

    Sample files will be included in one zip file.

    Thank you again for your prompt attention!

    Rodney Seifert

  • R. Seifert
    R. Seifert

  • R. Seifert
    R. Seifert

    Logged In: YES

    Zip File for the previous followup.

  • Logged In: YES

    Good thinking, attaching the two bitmaps here. It seems
    weird that this software is not capable of loading an
    uncompressed TIFF but is perfectly able to decode a CCITT4
    compressed TIFF (both 1bit b/w). That's the main difference
    I can make out. Note that when I implemented the bitmap
    output I didn't test TIFF specifically. I'm just allowing
    the used of MIME types to access further image codecs. For
    JPEG I had to add some special code. It looks like this
    might be necessary in your case, too. I can suggest three
    - Try to work with PNG instead of TIFF if possible.
    - Modify ImageIOBitmapEncoder.java to do special handling
    for TIFF images. You may need to look up the documentation
    on how to enable CCITT4 compression. I can't help you here
    as I've never used that part. Also have a look at the
    resolution setting. Barcode4J seems to set the resolution at
    1dpi which is odd, especially since there's code to properly
    set the resolution. But it didn't work for JPEG, either.
    Image I/O, from my experience, is horribly implemented and
    full of bugs. Only the concept is good. Sigh. If you get it
    running, please send my your changes. I will try to
    incorporate them into the codebase.
    - It may make sense to create a new BitmapEncoder
    implementation that uses JAI or JIMI to write TIFF images.
    Maybe that works better. New BitmapEncoder implementations
    will have to be registered with the BitmapEncoderRegistry.

    Good luck!