Changing the color of 2d barcodes

812 views
Skip to first unread message

Yosimo

unread,
Jun 22, 2011, 9:55:28 AM6/22/11
to xmpie...@googlegroups.com

Hi all,

by default XMPie uDirect is printing 2d barcodes only in black and they are defined in RGB.
XMPie generates an EPS (Encapsulated PostScript) for the 2d barcodes. 
If you want to print the barcodes in color you have to change the RGB values in the PostScript code using QLingo.

Consider a function that creates a 2D barcode printing in black:
XMP2DQRCode("barcode-test")

Now you can use the FindAndReplace() function to replace all PostScript commands for the RGB values.

FindAndReplace(XMP2DQRCode("barcode-test"), "0.00 0.00 0.00 setrgbcolor", "1.00 0.00 0.00 setrgbcolor")
This results in a RGB-red colored code.
The first RGB value is Red, the 2nd Green, the 3rd is Blue.
0.00 = 0% and 0.50=50%  and 1.0 = 100% halftone.
All RGB values = 0 results in black and all RGB values = 1.00 results in white.
 

For changing the RGB to CMYK color space try this:
FindAndReplace(FindAndReplace(XMP2DQRCode("barcode-test"), "0.00 0.00 0.00 setrgbcolor", "0.00 1.00 1.00 0.00 setcmykcolor"),"1.00 1.00 1.00 setrgbcolor","0.00 0.00 0.00 0.00
setcmykcolor")
This results in a CMYK-red colored code.
The first CMYK value is Cyan, the 2nd is Magenta, the 3rd is Yellow, the 4th is Black.  0.00 = 0% and 0.50=50%  and 1.0 = 100% halftone.
 
Setting the 2d barcode into spotcolor try this (here the name of Spotcolor is: "Red Spot")
FindAndReplace(FindAndReplace(FindAndReplace(XMP2DQRCode("barcode-test"), "0.00 0.00 0.00 setrgbcolor", "MySpot 1.0 setcustomcolor"), "1.00 1.00 1.00 setrgbcolor", "0.00 0.00 0.00 0.00 setcmykcolor"), "%%EndComments", "%%EndComments\r 0 1 0.8 0 (Red Spot)\r findcmykcustomcolor\r /MySpot exch def")
"0 1 0.8 0 (Red Spot)" results in a red color defined by CMYK custom values
"MySpot 1.0 setcustomcolor" is setting the spotcolor to 100% halftone

 
In the color palette of Indesign the name of spotcolor will appear with the following (same code like above with some additionals in header section):
FindAndReplace(FindAndReplace(FindAndReplace(XMP2DQRCode("barcode-test"), "0.00 0.00 0.00 setrgbcolor", "MySpot 1.0 setcustomcolor"), "1.00 1.00 1.00 setrgbcolor", "0.00 0.00 0.00 0.00 setcmykcolor"), "%%EndComments", "%%DocumentCustomColors: (Red Spot) \r%%CMYKCustomColor: 0 1.0 0.8 0 (Red Spot) %%EndComments\r 0 1 0.8 0 (Red Spot)\r findcmykcustomcolor\r /MySpot exch def")

 
For coloring in Duplex mode try this:
FindAndReplace(FindAndReplace(XMP2DQRCode("barcode-test"), "0.00 0.00 0.00 setrgbcolor", "[ /DeviceN [ (Red Spot) (Black) ] /DeviceCMYK { exch 0 exch dup 0.8 mul 4 3 roll } bind ] setcolorspace 0.6 0.2 setcolor"), "1.00 1.00 1.00 setrgbcolor", "0.00 0.00 0.00 0.00 setcmykcolor")
"(Red Spot) (Black)" defines the duplex tone composed by the spotcolor and one of the CMYK color
"0.6 0.2 setcolor" defines the halftone of the spotcolor and the CMYK color.


All information supplied without guarantee!

Have fun.

Regards
Yosimo

Igor Vorobeychik

unread,
Jun 22, 2011, 10:03:26 AM6/22/11
to XMPie Interest Group
Thanks, Yosimo
I posted solution on XMPie support not long ago that use this
technique to change XMPie default RGB to CMYK , thanks for adding
color.
Igor.

On Jun 22, 9:55 am, Yosimo <si...@stober.de> wrote:
> Hi all,
>
> by default XMPie uDirect is printing 2d barcodes only in black and they are
> defined in RGB.
> XMPie generates an EPS (Encapsulated PostScript) for the 2d barcodes.
> If you want to print the barcodes in color you have to change the RGB values
> in the PostScript code using QLingo.
>
> Consider a function that creates a 2D barcode printing in black:
> XMP2DQRCode("barcode-test")
> Now you can use the FindAndReplace() function to replace all PostScript
> commands for the RGB values.
>
> FindAndReplace(XMP2DQRCode("barcode-test"), "0.00 0.00 0.00 setrgbcolor",
> "1.00 0.00 0.00 setrgbcolor")
> This results in a RGB-red colored code.
> The first RGB value is Red, the 2nd Green, the 3rd is Blue.
> 0.00 = 0% and 0.50=50%  and 1.0 = 100% halftone.
> All RGB values = 0 results in black and all RGB values = 1.00 results in
> white.
>
> *For changing the RGB to CMYK color space try this:
> *
> FindAndReplace(FindAndReplace(XMP2DQRCode("barcode-test"), "0.00 0.00 0.00
> setrgbcolor", "0.00 1.00 1.00 0.00 setcmykcolor"),"1.00 1.00 1.00
> setrgbcolor","0.00 0.00 0.00 0.00
> setcmykcolor")
> This results in a CMYK-red colored code.
> The first CMYK value is Cyan, the 2nd is Magenta, the 3rd is Yellow, the 4th
> is Black.  0.00 = 0% and 0.50=50%  and 1.0 = 100% halftone.
>  *
> *
> *Setting the 2d barcode into spotcolor try this (here the name of Spotcolor
> is: "Red Spot")
> *
> FindAndReplace(FindAndReplace(FindAndReplace(XMP2DQRCode("barcode-test"),
> "0.00 0.00 0.00 setrgbcolor", "MySpot 1.0 setcustomcolor"), "1.00 1.00 1.00
> setrgbcolor", "0.00 0.00 0.00 0.00 setcmykcolor"), "%%EndComments",
> "%%EndComments\r 0 1 0.8 0 (Red Spot)\r findcmykcustomcolor\r /MySpot exch
> def")
> "0 1 0.8 0 (Red Spot)" results in a red color defined by CMYK custom values
> "MySpot 1.0 setcustomcolor" is setting the spotcolor to 100% halftone
>
> *In the color palette of Indesign the name of spotcolor will appear with the
> following (same code like above with some additionals in header section):
> *
> FindAndReplace(FindAndReplace(FindAndReplace(XMP2DQRCode("barcode-test"),
> "0.00 0.00 0.00 setrgbcolor", "MySpot 1.0 setcustomcolor"), "1.00 1.00 1.00
> setrgbcolor", "0.00 0.00 0.00 0.00 setcmykcolor"), "%%EndComments",
> "%%DocumentCustomColors: (Red Spot) \r%%CMYKCustomColor: 0 1.0 0.8 0 (Red
> Spot) %%EndComments\r 0 1 0.8 0 (Red Spot)\r findcmykcustomcolor\r /MySpot
> exch def")
>
> *For coloring in Duplex mode try this:
> *

Alain Lina

unread,
Jun 22, 2011, 10:05:13 AM6/22/11
to xmpie...@googlegroups.com
Thing is, you're not supposed to use halftoned colors on barcodes.
The lines are supposed to be solid in order to be scanned.
Correct me if I'm wrong.

--
You received this message because you are subscribed to the Google Groups "XMPie Interest Group" group.
To view this discussion on the web visit https://groups.google.com/d/msg/xmpie-users/-/UvDqIy9oJngJ.
To post to this group, send email to xmpie...@googlegroups.com.
To unsubscribe from this group, send email to xmpie-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/xmpie-users?hl=en.

Larisa Morris

unread,
Sep 15, 2011, 3:45:16 PM9/15/11
to xmpie...@googlegroups.com
Thank you for posting this it has been most helpful. I was able to change the color from black to RGB but its only in halftones. If I wanted to use the actual RGB breakdowns from Indesign will it replicate it? I tried to do the rgb breakdown in the qlingo code but its a shade of the color I need. Am I missing something? Should I be using a different color breakdown, Lab or webcolors? Any help you can provide me would be most helpful. I have been searching for an answer for days now without success. Thanks so much!

Yosimo

unread,
Sep 16, 2011, 12:30:16 PM9/16/11
to xmpie...@googlegroups.com
Hi Larisa,

in desktop applications like Indesign or Photoshop, RGB colors are typically defined in color values ​​from 0 to 255.
In contrast CMYK colors are given in percent.
In QLingo you have specify the values ​​for RGB colors also in percent.
The RGB value 1.00 1.00 1.00 results in zero percent tone value, 0.00 0.00 0.00 is 100% tone value.
For CMYK values, it is just the opposite.
 

If you want to achieve exactly the same RGB tone with Qlingo as defined in Indesign, so I think you have to try for so long with the percentages in Qlingo until it matches.
I dont know an other way.

Regards
Yosimo

Yosimo

unread,
Feb 14, 2013, 7:20:46 AM2/14/13
to xmpie...@googlegroups.com
Barcode color parameters are introduced in version 6.0.

To control the color of a barcode use the advanced parameters of the XMPie barcode functions (as provided by the 2nd parameter to the barcode function). You can set a different color to the barcode text, barcode image, and to the background of the barcode image.

There is a TechNote 0044 "New Barcode features in uDirect v6" or have a look at the XMPie CSP and search for "Colored BarCodes in Version 6"

Yosimo


Igor

unread,
Feb 14, 2013, 9:42:19 AM2/14/13
to xmpie...@googlegroups.com
in new XMPie version it works a bit different with barcodes now, but now it suppose to have actual parameter for a color.
Igor.

Ed Wong

unread,
Mar 12, 2014, 5:29:05 PM3/12/14
to xmpie...@googlegroups.com
I know this is an older post but I cannot find anything newer in referencing spot colors in 2d barcodes.

The link to "New Barcode features in uDirect v6" no longer works. Is there is a new TechNote was available?

Also, is there any other way of specifying a spot PMS color other than:

In the color palette of Indesign the name of spotcolor will appear with the following (same code like above with some additionals in header section):
FindAndReplace(FindAndReplace(FindAndReplace(XMP2DQRCode("barcode-test"), "0.00 0.00 0.00 setrgbcolor", "MySpot 1.0 setcustomcolor"), "1.00 1.00 1.00 setrgbcolor", "0.00 0.00 0.00 0.00 setcmykcolor"), "%%EndComments", "%%DocumentCustomColors: (Red Spot) \r%%CMYKCustomColor: 0 1.0 0.8 0 (Red Spot) %%EndComments\r 0 1 0.8 0 (Red Spot)\r findcmykcustomcolor\r /MySpot exch def")

I noticed that the way to specify cmyk color has changed since this example, so I was wondering if there is a new way to specify a PMS in 6.6.3?

Thank you for your time,
Ed Wong

couch

unread,
Mar 12, 2014, 10:49:12 PM3/12/14
to xmpie...@googlegroups.com
From v6.2 and onwards, XMPie introduced a new barcode function:

XMPBarcode(barcodeName, inputText /*, advancedParametersString */)

The advanced parameters offer settings to change text color, bar color and background color independently.

From memory, you can set the color by using rgb or cmyk values - but not spot.

There's more info in the user guide and this video that introduces the new barcode function: http://fx.xmpie.com/videos/barcodes.aspx
Reply all
Reply to author
Forward
0 new messages