I'm creating a latex document in which I display results of some image processing experiments. In particular, I'm displaying a black and white image which has been blurred (artifically) and then had noise added to it (artificially). I want to make sure that I'm displaying this image correctly / in the standard way. My goal is to completely avoid any compression artifacts when including images in a pdf file created using pdflatex.

Currently, I have a blurry, noisy image stored in a Matlab array called b of size 1024 by 1024. The components of b are between 0 and 1. I'm saving b as a png image using Matlab's imwrite command, as follows:


First question: no compression is introduced in this step, right?

(Edit: Since b is an array of doubles with values between 0 and 1, there is a little precision lost here; I could get a slightly better result using imwrite(b,'blurryNoisyImage.png','png','bitdepth',16).)

I'm then including blurryNoisyImage.png in my .tex file, as shown in the following snippet of Latex:

\caption{Blurry, noisy image.}

I then use pdflatex to create a pdf file. (And when I call pdflatex, I don't use any special commands telling pdflatex to avoid compression when creating the pdf file.)

Second question: could any compression artifacts be introduced at this step?

Please let me know if I'm doing this the standard way, and if there's a better way that I can do this! Thank you!

  • 1
    I think PNG, by definition, uses lossless compression. If you want to make sure of this, use imread to read in a second copy of the image from your new PNG file, and compare it against the original variable b. As far as the final PDF goes, see pdftex reduce PDF size: reduce image quality? and How to make the PDFs produced by pdflatex smaller? -- I think lossless is the default everywhere. – Mike Renfro May 5 '14 at 1:37
  • Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. – Heiko Oberdiek May 5 '14 at 1:44
  • 1
    why are you scaling the image [width=\textwidth] Given your concerns I'd have thought that you wanted to generate the bitmap at the desired size and then include it without scaling. – David Carlisle May 5 '14 at 11:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.