[Tex/LaTex] CMYK poster example: fitting pdf page size to (bitmap) image size

graphicspaper-sizepdftex

(This could be a question going a bit out from pure LaTeX zone – if so, feel free to migrate)

Let's assume I'd want to make an poster, for now A4 in size. Let's say I've made this poster in inkscape, and have exported a 300 PPI bitmap; for A4, that should give me a bitmap with size of 2479×3508 pixels.

Just to make sure we have the same reference, here's some code that will generate such a bitmap (via "convert – Imagemagick: generate image with page size and resolution? – Stack Overflow"):

convert xc:white -page A4 myout.pdf
TSIZE=$(convert -density 300x300 myout.pdf -format "%[fx:w]x%[fx:h]" info:)
convert -density 300x300 -size $TSIZE myout.pdf gradient:\#4b4-\#bfb -pointsize 72 -draw "text 25,235 'test'" -flatten myout.png

Then, I'd try to include this image, myout.png in a .tex document, and compile it with pdflatex to get a PDF; however, the naive:

\documentclass[a4paper]{article}
\usepackage{graphicx}
\begin{document}
\includegraphics{myout.png}
\end{document}

… will generate two pages (pdflatex flushing the image on second page, as it cannot fit on first) – and also, article class has margins, which here should not be needed (as the entire myout.png should take up the entire pdf page).

The second problem relates to the color space – the above convert example, generates a myout.png which is RGB. Apparently, "the PNG file format doesn't support CMYK" (Adobe Forums: png from cmyk) – so, I could use a TIFF format instead for CMYK, but then pdflatex seems not to support TIFF ([pdftex] Why was TIF support removed?).

 

So, I guess my questions can be summarized as:

  • How can I generate an A4 PDF, from an a4@300 PPI bitmap, using pdflatex (or if there is a better alternative to pdflatex, which one?)
  • Which image format should I use, so that I ensure that the generated PDF file is in CMYK color mode?

Best Answer

How can I generate an A4 PDF, from an a4@300 PPI bitmap, using pdflatex (or if there is a better alternative to pdflatex, which one?)

You can use the standalone class to get a PDF which is just as large as the the image, which gives you A4 if the image is in the size of A4. If the image is actually a PDF document the pdfpages package would be better suited.

\documentclass[border=0]{standalone}
% For older version without the `border` option:
% \renewcommand{\PreviewBorder}{0bp}
\usepackage{graphicx}
\begin{document}
\includegraphics{someA4image.png}
\end{document}

Which image format should I use, so that I ensure that the generated PDF file is in CMYK color mode?

If you are going to use pdflatex there are only PDF, PNG and JPG (or maybe MetaPost, but that support might also been dropped). You shouldn't use JPG because of the loss of quality. If you don't want to use PDF than only PNG remains. You could export the inkscrape document to EPS and import this in a DVI/PS latex document instead. Or convert the EPS to PDF using epstopdf and hope your printer likes it.

I personally wouldn't try to export, convert and import a poster from one software to the other like that. I would mind the loss of quality and the arising troubles.