MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Compression of Plot[] to reduce notebook size

  • To: mathgroup at smc.vnet.net
  • Subject: [mg120917] Compression of Plot[] to reduce notebook size
  • From: "McHale, Paul" <Paul.McHale at excelitas.com>
  • Date: Tue, 16 Aug 2011 01:25:51 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com

I've been trying to reduce the storage requirement of graphics (plots, tables...).  This is very useful in reducing notebook size.  It also makes it much easier to email or paste into Word.  I'm having a hard time meeting all three objectives (Notebook, Outlook and Word).  Rasterize[] works OK until plot points are low.

p1=Plot3D[Sin[x y],{x,0,2 \[Pi]},{y,0,2 \[Pi]},PlotPoints->100];
ByteCount[p1]
Show[p1]
>> 3,222,360

c1=Rasterize[p1,RasterSize->1000];
ByteCount[c1]
Show[c1]
>> 9,613,064

In this case, the original graphic is preferred.  But when I increase the plot information:

p1=Plot3D[Sin[x y],{x,0,2 \[Pi]},{y,0,2 \[Pi]},PlotPoints->300];
ByteCount[p1]
Show[p1]
>> 11,620,992

c1=Rasterize[p1,RasterSize->1000];
ByteCount[c1]
Show[c1]
>> 9,613,064

I have tried saving a Notebook with the following options:

p1=Plot3D[Sin[x y],{x,0,2 \[Pi]},{y,0,2 \[Pi]},PlotPoints->100]
Size is 2,741KB

p1=Plot3D[Sin[x y],{x,0,2 \[Pi]},{y,0,2 \[Pi]},PlotPoints->100];
Rasterize[p1,RasterSize->1000]
Size is 512KB

p1=Plot3D[Sin[x y],{x,0,2 \[Pi]},{y,0,2 \[Pi]},PlotPoints->100];
s=ExportString[p1,"JPEG2000"];
s=ImportString[s,"JPEG2000"];
Show[s]
Size is 222KB

p1=Plot3D[Sin[x y],{x,0,2 \[Pi]},{y,0,2 \[Pi]},PlotPoints->100];
s=ExportString[p1,"PNG"];
s=ImportString[s,"PNG"];
Show[s]
Size is 111KB

Of course, higher plot points is very different:
p1=Plot3D[Sin[x y],{x,0,2 \[Pi]},{y,0,2 \[Pi]},PlotPoints->300]
(*     s=ExportString[p1,"PNG"];
s=ImportString[s,"PNG"];
Show[s] *)
Size is 9,938KB

p1=Plot3D[Sin[x y],{x,0,2 \[Pi]},{y,0,2 \[Pi]},PlotPoints->300];
s=ExportString[p1,"PNG"];
s=ImportString[s,"PNG"];
Show[s]
Size is 108KB

I'm not saying any of this is a surprise.  Just empirically determining how to best optimize the storage and transmission requirements with little impact on quality.  The email size is harder to quantify.

Anyone with guidelines or input I would appreciate it.   Using graphics directly looks the best in all cases.  The size  becomes incredibly large when there are a large number of points.  Compression seems to produce results which vary with image content.  Some look good, some look terrible.  Maybe there are settings to PNG that could improve.

Thanks,
Paul


Paul McHale  |  Electrical Engineer, Energetics Systems  |  Excelitas Technologies Corp.

Phone:   +1 937.865.3004   |   Fax:  +1 937.865.5170   |   Mobile:   +1 937.371.2828
1100 Vanguard Blvd, Miamisburg, Ohio 45342-0312 USA
Paul.McHale at Excelitas.com<mailto:Paul.McHale at perkinelmer.com>
www.excelitas.com<http://www.excelitas.com>


Please consider the environment before printing this e-mail.
This email message and any attachments are confidential and proprietary to Excelitas Technologies Corp. If you are not the intended recipient of this message, please inform the sender by replying to this email or sending a message to the sender and destroy the message and any attachments.
Thank you




  • Prev by Date: Re: Cataloging apps for Finder files? (Mathematica notebooks especially)
  • Next by Date: Re: Gaussian Fourier transform approximations?
  • Previous by thread: Arbitrary graph decorations
  • Next by thread: Re: to reduce notebook size