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.

I have a larger png image: width is 5400 pixels and height is 3850 pixels. I need to transform it into a pdf file in SPA3 size, which means 320mm x 450mm. Is there a way to do it with LaTeX? What I think I need, is to be able to specify the paper size explicitly and to tell LaTeX that there should not be anything around the image.

share|improve this question
1  
Welcome to TeX.SE. –  Peter Grill Nov 30 '12 at 8:21
    
Peter Grill, thank you. I am here just few minutes and it already saved me hours of search and work! :) –  Roman Nov 30 '12 at 8:28
    
Isn't it SRA3 according to Paper size/Wikipedia? –  Heiko Oberdiek Nov 30 '12 at 9:40

2 Answers 2

up vote 17 down vote accepted

You can use the standalone class which will produce a pdf with no border. If you want a small border you can add [border=<length>] class option.

Notes:

  • As LionelMANSUY mentioned in the comments it is usually preferable to use keepaspectratio, but if specific dimensions of both height and width are required, using `keepaspectratio may conflict with those requirements..

Code:

\documentclass{standalone}
\usepackage{graphicx}
\begin{document}
    \includegraphics[width=320mm,height=450mm]{../images/EiffelWide}
\end{document}
share|improve this answer
2  
Thanks a lot! It works perfectly! I love stackexchange. It works so fast and so effective (of course because of its users). –  Roman Nov 30 '12 at 8:27
8  
Your welcome.. But keep in mind this is TeX.SE -- I think this site is a whole lot friendlier than your regular stackexchange. :-) –  Peter Grill Nov 30 '12 at 8:28
2  
@PeterGrill Is it not preferable to append also the keepaspectratio option? –  Lionel MANSUY Nov 30 '12 at 8:55
2  
@LionelMANSUY: Well yes, but since both the height and width are fixed amounts, not sure it makes sense to also specify keepaspectratio? –  Peter Grill Nov 30 '12 at 8:57
    
@PeterGrill If I don't mistake, when you write both height and width, you will have a disproportionated picture if the values are not proportional to the source picture's ones. Here: 5400/3850=1.403 and 450:320:1.406; the difference is here negligible but still exist –  Lionel MANSUY Nov 30 '12 at 9:54

Media size (SRA3): 320mm x 450mm
Image size: 5400px x 3850px

  • Media or image needs to be rotated to prevent severe distortion of the image (keepaspectratio=false) or larger margins (keepaspectratio=true).

  • Package geometry can be used to set the paper size and package pdfpages also works with images.

  • If the image is rotated, then package pdflscape tells the PDF viewer to rotate the viewed page.

  • After rotation the ratios are 1.40625 vs. 1.4026. The difference is quite small, depending on the image and application distortion of the image might be acceptable to avoid a small margin otherwise.

  • The margin area can be colored using \pagecolor of package graphics (also loaded by package pdfpages).

Some examples that uses a lolcat.jpg from a StackExchange error page (also found here).

Media rotation without distortion, black margins

\documentclass{article}
\usepackage[
  paperwidth=320mm,
  paperheight=450mm,
  landscape,
]{geometry}
\usepackage{pdfpages}
\pagecolor{black}

\begin{document}
  \includepdf{lolcat.jpg}
\end{document}

Cat on rotated media with black margins

Image rotation with distortion

\documentclass{article}
\usepackage[
  paperwidth=320mm,
  paperheight=450mm,
]{geometry}
\usepackage{pdflscape}
\usepackage{pdfpages}

\begin{document}
  \begin{landscape}
    \includepdf[
      angle=90,
      keepaspectratio=true,
      width=\paperwidth,
      height=\paperheight
    ]{lolcat.jpg}
  \end{landscape}
\end{document}

Rotated cat with distortion

share|improve this answer
5  
Isn't it time you bought your cat a new computer? –  David Carlisle Nov 30 '12 at 11:04
1  
@DavidCarlisle AFAIK the cat is from StackExchange. Some image that is shown in case of errors. –  Heiko Oberdiek Nov 30 '12 at 11:20
5  
@David's cat uses Vim. :) –  Paulo Cereda Nov 30 '12 at 13:03

Your Answer

 
discard

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.