cancel
Showing results for 
Search instead for 
Did you mean: 
7 Replies
StefanT-Xerox
FreeFlow User

Re: Ink usage report

Hi,

Sorry for late reply.

It is possible to do this with Ghostscript but not with the ink_cov device as you say. However, it is possible to do this by measuring the coverage on tiff files exported by Ghostscript by using Python. Attached are two scripts. One batch file and one python script.

The batch file:

"C:\Program Files\gs\gs9.50\bin\gswin64c.exe" -dNOPAUSE -dNOCACHE -dBATCH -dNOSAFER -sDEVICE=tiffsep1 -r300x300 -sOutputFile="C:\tmp\%~nx1_p%%03d.tif" %1
"C:\Program Files\Python37\python.exe" "C:\Xerox\FreeFlow\Core\00000000-0000-0000-0000-000000000000\Data\Scripts\inkcov.py" %~nx1

The batch file does two things:

It first calls Ghostscript and saves the PDF as .tif files to C:\tmp using the tiffsep1 device. One tif for each separation, also for spot colors.

It then runs the python script that looks like this:

import cv2
import numpy as np
import os
import sys
report = open('C:/tmp/' + sys.argv[1] + '.txt',"w+")
files = os.listdir('C:/tmp/')
for pic in files:
if sys.argv[1] in pic and '.tif' in pic:
#print (pic)
report.write(pic)
report.write("\n")
img = cv2.imread(os.path.join('C:/tmp/', pic), 0)
assert not isinstance(img,type(None)), 'image not found'
inkcovIMG = img/np.full(img.shape, 255)
#print (round(100*(1-np.mean(inkcovIMG)), 1))
report.write(str(round(100*(1-np.mean(inkcovIMG)), 1))) # Coverage in percent with one decimal
report.write("\n")

The python script uses something called numpy and opencv to be able to calculate the ink coverage for each tif file in C:\tmp corresponding to the specific job and then writes the result to a txt file with the job name. To get the report as csv or similar some more scripting has to be done.

To install python as required for this you could use this as a reference: https://www.youtube.com/watch?v=d3AT9EGp4iw

You can then run this is an External Process in FFCore pointing to the batch file and use the default parameters. However, only $FFin$ is necessary in this case.

Stefan

0 Kudos
barwapk
Valued Member
Valued Member

Re: Ink usage report

This is great but it doesnt work with spot colors, only with process :(

Tags (1)
0 Kudos
StefanT-Xerox
FreeFlow User

Re: Ink usage report

Ghostscript has a device named ink_cov that you could try.

https://ghostscript.com/doc/current/Devices.htm

This script that you can use in an External process in FFCore will run ink_cov on a pdf and save the report to C:\temp using the job name.

"C:\Program Files\gs\gs9.50\bin\gswin64c.exe" -o - -sDEVICE=ink_cov %1 > C:\temp\%2.report.txt

Parameters:
"$FFin$" "$FFwfJob.jobName$"

The report will be a text file with the CMYK coverage values for each page like this:

Page 1
50.62684 42.02598 25.07010 19.32347 CMYK OK
Page 2
 4.18561  5.82315  9.58333  3.07993 CMYK OK

and so on.

Script attached.

0 Kudos
barwapk
Valued Member
Valued Member

Re: Ink usage report

I think it is ink limit, not ink usage. 

0 Kudos
DavidU54339-XRX
FreeFlow Production Workflow Moderator
FreeFlow Production Workflow Moderator

Re: Ink usage report

Is this what you are looking for? This is from Callas 10. Presently, FFCore support Callas 10. We are working on support for Callas 11.inkl.png

0 Kudos
barwapk
Valued Member
Valued Member

Re: Ink usage report

ohh I'm sorry, it should be a question, can Core do this? I cant find check in Callas also...
0 Kudos
DavidU54339-XRX
FreeFlow Production Workflow Moderator
FreeFlow Production Workflow Moderator

Re: Ink usage report

Interesting.

0 Kudos
barwapk
Valued Member
Valued Member

Ink usage report

How to get Ink usage report, something like:

https://www.youtube.com/watch?v=ufYuhyNCogk

0 Kudos