Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

(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 2479x3508 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:


... 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?
share|improve this question
Uh, why rasterize the poster — lose quality, increase file size and likely rendering time — if you have it in vector format? You can export and include EPS or PDF graphics. –  Andrey Vihrov May 8 '11 at 21:27
@Andrey Vihrov - you're right; but I just had a bad experience with a PDF from Inkscape, where the printer couldn't resolve the transparencies; so now I'd like to try to rasterize beforehand :) Cheers! –  sdaau May 8 '11 at 21:35
Why do you want to include it in a LaTeX document? To convert the PNG to PDF? Or do you want to add some text? –  Martin Scharrer May 8 '11 at 21:58
@Martin Scharrer - Latex simply because its the tool that I use most often to generate PDFs, and so it's my first thought whenever I get this kind of a task... So it's good to have documented somewhere, what its behavior is in this context :) Cheers! –  sdaau May 9 '11 at 4:45
add comment

2 Answers

up vote 2 down vote accepted

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.

% For older version without the `border` option:
% \renewcommand{\PreviewBorder}{0bp}

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.

share|improve this answer
Thanks, @Martin Scharrer, for the nice explanation of how PdfLatex behaves in this context - indeed, maybe it will be better to use convert to generate a PDF from a CMYK bitmap (or maybe it will be the best I just send a rasterized CMYK TIFF to the printing company).. Thanks again, cheers! –  sdaau May 9 '11 at 4:47
add comment

OK, this is possibly off topic - but I just wanted to document some steps that worked for me to get the RGB myout.png (from above OP) as a CMYK pdf:

# convert RGB png to CMYK tiff:
convert myout.png -depth 8 -colorspace cmyk -alpha Off myout-cmyk.tiff

# convert CMYK tiff to CMYK eps
gs -r300x300 -g$TSIZE -dNODISPLAY -- tif2eps.ps myout-cmyk.tiff -v2 -d300x300 -r1 -o1 myout-cmyk.eps

# convert CMYK eps to CMYK pdf:
gs -o myout-cmyk.pdf -sDEVICE=pdfwrite -dPDFFitPage -r300x300 -g$TSIZE myout-cmyk.eps



  • While seemingly there would be a way to directly convert a TIFF to PDF using tiff2pdf myout-cmyk.tiff -p A4 -x 300 -y 300 -o myout-cmyk.pdf, this unfortunately produces a tiny image on an A4 page
  • By default, it seems Imagemagick's convert will generate a 16-bit, CMYKA (5 Samples/Pixel, CMYK with alpha) TIFF; hence must explicitly specify 8-bit depth and alpha off (resulting TIFF can be checked with tiffinfo); apparently only 8-bit CMYK is well supported in eog/gimp
    • Apparently, for proper RGB-CMYK conversion one should use icc profiles; but the above command also seems to work
  • For the EPS generation, tif2eps (also on CTAN) is used; which is a PostScript program executed by gs.
    • Note that the first -r argument is resolution option directly for gs; and the second -r argument is an argument to the tif2eps program meaning "reduction (scaling)" (which btw, apparently must be set to 1 so the original full size remains)
  • For PDF generation, possibly it's easier to use ps2pdf -sPAPERSIZE=a4 myout-cmyk.eps myout-cmyk.pdf (but the above command should also work)

To check the resulting PDF, I first used Imagemagick's identify:

$ identify -verbose myout-cmyk.pdf
  Geometry: 595x842+0+0
  Resolution: 72x72
  Print size: 8.26389x11.6944
  Units: Undefined
  Type: ColorSeparation
  Base type: ColorSeparation
  Endianess: Undefined
  Colorspace: CMYK
  Depth: 16/8-bit
  Channel depth:
    cyan: 8-bit
    magenta: 8-bit
    yellow: 8-bit
    black: 8-bit
  Page geometry: 595x842+0+0
    pdf:HiResBoundingBox: 595x842+0+0
  Filesize: 2.004MB
  Number pixels: 501K

While this report confirms the PDF is CMYK (also confirmed by the histogram), I found the sizes a bit confusing. I guess the way it works, is that identify, as part of Imagemagick, is oriented towards raster images; and apparently, it may call on Ghostscript for the vector-type files. Ghostscript, then apparently works in 'point' units that are 1/72ths of an inch. So for an A4, we'd have:

A4:        8.26389 x    11.6944 in  
A4*72:   594.96    x   841.92   pts  
A4*300: 2479       x  3508      pixels

... that is, identify will not report on the resolution of the embedded image - but always report A4 page as 594x841 points in size, which in respect to length in inches, will always give 72 "dpi" (...and thus, I guess, report "Number pixels: 501K", which is close to 594*841=499554). So I cannot really tell if the input TIFF ended up in the PDF without loss of resolution :) (but it looks like it). Additionally, pdfinfo can help tell if the image has been "stretched" properly:

$ pdfinfo -box myout-cmyk.pdf
Page size:      594.96 x 841.92 pts (A4)
MediaBox:           0.00     0.00   594.96   841.92
CropBox:            0.00     0.00   594.96   841.92
BleedBox:           0.00     0.00   594.96   841.92
TrimBox:            0.00     0.00   594.96   841.92
ArtBox:             0.00     0.00   594.96   841.92
File size:      60815 bytes



share|improve this answer
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.