0

For an ecommerce project we need to photograph tens of thousands of products which all do have a barcode. In order to batch upload the photos into the shop and to know which photo belongs to which products I thought of the following process:

  1. Take Product
  2. Make clear photo of product's barcode
  3. make n photos of the product from various perspectives (barcode won't be visible on these photos)
  4. Take next product, go to step 2

The result would be a list of photos like this

  • photo of barcode of product A
  • 1st photo of product A
  • 2nd photo of product A
  • photo of barcode of product B
  • 1st photo of product B
  • photo of barcode of product C
  • 1st photo of product C
  • 2nd photo of product C
  • photo of barcode of product D
  • 1st photo of product D
  • 2nd photo of product D
  • 3rd photo of product D
  • 4th photo of product D
  • photo of barcode of product E
  • 1st photo of product E
  • 2nd photo of product E

Now I am looking for a software to iterate this list and create a csv file with the following result

barcode | filenames
12312312 | p1.jpg, p2.jpg
42342342 | p3.jpg
31231231 | p4.jpg, p5.jpg
31254234 | p6.jpg, p7.jpg, p8.jpg, p9.jpg
75867867 | p10.jpg, p11.jpg

Edit: I have no restriction regarding OS. It can be Windows, Linux or MacOS also no certain budget limitation in mind. I mean I do not think that this service should be very expensive but also I am not expecting a freeware.

2
  • 1
    Have replied in the post as edit. Is that right procedure or should i've replied here as a comment?
    – elMeroMero
    Feb 28, 2019 at 8:04
  • Thanks! That's actually the recommended procedure 👍‎
    – Izzy
    Feb 28, 2019 at 21:42

2 Answers 2

0

Since you mentioned an “ecommerce project”, this could mean you have access to a programmer. If that’s the case, you could use a programming toolkit to check the images for barcodes, and build the CSV file using code.

One such toolkit is the LEADTOOLS Barcode Pro. Disclaimer: I am an employee of this toolkit’s vendor. The following C# code builds a CSV file from a list of image file names:

private void CreatePhotoList(string csvName, string[] imageFileNames)
{
System.IO.StreamWriter csv = new StreamWriter(csvName);
csv.Write("barcode,filenames");
for (int i = 0; i < imageFileNames.Length; ++i)
{
   RasterImage image = _codecs.Load(imageFileNames[i]);
   BarcodeEngine engine = new BarcodeEngine();
   BarcodeReader reader = engine.Reader;
   var symbologies // specify one or more types of barcodes you want to search for
      = new BarcodeSymbology[] { BarcodeSymbology.Code128, BarcodeSymbology.Code3Of9 };
   BarcodeData barcode = reader.ReadBarcode(image, LeadRect.Empty, symbologies);
   string itemToWrite;
   if (barcode == null)
   {
      itemToWrite = imageFileNames[i];
      csv.Write(",");
   }
   else
   {
      csv.Write("\n");
      itemToWrite = barcode.Value;
   }
   if (itemToWrite.Contains(",")) //if there's a comma, should enclose in double-quotes
      itemToWrite = "\"" + itemToWrite + "\"";
   csv.Write(itemToWrite);
}
csv.Close();
}

The code uses LEADTOOLS to search for a barcode in the image. If it finds one, it starts a new line and writes the barcode value to the CSV. If the image does not contain a barcode, it writes its name to the same line, assuming it belongs to the previous barcode.

This should work if the list of image file names is ordered correctly (Barcode1, picture1, picture1, Barcode2, picture2, picture2, picture2, etc.)

If you would like to try it, there’s a free evaluation edition of LEADTOOLS you can download. If you don’t code in C#, the toolkit supports other languages, including C, C++, VB.NET, Java and Objective-C. Also, technical support is free even during evaluation.

0

You could use the combination of python, OpenCV and zbar to script this up. The locating and decoding of bar codes from images or video feeds is covered nicely this blog post in just 40 lines of code for static images, the only significant difference is that you wish to append the filenames of the images that do not contain a bar code to the list for the latest bar code.

  • Free, Gratis & Open Source
  • Cross Platform (will even run on a Raspberry Pi).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.