[pstricks] Producing good PNG files

hh-brasil at bol.com.br hh-brasil at bol.com.br
Mon Jan 11 11:26:34 CET 2010


The one way I use to get small figures without an A4 background: make a pdf-file out of it and use pdfcrop

Then you can safe them again as eps-file (e.g. with Acrobat Pro) and do what you want.

hh



Em 09/01/2010 19:05, Blair Hall < bidihall at gmail.com > escreveu:
At 05:35 p.m. 7/01/2010, Michael Sharpe wrote:

Thanks for the suggestion Michael, I have tried this but it does not help. The gs command transforms my whole A4 page into a PNG file even though the figure is a small part of it. I have set the EPS bounding box to an appropriate size, but ghostscript ignores that.


I am working from a simple LaTeX file to do these tests. It looks something like this:

\documentclass{article}

\usepackage{graphicx}
\usepackage{amsmath}

\usepackage{pstricks}
\usepackage{pstricks-add}


% etc, etc

\pagestyle{empty}

\begin{document}

\begin{TeXtoEPS}

\begin{pspicture}(-.5,-.5)(5,3)
\scalebox{1} {
  % my test figure
}
\end{pspicture}

\end{TeXtoEPS}

\end{document}

 
Any idea what I am doing wrong?

Thanks

Blair

On Jan 6, 2010, at 6:46 PM, B.D. Hall wrote:


> I am sure there has to be a way to do this well, but 2 days of mucking around have not solved my problem. I am looking for some advice please.

> 

> I have plenty of drawings that have been developed using PSTricks. Now someone has asked me contribute to a Mediawiki site and I need to transform some of these into a .png format (or other format accepted by mediawiki, like jpeg).


> 

> I have not been able to transfom PostScript or PDF versions of my figures into .png without quite a lot of degradation in their appearance. (I have used things like Gimp, GSView, and ImageMagick but nothing has really done the trick). It seems that the rasterizing of the ps or pdf information is not very satisfactory (but I'm just guessing).


> 

> I have used LatexDraw to construct many of the figures and I have to say that that program can export to a PNG file that looks OK. However, if I use any LaTeX math symbols in the drawing then they are not handled by the exporting software. (I assume therefore that what is exported is not really derived from PSTricks in this case).


> 

> So my question is this: can anyone advise me on how to produce reasonable png files from my existing PSTricks / LaTeX sources? It has to be possible, I say to myself, because I can see all these nice figures on PSTrick's page on Wikipedia!


> 

> Thanks in advance

> 

> Blair

> 


All the tools I know about call ghostscript in the end, so you may not get much greater quality from any one particular tool---it's a matter of the settings. The png16m output format is usually good (24 bit RGB). (Use pngalpha for 32 bit RGBA.)



You should get good screen output from


gs -dSAFER -dBATCH -dNOPAUSE -sDEVICE=png16m -r96 -dGraphicsAlphaBits=4 -sOutputFile=xxx.png xxx.ps


Michael





More information about the PSTricks mailing list