Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #4426

Compression of Plot[] to reduce notebook size

From "McHale, Paul" <Paul.McHale@excelitas.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Compression of Plot[] to reduce notebook size
Date 2011-08-16 05:26 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <j2cv27$hes$1@smc.vnet.net> (permalink)

Show all headers | View raw


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@Excelitas.com<mailto:Paul.McHale@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

Back to comp.soft-sys.math.mathematica | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

Compression of Plot[] to reduce notebook size "McHale, Paul" <Paul.McHale@excelitas.com> - 2011-08-16 05:26 +0000
  Re: Compression of Plot[] to reduce notebook size "Rolf.Mertig@gmail.com" <rolf.mertig@gmail.com> - 2011-08-19 10:41 +0000

csiph-web