Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Converting EPS w/ crop marks to PDF w/ TrimBox+CropBox and final JPEG
# SPDX-License-Identifier: MIT
## Copyright (C) 2011 Przemyslaw Pawelczyk <>
## This script is licensed under the terms of the MIT license.
# Converting EPS w/ crop marks to PDF w/ TrimBox+CropBox and final JPEG
# Simple script with brief explanation
# 2+3D 40th anniversary issue (10 years) cover contest
# EPS in:
# EPS file name w/o extension
# Sanitize EPS
eps2eps $EPS.eps $EPS-eps2eps.eps
# Convert it to PDF
epstopdf --hires $EPS-eps2eps.eps
# Prepare LaTeX file using previously obtained PDF, and define there some PDF
# boxes as in the comments from original EPS
## (BTW you can create your cover now in LaTeX, have fun!)
cat >$EPS-withcrop.tex <<_EOF
% Below MediaBox is commented, because pdflatex outputs its own according to
% page size, which has a bit lesser but still acceptable accuracy.
%% 234.65mm x 305.40mm
%/MediaBox[0 0 665.1495 865.7012]
%% 209.25mm x 280.00mm
/TrimBox[36.0000 36.0000 629.1495 829.7012]
/CropBox[36.0000 36.0000 629.1495 829.7012]
# Generate final PDF
pdflatex $EPS-withcrop.tex
# Convert it to high-quality trimmed JPEG
convert -verbose -density 437x435.4 -define pdf:use-trimbox=true $EPS-withcrop.pdf \
-resize 33.333% -quality 100 $EPS-trimmed.jpg

This comment has been minimized.

Copy link
Owner Author

@przemoc przemoc commented Feb 6, 2018

commit 74489e18be19ecb24f74a5ad68838d6905fa816c
Author:     Przemyslaw Pawelczyk <>
AuthorDate: 2018-02-06 13:53:53 +0100 Relicense to MIT.

commit cdb1724e53d526c10f972c6ef96963143520ea09
Author:     Przemyslaw Pawelczyk <>
AuthorDate: 2018-02-06 13:55:26 +0100

    Add SPDX License Identifier.

    The Software Package Data Exchange (SPDX) is a good initiative, it has
    matured over time and deserves accelerated adoption in open-source.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment