4

I have some issues to have a good quality for images (due to scaling I presume) when compiling to pdflatex. I read if I convert bitmap images to vector images, it would be better (png -> pdf for instance). Anyone can tell me more about this?

Habi
  • 7,694
Zaertiu
  • 305
  • If the problem is scaling it means that your images have a low resolution. If those are the only images you have you have not much choice but recreate them manually with a higher resolution. If you obtained them from some other source then you can try re-export/re-scan them with higher resolution. If you give more details about the kind of images you are talking about we may be able to help more – Bordaigorl Aug 10 '15 at 12:53
  • Thank you for answering me. I'm using jpg and png images. – Zaertiu Aug 10 '15 at 12:57
  • That's not enough to help you. As I explained the important thing is how you obtain those images. – Bordaigorl Aug 10 '15 at 12:58
  • Screenshots or directly saved from the software that I use. – Zaertiu Aug 10 '15 at 13:03
  • Welcome to TeX.SX! You don't have to sign with your name since it automatically appears in the lower right corner of your post. – Habi Aug 10 '15 at 13:51
  • 4
    When you convert a png to a pdf you do not get a vector image, but a pixel graphic embedded into a pdf. As you say you have screenshots: There is generally not much that you can do. You could replicate the image as a vector graphic but this would be rather tedious in most cases. Make sure you have a high resolution image (for a screenshot: do not make the image larger than it originally was, rather smaller) with no compression artifacts, the result will look fine then. – Bort Aug 10 '15 at 13:56
  • Hello, thank you for this detailed answer. Converting png to pdf, you got a pixel graphic embedded. It is better for pdflatex ? – Zaertiu Aug 10 '15 at 14:05
  • @Zaertiu If you have a .png image, use this one with pdflatex instead of converting it to .pdf. – Habi Aug 10 '15 at 14:20
  • @Zaertiu Do you obtain your images by capturing screenshots from PDF? How is the quality of the original a PDF file? Good? Bad? Is it vector? Does it scale and do not pixelate while you zoom in? – Ho1 Aug 10 '15 at 14:26
  • @Ho1 Mainly screenshots came from PDF, and the quality is good. It is not a vector image because I saved it in PNG/JPG format. When I zoom it, it pixelate (due to scaling I guess). – Zaertiu Aug 10 '15 at 14:32
  • 1
    @Zaertiu If the original picture is not vector, the most you can do is extracting the image from the PDF instead of making screenshots of it. If you are on windows, clicking on the image in image selection mode gives you the ability to copy it. If you are on linux, use pdfimages command to extract the image from the desired page. Also, you can directly crop the PDF and embed the picture in your output. See an example: http://tex.stackexchange.com/questions/25806/how-can-i-crop-included-pdf-documents – Ho1 Aug 10 '15 at 14:37
  • @Ho1 and Bort, thank you both for helping, it should be sufficient for me. I will be more careful when I screenshot or save images. Best regards. – Zaertiu Aug 10 '15 at 14:45

1 Answers1

6

You are exatracting images from a PDF file, so first you should find out if the original picture is vector or not. If it scale up well and does not pixelate while you zoom in, it is vector. If it pixelates, then it is not vector; it is raster.

Image describing the difference between vector and raster, from Wikipedia

If the original picture is not vector (which is the case here), the most you can do is extracting the image from the PDF instead of making screenshots of it. If you are on windows, clicking on the image in image selection mode gives you the ability to copy it. If you are on linux, use pdfimages command to extract the image from the desired page.

You can also directly crop the PDF and embed the picture in your output. It works well with both vector and raster images.

This example shows how you can do this:

\begin{figure}[htbp]
    \centering
        \includegraphics[trim=0.5cm 11cm 0.5cm 11cm, width=1.00\textwidth]{yourfile.pdf}
    \caption{Title}
    \label{fig:something}
\end{figure}
Ho1
  • 1,302