Automate Graphic Design using Python

Use Python Pillow to automate the creation of hundred warehouse labels for the signage of picking locations

Automate Graphic Design using Python

Use Python Pillow to automate the creation of hundred warehouse labels for the signage of picking locations

Article originally published on Medium.

Scenario
You are an implementation manager in the logistics department of an international fashion retailer.

For each project, you manage the implementation of the equipment, train the teams and design the layouts of storage locations.

Example of Warehouse Label β€” (Image by Author)

Therefore, you spend a tremendous time in graphic design for posters, security signage or labels.

In this article, we explore a method to automate the process of graphic design using the Python library Pillow.

πŸ’Œ New articles straight in your inbox for free: Newsletter

If you prefer watching, have a look a the Youtube tutorial,

Problem Statement

Scenario

You are part of the project team of the logistics department of a fashion retailer that has warehouses on all continents.

This team is in charge of implementing processes and equipment for newly opened distribution centres.

Example of a Distribution Center β€” (Image by Author)

For instance, your major task is to design the layout of racks for storage locations.

In a warehouse, you can have several hundred locations with pallets/shelves for storage and picking.

(Ground Level: Picking Locations, Other Levels: Storage) β€” (Image by Author)

In order to help the operators to find the right locations, you need to print and stick labels with key information.

Example of the label for an elevated storage location β€” (Image by Author)

Objective

You want to design customized labels to reduce errors, help operators and respect the standard operating procedures of your company.

Because you may have several thousand locations per warehouse, you would like to automate this process.

Solution

I will present a solution to automatically create these labels.

Final Results of labels β€” (Image by Author)

It is a simple python script that imports location information from an excel file and automatically generates labels like the ones above.

Label Design

Six key parameters

This label will be read by three types of operators:

  • Reach Truck Drivers that will put pallets or boxes in these locations
  • Picking Operators that will take items from these locations
  • Inventory admins that will perform inventory counts
Label Information β€” (Image by Author)

Therefore, you will need to include some key information related to the location and the product stored:

  • A coloured arrow to show where the product is stored (above or below)
  • A bar code with the SKU code for the operators using an RF gun
  • The picking location number with the alley, cell and level numbers
  • Three Icons that provide information related to the location and the item stored

Spatial Coordinates

Considering the size of each item, you want to fix the spatial coordinate of each item.

Key Coordinates β€” (Image by Author)

In this very simple label, you have 5 parameters to locate the different items.

We decided to put the origin in the top-left corner; it’s because Pillow is using the same origin.

Import png icons

The storage location number and the bar code will be generated in your python script.

Icons to add β€” (Image by Author)

The other items are icons that will be imported into your Pillow object using locally store png files.

Information source

In your master data, you have several thousand SKUs with information like the size, weight, price etc.

You will allocate each of these SKUs to a picking location that will require a specific label.

For your automation tool, you can create an excel file with a line for each SKU including

  • SKU Code: that will be used to create the bar code
  • Geographical information: alley, zone and location number
  • Logistics handling unit: pieces if you take items piece by piece or Carton if you take the item by carton
  • Arrow type with the direction and the colour
  • Product Category (Tie, Shoes, Dress, …)
  • Picking Location Special Information: dangerous goods, sprinklers, RFID, …

Automate the label creation

Start the loop

Your script will loop through the lines of your data frame to generate one label for each line.

For each label, you start by creating a blank canvas with a black border and specific dimensions (500, 200) in pixels.

Blank Canvas β€” (Image by Author)

Add the icons

For this step, you will add icons specifying

  • Coordinates (x, y)
  • Dimensions after resizing using percentage
  • Icon filename is taken from the data frame

P.S:

  • You need to convert your png files to keep a transparent background.
  • Icons coordinates are defined using their size on both axes
Label with icons β€” (Image by Author)

Add the bar code

The bar code is generated using the SKU code and the barcode library of python.

P.S:

  • create_ean will generate a png file stored locally that will be used in the loop
  • The bar code has been resized to fit in the canvas
Label with bar code β€” (Image by Author)

Add the location code

This last step will be fully performed using Python Pillow.

Final Result β€” (Image by Author)

Et voila!

Your labels are generated and ready to be printed.

This is not an artwork of Leonardo Da Vinci but it can be automatically generated for thousand labels with just a click.

1000 labels generated in 30 seconds β€” (Image by Author)

If you want to learn about more advanced functionalities of Pillow, you can have a look at their official documentation.


About Me

Let’s connect on Linkedin and Twitter, I am a Supply Chain Engineer that is using data analytics to improve logistics operations and reduce costs.