How to Generate a UPC-E Barcode Image using Python

Cloudmersive
2 min readJan 30, 2023

--

Smaller retail products require a smaller barcode size — and that’s exactly the reason UPC-E barcodes exist. The below API solution will convert your UPC-E barcode numbers into appropriately sized 1D PNG barcode images, and it requires only a few lines of Python code to make your API call.

You can install the SDK by running this command:

pip install cloudmersive-barcode-api-client

And you can structure your API call using the below snippet:

from __future__ import print_function
import time
import cloudmersive_barcode_api_client
from cloudmersive_barcode_api_client.rest import ApiException
from pprint import pprint

# Configure API key authorization: Apikey
configuration = cloudmersive_barcode_api_client.Configuration()
configuration.api_key['Apikey'] = 'YOUR_API_KEY'



# create an instance of the API class
api_instance = cloudmersive_barcode_api_client.GenerateBarcodeApi(cloudmersive_barcode_api_client.ApiClient(configuration))
value = 'value_example' # str | UPC-E barcode value to generate from

try:
# Generate a UPC-E code barcode as PNG file
api_response = api_instance.generate_barcode_upce(value)
pprint(api_response)
except ApiException as e:
print("Exception when calling GenerateBarcodeApi->generate_barcode_upce: %s\n" % e)

In order to complete your API calls for free, you’ll need to provide a free-tier Cloudmersive API key in the configuration.api_key field above. To get one, visit our website and register a free account (this provides a limit of 800 API call per month & no commitments).

--

--

Cloudmersive
Cloudmersive

Written by Cloudmersive

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.

No responses yet