Barcode Bakery Blog

Detailed Barcode Tutorials

Tag: size

Does barcode size matter?

Barcodes serve many purposes: from a QRCode advertisement on the side of a bus to an Intelligent Mail tracking barcode on an envelope. The size of the barcode will impact their utility greatly. Too small a barcode for an advertisement will go unnoticed and prove ineffective. Too large of a tracking barcode will leave little room for other important information like who the letter came from and who it is being sent to.

Function aside, these barcodes may involve very different methods for being scanned. One may target a consumer passing by with a smartphone, and the other may be interpreted using a handheld scanner. The size of the barcode will affect the readability between these two methods. Image-based readers that are installed on most smartphones will generally have no trouble as long as the barcode can be framed easily in the camera’s frame, but not microscopic.

For handheld LED style readers, there are generally specifications that should be followed to ensure readability. You can find these within the scanner’s manual which usually indicate a depth of field by a minimum barcode element width. This minimum element width corresponds to an individual bar within the barcode. These elements should be larger the further away your scanner is from the barcode. The depth of field refers to how far the scanner is from the barcode being scanned. Scanners have a limit this distance and if it is exceeded, they will not detect the barcode because it is not in its range. By adhering to the respective standards of your reader, you will be able to scan your barcodes with ease.

Another important consideration to bear in mind is that print quality can affect readability. You will need to verify that your printer is capable of printing at a small scale, should your project require it. This should be mentioned in the DPI (dots per inch) specifications that your printer manual provides. Inability to print smaller barcodes will appear as merged elements or unclear element boundaries. Definition in barcode elements is necessary for your reader to distinguish and interpret the data correctly.

The purpose of the barcode, distance of the scanner, and the print quality are factors that should be in mind when starting a project. There are many other considerations unrelated to size that must also be considered, such as the medium the barcode is printed on and its reflectivity. The process of finding the right barcode style to suit your needs is very much a trial-and-error process, but will prove to be much more profitable when the product is most suitable for its respective audience.

Adjusting the Height of a PDF417 Barcode

The latest edition of Barcode Generator includes functionality that will allow you to create PDF417 barcodes of different module heights. The documentation states that the row height should be 3 times bigger than the X-dimension (module width). However, some barcode readers can support reading smaller row heights. The larger of the two is the default and the suggested height, but it is possible to condense it if you so desire.

In order to do this, you will need to use the method setScaleY(1) within the BCGpdf417 class.

Recommended Size for PDF417 Barcodes

Recommended Size for PDF417 Barcodes

Condensed Size for PDF417 Barcodes

Condensed Size for PDF417 Barcodes

Scale vs DPI

Scale

Scale is the unit used when displaying an image on a computer screen, mobile phone, etc.

When setting the scale to 1, it represents the smallest unit that can be displayed on the screen. In 1D barcodes, this means each vertical black bar will be represented by a one pixel wide line. If you set a scale of 2, the vertical bar will be represented by a two pixel wide line, and so on.

This is the same concept for 2D barcodes: a black bit will be 1×1 pixels for scale of 1, and 2×2 pixels for scale of 2.

As you can see, it is not possible to choose a scale between 1 and 2 since a barcode cannot be written using 1.5 pixel sizes.

The size of the barcode itself will depend on the resolution and screen size of your user. For a same monitor size, if you compare a screen resolution of 1600×1200 and 800×600, the barcode will appear smaller to the eye on the first screen than the second.

This property can be set with the method “setScale(2)” from any barcodes.

As shown below, a larger scale will increase the size of the image displayed.

Scale 2 - DPI 72

Scale 2 – DPI 72

Scale 3 - DPI 72

Scale 3 – DPI 72

DPI (dot per inch)

This unit of scaling is for printing. This will tell your image how many “dots” (pixels) will be printed within one inch on paper. The default value is 72. The value usually used for printing is 300.

If you take two images with the same scaling (the images look exactly the same on the screen) but with a DPI of 72 and a DPI of 300, the first image will appear larger than the second one on paper. However, if your printer supports 300 DPI correctly, the second image will have a better quality than the first one.

This property can be set on the BCGDrawing object with “setDPI(300)”.

Two images of the same scale and different DPI’s will be displayed the same way on a screen:

Scale 3 - DPI 72

Scale 3 – DPI 72

Scale 3 - DPI 300

Scale 3 – DPI 300

Conclusion

If you plan to print your barcode, you must consider the setDPI() method. If you only display the image on the screen, then you would never need to use setDPI() and only the setScale() method.

If you want to have a bigger image than scale 1 but smaller than scale 2, you would need to resize the image with resampling. Doing so will introduce anti-aliasing in your image and possibly problems to read the barcode. Introducing anti-aliasing into an image means one bar for a 1D barcode will not be as clear as 1 pixel; it may be 1 pixel black, and 1 pixel gray.

If you still want to resize your barcode, you can use the method imagecopyresampled() from PHP by getting the image resource from the BCGDrawing with the method get_im().

© 2024 Barcode Bakery Blog

Theme by Anders NorenUp ↑