BarcodeImage["string",format] generates a barcode image given a string and barcode format. The supported formats can be read off from its documentation.

Is there a programmatic way to list the supported formats?


1 Answer 1


Programmatic discoverability of various function options is something that is still not covered well in Mathematica, but some work is being done in this way – as far as I have managed to understand from latest Live CEOing videos.

Diving into the source code, you can discover an internal list which contains all possible formats.


(* {"UPC_A", "EAN_13", "EAN_8", "CODE_39", "CODE_128", "ITF", "QR_CODE",
    "PDF_417", "CODABAR", "AZTEC", "DATA_MATRIX"} *)

In fact, there are several different namings allowed for these formats, which are then standardized by Image`RecognitionDump`standardizeFormatNames. You can extract all possible values with:

  p__?StringQ :> p, Infinity]

(* {"UPC-A", "UPC_A", "UPCA", "UPC", "UPC-E", "UPC_E", "UPCE", "EAN-13", 
    "EAN_13", "EAN13", "EAN-8", "EAN_8", "EAN8", "GS1-14", "GS1_14", 
    "GS114", "GS1", "RSS-14", "RSS14", "RSS_14", "EXPANDEDGS1", 
    "EXPANDEDRSS", "CODE-39", "CODE_39", "CODE39", "CODE-93", "CODE_93", 
    "CODE93", "CODE-128", "CODE_128", "CODE128", "ITF", "QR", "QR-CODE", 
    "AZTEC", "PDF-417", "PDF_417", "PDF417", "CODABAR", "MAXICODE"} *)
  • $\begingroup$ +1 I was expecting a much more convoluted hack (parsing the docs maybe) but this is definitely a lot simpler and will work till API support comes along. Thnx. $\endgroup$
    – lineage
    Jan 10, 2023 at 0:50
  • $\begingroup$ Note however that the literals (probably var names) differ from those mentioned in the docs ("QR_CODE" instead of "QR"), albeit they work. $\endgroup$
    – lineage
    Jan 10, 2023 at 0:51
  • $\begingroup$ Yes, there is an auxiliary function Image`RecognitionDump`standardizeFormatNames that converts many different spellings into the "standardized" format names. Look at it with GeneralUtilities`PrintDefinitions[Image`RecognitionDump`standardizeFormatNames]. $\endgroup$
    – Domen
    Jan 10, 2023 at 1:06

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.