snipe / snipe-it

A free open source IT asset/license management system
https://snipeitapp.com
GNU Affero General Public License v3.0
11.01k stars 3.18k forks source link

non-QR Barcodes on lables not scannable #3425

Closed leobg closed 6 years ago

leobg commented 7 years ago

Expected Behavior (or desired behavior if a feature request)

non-QR barcodes to be generated in black and white (no gray scale gradations just like QR codes)

Actual Behavior

non-QR (C39/C128....) barcode lines are not sharp (instead B/W it uses gray scale/smudging) which makes them pretty much non-scannable. QR codes are OK.


Please confirm you have done the following before posting your bug report:


Please provide answers to these questions before posting your bug report:

Jason-Weber-UC commented 7 years ago

I can confirm this; arguing with the same issue myself

Jason-Weber-UC commented 7 years ago

I can also confirm that switching from GD to imagemagick makes no difference. And neither does turning the printer up to super-uber-fine quality

snipe commented 7 years ago

Can you show me an example of an affected barcode?

snipe commented 7 years ago

(We are able to scan the barcodes on the demo, using a bluetooth barcoce scanner, so we cannot really reproduce this issue.)

i5rov commented 7 years ago

If you print it on a label most scanners won't read it.

Jason-Weber-UC commented 7 years ago

Admittedly I'm currently printing to a laser printer; still waiting for my proper label printer to arrive. Am about to try printing to a normal Dymo label printer in a little while. Once ive done that, I'll try and post up some sample, although it's hard when its on paper :)

leobg commented 7 years ago

As I reported originally, QR codes look and work perfect. Non-QR codes are generated with grayscale gradations which makes print output especially on a low resolution bar code printer looking fuzzy and unreadable by a common barcode scanner (such as older Motorola symbols). I ended up generating the labels in dedicated barcode software until snipeit is fixed.

snipe commented 7 years ago

This may sound dumb, but maybe post a photo of the printed result? Every time we modify the barcodes, we print out several pages of them and make sure that they still scan properly, so it's hard for me to reproduce this. (Our printer is nothing fancy, B&W HP Laserjet P 1102W.)

Jason-Weber-UC commented 7 years ago

I gotta say, it looks fine, but zooming on the photos it does kinda look fuzzy. I should also point out that the scanner works fine on any other barcode I can find kicking around my office.

20170510_143012

Jason-Weber-UC commented 7 years ago

Just for giggles, I tried from Safari (instead of FFox), thinking it may be the browsers print engine - nada.

Jason-Weber-UC commented 7 years ago

if its helpful; its running on a Debian 8 server. Installed using install.sh Attached is the phpinfo (its not publicly accessible.) phpinfo.pdf

Jason-Weber-UC commented 7 years ago

@snipe - just to lay one other possibility to rest - what browser are you using for your testing? Mac/PC? Just so I can try and replicate your 'working' situation.

snipe commented 7 years ago

I've used Chrome and Safari on OSX

Jason-Weber-UC commented 7 years ago

Nut's - there goes that theory. Although it does take one possibility (the client end) out of the equation.

Update - tried Chrome (the only browser I hadnt) - negative, ghostrider. Update, pt2 - ditto IE on Win 7.

Jason-Weber-UC commented 7 years ago

Got my label printer. Issue is more obvious

20170511_132343

Jason-Weber-UC commented 7 years ago

@snipe - I really am sorry for spamming this thread, but I kinda figured more info is better than none.

For the sake of it, I File --> Print --> Save as PDF. You can really see the grey edges now.

screen shot 2017-05-11 at 3 14 24 pm

leobg commented 7 years ago

@jason - thanks for posting all pics. This is exactly the issue I reported. QR codes are not affected, only linear ones. When you print this on a 200dpi BW label printer on a 1 inch wide label result is unscannable​ barcode.

BrettFagerlund commented 7 years ago

The easiest way to check is just pick an asset, hit generate labels with a 1D, and zoom to 500% on browser. The 1D barcode image gets very fuzzy as oppose to the text or the label border.

Or access directly via /hardware/[ID]/barcode then zoom 500%.

Jason-Weber-UC commented 7 years ago

I wonder if it could php-GD doing some kind of anti-aliasing?

BrettFagerlund commented 7 years ago

Just did a bit more testing and there appears to be a hard coded width of 250px which is stretching out the bars causing the difficulty reading on some devices, if i remove this limit and let the width generate dynamically the barcodes are reading almost instantaneously across all our devices.

There is a risk that a very long name will stretch over the label though.

Jason-Weber-UC commented 7 years ago

@BrettFagerlund How did you do this? I'd like to give it a go?

BrettFagerlund commented 7 years ago

@Jason-Weber-UC first go into the public/uploads/barcodes folder and clean out the existing barcodes, it will use the images if they already exist so you need to clear it to regenerate.

Then go to app\http\controllers\assetscontroller.php Find the function getBarCode Inside that function there will be a line

$barcode_obj = $barcode->getBarcodeObj($settings->alt_barcode, $asset->asset_tag, 250, 20);

replace the 250 with '' (2 apostrophes) so it will be like

$barcode_obj = $barcode->getBarcodeObj($settings->alt_barcode, $asset->asset_tag, '', 20);

Jason-Weber-UC commented 7 years ago

DING!!! Brilliant.

leobg commented 7 years ago

@jason does this patch solve the 2d barcodes fuzziness?

BrettFagerlund commented 7 years ago

@leobg I still have a bit of fuzziness on the barcodes, but the readability is a lot better since the bars are not being stretched out.

Not sure how much more can be done without switching over to svg. I've also added in custom css to fix the zooming and make it look cleaner but it seems to always print a bit fuzzy regardless of how it looks on screen.

Jason-Weber-UC commented 7 years ago

Put it this way - can now scan them. SO for me at least - Problem solved.

Whats this CSS file?

BrettFagerlund commented 7 years ago

its kinda unncessary, but once logged in I went to options and added the following into the custom css box

img.barcode {
      image-rendering: pixelated;
}

It will just stop the browser messing with the image on zoom (well for chrome anyway)

leobg commented 7 years ago

I just tried with the resize hack Brett suggested, but I can't say it really addresses the problem. Bar code is no longer stretched along the length of the label, but rather on the middle. Still fuzzy. I am no programmer, but I am curious if possible to use the same approach as for QR codes (which are drawn perfectly) for line bar codes?

stale[bot] commented 6 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions!