Hi JJ, I just want to confirm that changing pswrite to ps2write fixes the issue for me. Since no-one else replied to this thread, is this something we should ask the ghostscript mailing list about?
Cheers, Tom On 13 March 2011 10:01, Jae-Joon Lee <lee.j.j...@gmail.com> wrote: > Okay, I just confirmed that using a gs distiller greatly increases the > file size with gs 9.0. > I have no idea what's going on and I hope that someone more > knowledgeable than me steps in. > Meanwhile, using the "ps2write" device with gs seems to solve the > issue (but I'm not sure of its consequences). > So, can you test if the workaround works? > > In lib/matplotlib/backends/backend_ps.py, search for the following > line in the "gs_distill" function, > > command = '%s -dBATCH -dNOPAUSE -r%d -sDEVICE=pswrite %s -sOutputFile="%s" > \ > > and replace "pswrite" with "ps2write". > > Regards, > > -JJ > > > > > On Sun, Mar 13, 2011 at 1:45 AM, Thomas Robitaille > <thomas.robitai...@gmail.com> wrote: >> Hi Jae-Joon, >> >> Ok, that makes sense - I tried upgrading to 9.0.1 and it looks like there is >> still an issue: >> >> 6204 test_1.eps >> 34104 test_2.eps >> >> Cheers, >> Tom >> >> On Mar 12, 2011, at 11:38 AM, Jae-Joon Lee wrote: >> >>> Note that, even with usetex=False, you have a large ps file when >>> distiller is used . >>> When usetex=True, the distiller is always used (if distiller=None, >>> ghostscript is used). >>> Therefore, my guess is that the large file size is results of >>> distilling using the ghostscript. >>> I wonder if this is an issue of gs 9.0 version. >>> In my installation (gs 8.xx), the original ps file is about 6 M (both >>> usetex=True and False), and when they are distilled, their size is >>> reduced down to 4 M. >>> >>> I'll try to test gs 9.0 when I get a chance. >>> Meanwhile, can you try to upgrade to gs 9.01 and see if it changes anything? >>> >>> Regards, >>> >>> -JJ >>> >>> >>> >>> On Sat, Mar 12, 2011 at 2:46 AM, Thomas Robitaille >>> <thomas.robitai...@gmail.com> wrote: >>>> Hi Jae-Joon, >>>> >>>> I tried inserting: >>>> >>>> mpl.rc('ps', usedistiller=None) >>>> >>>> after importing matplotlib, and I get: >>>> >>>> $ du -sk *.eps >>>> 6204 test_1.eps >>>> 34104 test_2.eps >>>> >>>> using 'ghostscript' I get: >>>> >>>> $ du -sk *.eps >>>> 34096 test_1.eps >>>> 34104 test_2.eps >>>> >>>> and using 'xpdf' raises an exception: >>>> >>>> File >>>> "/Users/tom/Library/Python/2.6/site-packages/matplotlib/backends/backend_ps.py", >>>> line 1091, in _print_figure >>>> xpdf_distill(tmpfile, isEPSF, ptype=papertype, bbox=bbox) >>>> File >>>> "/Users/tom/Library/Python/2.6/site-packages/matplotlib/backends/backend_ps.py", >>>> line 1421, in xpdf_distill >>>> image.\nHere is the full report generated by pdftops: \n\n' + fh.read()) >>>> RuntimeError: pdftops was not able to process your image. >>>> Here is the full report generated by pdftops: >>>> >>>> I don't have a matplotlibrc file, and I am using: >>>> >>>> Ghostscript: GPL Ghostscript 9.00 (2010-09-14) >>>> LaTeX: Version 3.1415926-1.40.10 (TeX Live 2009) >>>> >>>> and I'm using the latest head from github for matplotlib. >>>> >>>> Cheers, >>>> Tom >>>> >>>> On Mar 8, 2011, at 7:31 AM, Jae-Joon Lee wrote: >>>> >>>>> With current master at git repo, I cannot reproduce this. >>>>> Both test_1.eps and test_2.eps are ~4M in size. >>>>> >>>>> Can you check if the file size varies significantly with rc parameters >>>>> ps.usedistiller? >>>>> I'm not sure how text setting can affect the images. >>>>> >>>>> Regards, >>>>> >>>>> -JJ >>>>> >>>>> >>>>> >>>>> On Tue, Mar 1, 2011 at 7:23 AM, Thomas Robitaille >>>>> <thomas.robitai...@gmail.com> wrote: >>>>>> Hi, >>>>>> >>>>>> In the following example: >>>>>> >>>>>> --- >>>>>> >>>>>> import numpy as np >>>>>> >>>>>> import matplotlib as mpl >>>>>> mpl.use('Agg') >>>>>> import matplotlib.pyplot as plt >>>>>> >>>>>> fig = plt.figure() >>>>>> ax = fig.add_subplot(1, 1, 1) >>>>>> ax.imshow(np.random.random((1024, 1024)), interpolation='nearest') >>>>>> fig.savefig('test_1.eps') >>>>>> >>>>>> mpl.rc('text', usetex=True) >>>>>> >>>>>> fig = plt.figure() >>>>>> ax = fig.add_subplot(1, 1, 1) >>>>>> ax.imshow(np.random.random((1024, 1024)), interpolation='nearest') >>>>>> fig.savefig('test_2.eps') >>>>>> >>>>>> --- >>>>>> >>>>>> the file test_2.eps is almost 6 times larger than test_1.eps, and takes >>>>>> much longer to draw. It looks like in the first case, the image is >>>>>> rendered as a bitmap (the way it should be), whereas in the second case >>>>>> each pixel is drawn individually as a polygon. Is this a bug? >>>>>> >>>>>> I am using r8988 of matplotlib. >>>>>> >>>>>> Thanks for any help! >>>>>> >>>>>> Thomas >>>>>> ------------------------------------------------------------------------------ >>>>>> Free Software Download: Index, Search & Analyze Logs and other IT data in >>>>>> Real-Time with Splunk. Collect, index and harness all the fast moving IT >>>>>> data >>>>>> generated by your applications, servers and devices whether physical, >>>>>> virtual >>>>>> or in the cloud. Deliver compliance at lower cost and gain new business >>>>>> insights. http://p.sf.net/sfu/splunk-dev2dev >>>>>> _______________________________________________ >>>>>> Matplotlib-users mailing list >>>>>> Matplotlib-users@lists.sourceforge.net >>>>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >>>>>> >>>> >>>> >> >> > ------------------------------------------------------------------------------ Benefiting from Server Virtualization: Beyond Initial Workload Consolidation -- Increasing the use of server virtualization is a top priority.Virtualization can reduce costs, simplify management, and improve application availability and disaster protection. Learn more about boosting the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users