From: Jesse on 26 Apr 2010 20:03 If I use code such as: fig1 = figure(....); .... saveas(fig1, 'myfilename.jpg'); The saved file can look terrible because the figure wasn't maximized prior to saving (if you save it after maximising yourself, then it looks fine). Is there some way I can maximize the figure after creating it so that it saves properly? Thanks, Jesse
From: ImageAnalyst on 26 Apr 2010 20:26 set(gcf, 'Position', get(0,'Screensize')); % Maximize figure.
From: Jesse on 26 Apr 2010 22:36 ImageAnalyst <imageanalyst(a)mailinator.com> wrote in message <cd4efb1f-1040-4539-9ba0-a54415db9fc4(a)b33g2000yqc.googlegroups.com>... > set(gcf, 'Position', get(0,'Screensize')); % Maximize figure. Thanks, That seems to work. However, when I resize my figures (about a dozen of them) before saving, I end up getting a whole bunch of java exceptions which (kind of) crash matlab and definetely make the figures crash. The problem seems to be that matlab can't keep up with the screen repaint due to the resizing. The exceptions are: Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space at java.awt.image.DataBufferInt.<init>(Unknown Source) at java.awt.image.Raster.createPackedRaster(Unknown Source) at java.awt.image.DirectColorModel.createCompatibleWritableRaster(Unknown Source) at sun.awt.image.SunVolatileImage.getBackupImage(Unknown Source) at sun.awt.image.VolatileSurfaceManager.getBackupSurface(Unknown Source) at sun.awt.image.VolatileSurfaceManager.initialize(Unknown Source) at sun.awt.image.SunVolatileImage.<init>(Unknown Source) at sun.awt.image.SunVolatileImage.<init>(Unknown Source) at sun.awt.image.SunVolatileImage.<init>(Unknown Source) at sun.awt.image.SunVolatileImage.<init>(Unknown Source) at sun.awt.windows.WComponentPeer.createVolatileImage(Unknown Source) at java.awt.Component.createVolatileImage(Unknown Source) at java.awt.Component$BltBufferStrategy.createBackBuffers(Unknown Source) at java.awt.Component$BltBufferStrategy.<init>(Unknown Source) at java.awt.Component$BltSubRegionBufferStrategy.<init>(Unknown Source) at java.awt.Component.createBufferStrategy(Unknown Source) at java.awt.Window.createBufferStrategy(Unknown Source) at javax.swing.BufferStrategyPaintManager$BufferInfo.createBufferStrategy(Unknown Source) at javax.swing.BufferStrategyPaintManager$BufferInfo.createBufferStrategy(Unknown Source) at javax.swing.BufferStrategyPaintManager$BufferInfo.getBufferStrategy(Unknown Source) at javax.swing.BufferStrategyPaintManager.prepare(Unknown Source) at javax.swing.BufferStrategyPaintManager.paint(Unknown Source) at javax.swing.RepaintManager.paint(Unknown Source) at javax.swing.JComponent.paint(Unknown Source) at java.awt.GraphicsCallback$PaintCallback.run(Unknown Source) at sun.awt.SunGraphicsCallback.runOneComponent(Unknown Source) at sun.awt.SunGraphicsCallback.runComponents(Unknown Source) at java.awt.Container.paint(Unknown Source) at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source) at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source) at javax.swing.RepaintManager.seqPaintDirtyRegions(Unknown Source) at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(Unknown Source)
From: Image Analyst on 26 Apr 2010 22:45 Jesse Sorry, I can't help you with that. The Mathworks might be able to.
From: TideMan on 26 Apr 2010 22:54
On Apr 27, 2:36 pm, "Jesse " <jessepe...(a)gmail.com> wrote: > ImageAnalyst <imageanal...(a)mailinator.com> wrote in message <cd4efb1f-1040-4539-9ba0-a54415db9...(a)b33g2000yqc.googlegroups.com>... > > set(gcf, 'Position', get(0,'Screensize')); % Maximize figure. > > Thanks, > That seems to work. However, when I resize my figures (about a dozen of them) before saving, I end up getting a whole bunch of java exceptions which (kind of) crash matlab and definetely make the figures crash. > > The problem seems to be that matlab can't keep up with the screen repaint due to the resizing. > > The exceptions are: > > Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space > at java.awt.image.DataBufferInt.<init>(Unknown Source) > at java.awt.image.Raster.createPackedRaster(Unknown Source) > at java.awt.image.DirectColorModel.createCompatibleWritableRaster(Unknown Source) > at sun.awt.image.SunVolatileImage.getBackupImage(Unknown Source) > at sun.awt.image.VolatileSurfaceManager.getBackupSurface(Unknown Source) > at sun.awt.image.VolatileSurfaceManager.initialize(Unknown Source) > at sun.awt.image.SunVolatileImage.<init>(Unknown Source) > at sun.awt.image.SunVolatileImage.<init>(Unknown Source) > at sun.awt.image.SunVolatileImage.<init>(Unknown Source) > at sun.awt.image.SunVolatileImage.<init>(Unknown Source) > at sun.awt.windows.WComponentPeer.createVolatileImage(Unknown Source) > at java.awt.Component.createVolatileImage(Unknown Source) > at java.awt.Component$BltBufferStrategy.createBackBuffers(Unknown Source) > at java.awt.Component$BltBufferStrategy.<init>(Unknown Source) > at java.awt.Component$BltSubRegionBufferStrategy.<init>(Unknown Source) > at java.awt.Component.createBufferStrategy(Unknown Source) > at java.awt.Window.createBufferStrategy(Unknown Source) > at javax.swing.BufferStrategyPaintManager$BufferInfo.createBufferStrategy(Unknown Source) > at javax.swing.BufferStrategyPaintManager$BufferInfo.createBufferStrategy(Unknown Source) > at javax.swing.BufferStrategyPaintManager$BufferInfo.getBufferStrategy(Unknown Source) > at javax.swing.BufferStrategyPaintManager.prepare(Unknown Source) > at javax.swing.BufferStrategyPaintManager.paint(Unknown Source) > at javax.swing.RepaintManager.paint(Unknown Source) > at javax.swing.JComponent.paint(Unknown Source) > at java.awt.GraphicsCallback$PaintCallback.run(Unknown Source) > at sun.awt.SunGraphicsCallback.runOneComponent(Unknown Source) > at sun.awt.SunGraphicsCallback.runComponents(Unknown Source) > at java.awt.Container.paint(Unknown Source) > at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source) > at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source) > at javax.swing.RepaintManager.seqPaintDirtyRegions(Unknown Source) > at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(Unknown Source) When I get stuff like this, it is usually because I have screwed something up previously. The best thing to do is to exit from Matlab and start again. If it happens in a new Matlab session, there is a problem............. |