Prepress: Difference between revisions
Jump to navigation
Jump to search
(Created page with "==Convert to a specific .icc color profile== ==CMYK color separation== https://gitlab.constantvzw.org/osp/tools.pdfutils/-/blob/master/colorSeparation.sh Requires: * https://gitlab.constantvzw.org/osp/tools.pdfutils/-/blob/master/colorSeparation_header.html * https://gitlab.constantvzw.org/osp/tools.pdfutils/-/blob/master/colorSeparation_footer.html <syntaxhighlight lang="bash"> #! /usr/bin/env bash # # USAGE # ./colorSeparation.sh input.pdf # # OUTPUT # a direct...") |
|||
(4 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
__TOC__ | |||
==Convert to a specific ICC color profile== | |||
Based on [https://gitlab.constantvzw.org/osp/tools.pdfutils/-/blob/master/rgb2cmyk.sh OSP's rgb2cmyk.sh] which is part of their [https://gitlab.constantvzw.org/osp/tools.pdfutils/ tools.pdfutils] repository. | |||
Requires: | |||
* <code>control.txt</code> (see below SOON) | |||
* specific ICC profile, such as: XXX | |||
XXX | |||
==CMYK color separation== | ==CMYK color separation== | ||
https://gitlab.constantvzw.org/osp/tools.pdfutils/-/blob/master/colorSeparation.sh | Based on [https://gitlab.constantvzw.org/osp/tools.pdfutils/-/blob/master/colorSeparation.sh OSP's colorSeparation.sh] which is part of their [https://gitlab.constantvzw.org/osp/tools.pdfutils/ tools.pdfutils] repository. | ||
Requires: | Requires: | ||
Line 40: | Line 49: | ||
echo "MAKE COLOURED PREVIEW" | echo "MAKE COLOURED PREVIEW" | ||
for Cyan in *Cyan*; do | for Cyan in *Cyan*; do convert $Cyan -colorspace Gray +level-colors cyan, $Cyan; done | ||
for Magenta in *Magenta*; do | for Magenta in *Magenta*; do convert $Magenta -colorspace Gray +level-colors magenta, $Magenta; done | ||
for Yellow in *Yellow*; do | for Yellow in *Yellow*; do convert $Yellow -colorspace Gray +level-colors yellow, $Yellow; done | ||
echo "GENERATE HTML PREVIEW PAGE" | echo "GENERATE HTML PREVIEW PAGE" | ||
Line 68: | Line 77: | ||
cat ../colorSeparation_footer.html >> 00-${bn}-plates.html | cat ../colorSeparation_footer.html >> 00-${bn}-plates.html | ||
</syntaxhighlight> | </syntaxhighlight> | ||
==See also== | |||
* https://blog.didierstevens.com/programs/pdf-tools/ |
Latest revision as of 08:55, 25 January 2024
Convert to a specific ICC color profile
Based on OSP's rgb2cmyk.sh which is part of their tools.pdfutils repository.
Requires:
control.txt
(see below SOON)- specific ICC profile, such as: XXX
XXX
CMYK color separation
Based on OSP's colorSeparation.sh which is part of their tools.pdfutils repository.
Requires:
- https://gitlab.constantvzw.org/osp/tools.pdfutils/-/blob/master/colorSeparation_header.html
- https://gitlab.constantvzw.org/osp/tools.pdfutils/-/blob/master/colorSeparation_footer.html
#! /usr/bin/env bash
#
# USAGE
# ./colorSeparation.sh input.pdf
#
# OUTPUT
# a directory called `tiffsep` where you have a jpg image per color channel per page
rm -r pages 2> /dev/null
bn=$(basename ${1} .pdf)
# Change resolution here, -r150x150 = 150dpi
gs -dSimulateOverprint=true -sDEVICE=tiffsep -dNOPAUSE -dBATCH -r150x150 -sOutputFile=${bn}-page%03d.tif ${1}
echo "MOVE TIF FILES INTO '${bn}-plates' FOLDER"
mkdir -p ${bn}_plates
mv ${bn}*.tif ${bn}_plates
cd ${bn}_plates
echo "CONVERT TIF TO JPG"
for TIF in *.tif; do convert $TIF $(basename $TIF .tif).jpg; done
echo "REMOVE TIF FILES"
rm *tif
echo "MAKE COLOURED PREVIEW"
for Cyan in *Cyan*; do convert $Cyan -colorspace Gray +level-colors cyan, $Cyan; done
for Magenta in *Magenta*; do convert $Magenta -colorspace Gray +level-colors magenta, $Magenta; done
for Yellow in *Yellow*; do convert $Yellow -colorspace Gray +level-colors yellow, $Yellow; done
echo "GENERATE HTML PREVIEW PAGE"
cat ../colorSeparation_header.html > 00-${bn}-plates.html
start=1
end=$(( $(ls | wc -l) /5))
size=$(identify ${bn}-page001.jpg | cut -d " " -f 3)
width=$(echo ${size} | cut -d "x" -f 1)
height=$(echo ${size} | cut -d "x" -f 2)
for i in $(eval echo "{$start..$end}")
do
page=$(printf "%03u" ${i})
echo "<div id='page${page}' class='page' style='height: ${height}px; width: ${width}px;'>" >> 00-${bn}-plates.html
echo " <img class='all' style='height: ${height}px; width: ${width}px;' src='${bn}-page${page}.jpg' />" >> 00-${bn}-plates.html
echo " <img class='cyan' style='height: ${height}px; width: ${width}px;' src='${bn}-page${page}(Cyan).jpg' />" >> 00-${bn}-plates.html
echo " <img class='magenta' style='height: ${height}px; width: ${width}px;' src='${bn}-page${page}(Magenta).jpg' />" >> 00-${bn}-plates.html
echo " <img class='yellow' style='height: ${height}px; width: ${width}px;' src='${bn}-page${page}(Yellow).jpg' />" >> 00-${bn}-plates.html
echo " <img class='black' style='height: ${height}px; width: ${width}px;' src='${bn}-page${page}(Black).jpg' />" >> 00-${bn}-plates.html
echo "</div>" >> 00-${bn}-plates.html
done
cat ../colorSeparation_footer.html >> 00-${bn}-plates.html