Document Classeseps figures anitialias problem?

Information and discussion about specific document classes and how to create your own document classes.
Post Reply
gregatustra
Posts: 9
Joined: Fri Apr 25, 2008 11:56 am

eps figures anitialias problem?

Post by gregatustra »

Hello, i have two png images (attached) and i convert them to eps with GIMP. I want to use eps because i have also some diagrams (vector ones) and i want to use them in my documents.

The code is simple:

Code: Select all

\begin{figure}[h]
	\includegraphics[width=0.5\textwidth]{image1.eps}
	\includegraphics[width=0.7\textwidth]{image2.eps}
\end{figure}
I make a PDF out of it but the first image looks blurry, the second one looks OK (pay attention at the text in the image titles or the graph).

I found out the problem is connected with the colors on the first image and antialiasing, but i cant understand how to fix that. For example, if i cut the first image and only use the title (i delete the graph), the blurring is gone and everything is fine.
I use miktex: latex -> dvips -> ps2pdf -> view pdf with adobe acrobat reader

The commands on windows are:

latex -interaction=nonstopmode %.tex
dvips -o %.ps %.dvi
ps2pdf %.ps

It seems the images in the ps file are looking fine.

Does anybody have an explanation?

See attached images (the eps images are just exported with gimp+ghostscript from png)
Attachments
eps_problem.zip
Resulting pDF, 2 png images, 2 eps images and the .tex file are in the zip archive
(122.15 KiB) Downloaded 241 times

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
User avatar
localghost
Site Moderator
Posts: 9201
Joined: Fri Feb 02, 2007 12:06 pm

eps figures anitialias problem?

Post by localghost »

The better way would be to convert the EPS files to PDF with epstopdf or "on the fly" with the epstopdf package. You then could use your PNG images without any loss in quality and compile your document to PDF directly using pdflatex. The related documentations show you how to get things work.


Best regards
Thorsten¹
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes[/size]

¹ System: openSUSE 42.2 (Linux 4.4.52), TeX Live 2016 (vanilla), TeXworks 0.6.1
gregatustra
Posts: 9
Joined: Fri Apr 25, 2008 11:56 am

eps figures anitialias problem?

Post by gregatustra »

OK this could work, except if i convert my diagrams from eps to pdf (i am using Inkscape), there is the problem that one whole page is made (A4), and after including the pdf inside my tex file:

Code: Select all

   \includegraphics[width=0.5\textwidth]{diagram.pdf}
In the place where the picture should be there is the resized A4 page of the PDF with the small version of the diagram in the upper left corner.

br,
Grega
User avatar
localghost
Site Moderator
Posts: 9201
Joined: Fri Feb 02, 2007 12:06 pm

eps figures anitialias problem?

Post by localghost »

Provided that there is nothing else on the page but the diagram, you can reduce the file with pdfcrop to the pure graphics. Perhaps you should give a bounding box when exporting your diagrams with Inkscape. There is an option when saving the file as EPS to set a bounding box around the whole page. Uncheck that option and it should work fine after converting the files to PDF.
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes[/size]

¹ System: openSUSE 42.2 (Linux 4.4.52), TeX Live 2016 (vanilla), TeXworks 0.6.1
User avatar
Juanjo
Posts: 657
Joined: Sat Jan 27, 2007 12:46 am

Re: eps figures anitialias problem?

Post by Juanjo »

Use the trim option of \includegraphics. Take a look at the attached zip file. I've put the graphic inside a framed box to present more clearly the effect of such an option.
Attachments
eps_problem.zip
(65.47 KiB) Downloaded 264 times
gregatustra
Posts: 9
Joined: Fri Apr 25, 2008 11:56 am

eps figures anitialias problem?

Post by gregatustra »

I choose the path of converting all my diagrams from eps to pdf. So now i can use my images (png) and include also the diagrams in vector form (pdf) and compile everything with latexpdf.

Since all my diagrams were made in Inkscape, i wanted my output pdf to cover the whole diagram, not an A4 page for example with the diagram in the upper left corner.

One way for taking just the diagram was trimming (tnx Juanjo!), the other was to somehow tell Inkscape to make the diagram fit the whole page.

I found this on the web:
As of version 0.45: when you export an object to PDF or EPS, the figure's bounding box is the canvas (probably the page) rather than a tight box around the object. If you want a tight box, select your object (with the rubber band selector) and use "Fit Page to Selection" in the "Document Properties" (File/Document Properties) dialog to crop the canvas tightly around the object. Then, you can export to PDF or EPS and get the bounding box you want. There isn't really a way to automate this process by using Inkscape's command-line options.
So now its great. Tnx everyone for the advices and the help.

Greg
Post Reply