Click here to Skip to main content
15,884,388 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hi All,

I have generated a barcode for 1300 bytes data.

My problem is: the generated barcode image size is too big.
Actually, I have to print the generated barcode on the ID card.

Please help me how to reduce the size of a generated barcode image without any dataloss.

Thanks&Regards


[EDIT]
I'm generating 2D barcodes only.
Posted
Updated 29-Mar-11 19:54pm
v6
Comments
Dalek Dave 29-Mar-11 13:36pm    
Edited for readability.

May not be possible.

Barcode printed size and quality has a marked effect on readability, and both are specified exactly in the barcode spec documents. Reducing the quality of an image before your print it may make it unreadable, or unreliably readable, and reducing the printed size (particularly the quiet margins) may well do the same.

Why do you want to do this?
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 29-Mar-11 12:43pm    
Griff, I voted 5 but then noticed: OP asks about the method "without any dataloss", so your argument has no addressee. Lostless compression is perfectly legitimate.
--SA
OriginalGriff 29-Mar-11 14:25pm    
Hi SA, the issue of dataloss is immaterial when it comes to barcodes: the physical size of the printed code is part of the barcode spec. In addition, dataloss is inevitable when you reduce barcodes; the whole thing depends on the relative widths of the black and white bars, with very fine tolerances. As soon as you start reducing the image length, you inevitably introduce relative width errors. It's even worse if you start using inks onto absorbent substrates as you have to figure the amount of spread of the black bars into the white bar space before you generate the barcode image in the first place... I spent several years designing inkjets to print on product and have met these and worse problems far too often. :laugh:

You really can't muck about with the specification widths (particularly the quiet zones at each end) before the codes become very unreliable indeed.
Sergey Alexandrovich Kryukov 29-Mar-11 15:10pm    
Thank you for the explanation. When I mean lostless compression, I mean lostless, something that has nothing to do with the data content, just compression such as ZIP, 7z or whatever. I understand it may not me very effective, but nothing wrong. Major problem is different. I think Richard is right, the approach to data management should be changes due to massive data processing.
--SA
OriginalGriff 29-Mar-11 15:16pm    
Welcome! You are both right, the best idea is to use a short barcode as an index into a database and pick up the real info from there. Much better from a security POV as well!
Sergey Alexandrovich Kryukov 29-Mar-11 15:22pm    
We all agree on that. Thank you.
--SA
Considering the barcode uses (probably) 8 bars per digit that makes a total of 10400 bars to be printed onto an id card. Assume that each bar is a minimum of 0.2mm wide, that gives a total of over 200 centimeters width. I think your design requirements need to be reviewed.
Alternatively you may need to consider the 2D barcode types which can contain more information.

[edit]OP has updated the question to state that he is using 2D barcodes, so my comments are probably not valid. However, the issue remains that each bar or square in the image must be above some fixed minimum size in order to be readable. Compression, whether lossless or lossy is hardly the issue.[/edit]
 
Share this answer
 
v2
Comments
Sergey Alexandrovich Kryukov 29-Mar-11 12:49pm    
A agree with you, my 5. In my Answer I added just a work about the lostless compression.
--SA
Richard is right. I would add: lostless compression is perfectly feasible; there is a number of such methods, but it won't save the situation; you need to rethink your data management.

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900