Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Printing large figure to file

Subject: Printing large figure to file

From: Yoav Rubin

Date: 31 Oct, 2007 13:27:03

Message: 1 of 5

Hi All,
I am printing a figure that has in it an image to a tiff
file, and it seems that for large images, the created image
file holds within it only about the first 960 lines in an
image e.g., if the image is 512 x 2000, the created tiff
file is 512 x 960, is there a way to change this behavior?

thanks
Yoav

Subject: Printing large figure to file

From: Richard Quist

Date: 31 Oct, 2007 15:56:29

Message: 2 of 5

Yoav Rubin wrote:
> Hi All,
> I am printing a figure that has in it an image to a tiff
> file, and it seems that for large images, the created image
> file holds within it only about the first 960 lines in an
> image e.g., if the image is 512 x 2000, the created tiff
> file is 512 x 960, is there a way to change this behavior?
>
> thanks
> Yoav

Are you saying that the output is truncated so that you're missing some
portion of the figure in the output, or is the issue that the output has
been scaled down (so you see the full figure, but it's been compressed
to a smaller size)?

It would be helpful to know how you're printing the figure (if from the
command line, what is the exact command you're using), and what the
values of the figure's paperposition, paperpositionmode, paperunits
properties are.

--

Richard Quist
Software Developer
The MathWorks, Inc.

Subject: Printing large figure to file

From: Yoav Rubin

Date: 1 Nov, 2007 08:10:19

Message: 3 of 5

Richard Quist <rquist_nospam@mathworks.com> wrote in message
<fga8jd$f7v$1@fred.mathworks.com>...
> Yoav Rubin wrote:
> > Hi All,
> > I am printing a figure that has in it an image to a tiff
> > file, and it seems that for large images, the created image
> > file holds within it only about the first 960 lines in an
> > image e.g., if the image is 512 x 2000, the created tiff
> > file is 512 x 960, is there a way to change this behavior?
> >
> > thanks
> > Yoav
>
> Are you saying that the output is truncated so that you're
missing some
> portion of the figure in the output, or is the issue that
the output has
> been scaled down (so you see the full figure, but it's
been compressed
> to a smaller size)?
>
> It would be helpful to know how you're printing the figure
(if from the
> command line, what is the exact command you're using), and
what the
> values of the figure's paperposition, paperpositionmode,
paperunits
> properties are.
>
> --
>
> Richard Quist
> Software Developer
> The MathWorks, Inc.

Richard,

I am missing a portion of the image(actually most of the
image is missing - it should be around 6000x512). I tried to
do it either from the command line with the command:
print(tmpFigHandle, '-dtiffn',
'-r0','-noui','-loose','im.tiff');
where the only property is setted is the PaperPositionMode
to be auto.
I also tried from the figure's window file->print but the
result was exactly the same.

Thanks

Yoav

Subject: Printing large figure to file

From: Richard Quist

Date: 1 Nov, 2007 12:59:01

Message: 4 of 5

Yoav Rubin wrote:
> Richard Quist <rquist_nospam@mathworks.com> wrote in message
> <fga8jd$f7v$1@fred.mathworks.com>...
>> Yoav Rubin wrote:
>>> Hi All,
>>> I am printing a figure that has in it an image to a tiff
>>> file, and it seems that for large images, the created image
>>> file holds within it only about the first 960 lines in an
>>> image e.g., if the image is 512 x 2000, the created tiff
>>> file is 512 x 960, is there a way to change this behavior?
>>>
>>> thanks
>>> Yoav
>> Are you saying that the output is truncated so that you're
> missing some
>> portion of the figure in the output, or is the issue that
> the output has
>> been scaled down (so you see the full figure, but it's
> been compressed
>> to a smaller size)?
>>
>> It would be helpful to know how you're printing the figure
> (if from the
>> command line, what is the exact command you're using), and
> what the
>> values of the figure's paperposition, paperpositionmode,
> paperunits
>> properties are.
>>
>> --
>>
>> Richard Quist
>> Software Developer
>> The MathWorks, Inc.
>
> Richard,
>
> I am missing a portion of the image(actually most of the
> image is missing - it should be around 6000x512). I tried to
> do it either from the command line with the command:
> print(tmpFigHandle, '-dtiffn',
> '-r0','-noui','-loose','im.tiff');
> where the only property is setted is the PaperPositionMode
> to be auto.
> I also tried from the figure's window file->print but the
> result was exactly the same.
>
> Thanks
>
> Yoav

What release and platform are you running on?

Using r2007b (MATLAB 7.5) on windows I tried a sample picture that was
9792 x 6528, set the figure to be that same size, set the axes position
to fill the figure ([0 0 1 1]) and printed using your command. There
were some "windows resources" warnings when I created and printed the
large figure but it printed just fine. Here's the code I used:
   imgxlarge = imread('xlarge.jpg');
   fpos = [0 0 size(imgxlarge,1) size(imgxlarge,2)];
   tmpFigHandle = figure('paperpositionmode', 'auto');
   image(imgxlarge);
   set(gca, 'position', [0 0 1 1]);
   axis off;
   drawnow;
   % print at a "normal" figure size
   print(tmpFigHandle, '-dtiffn', '-r0','-noui','-loose','small1.tiff');
   set(tmpFigHandle, 'position', fpos);
   drawnow;
   % with larger figure sizes it sometimes takes an extra 'nudge'
   set(tmpFigHandle, 'position', fpos);
   % print at the big figure size
   print(tmpFigHandle, '-dtiffn', '-r0','-noui','-loose','im1.tiff');





--
Rich Quist
x7895

Subject: Printing large figure to file

From: Yoav Rubin

Date: 6 Nov, 2007 08:47:11

Message: 5 of 5

Richard Quist <rquist@mathworks.com> wrote in message
<fgciil$i49$1@fred.mathworks.com>...
> Yoav Rubin wrote:
> > Richard Quist <rquist_nospam@mathworks.com> wrote in message
> > <fga8jd$f7v$1@fred.mathworks.com>...
> >> Yoav Rubin wrote:
> >>> Hi All,
> >>> I am printing a figure that has in it an image to a tiff
> >>> file, and it seems that for large images, the created
image
> >>> file holds within it only about the first 960 lines in an
> >>> image e.g., if the image is 512 x 2000, the created tiff
> >>> file is 512 x 960, is there a way to change this behavior?
> >>>
> >>> thanks
> >>> Yoav
> >> Are you saying that the output is truncated so that you're
> > missing some
> >> portion of the figure in the output, or is the issue that
> > the output has
> >> been scaled down (so you see the full figure, but it's
> > been compressed
> >> to a smaller size)?
> >>
> >> It would be helpful to know how you're printing the figure
> > (if from the
> >> command line, what is the exact command you're using), and
> > what the
> >> values of the figure's paperposition, paperpositionmode,
> > paperunits
> >> properties are.
> >>
> >> --
> >>
> >> Richard Quist
> >> Software Developer
> >> The MathWorks, Inc.
> >
> > Richard,
> >
> > I am missing a portion of the image(actually most of the
> > image is missing - it should be around 6000x512). I tried to
> > do it either from the command line with the command:
> > print(tmpFigHandle, '-dtiffn',
> > '-r0','-noui','-loose','im.tiff');
> > where the only property is setted is the PaperPositionMode
> > to be auto.
> > I also tried from the figure's window file->print but the
> > result was exactly the same.
> >
> > Thanks
> >
> > Yoav
>
> What release and platform are you running on?
>
> Using r2007b (MATLAB 7.5) on windows I tried a sample
picture that was
> 9792 x 6528, set the figure to be that same size, set the
axes position
> to fill the figure ([0 0 1 1]) and printed using your
command. There
> were some "windows resources" warnings when I created and
printed the
> large figure but it printed just fine. Here's the code I used:
> imgxlarge = imread('xlarge.jpg');
> fpos = [0 0 size(imgxlarge,1) size(imgxlarge,2)];
> tmpFigHandle = figure('paperpositionmode', 'auto');
> image(imgxlarge);
> set(gca, 'position', [0 0 1 1]);
> axis off;
> drawnow;
> % print at a "normal" figure size
> print(tmpFigHandle, '-dtiffn',
'-r0','-noui','-loose','small1.tiff');
> set(tmpFigHandle, 'position', fpos);
> drawnow;
> % with larger figure sizes it sometimes takes an extra
'nudge'
> set(tmpFigHandle, 'position', fpos);
> % print at the big figure size
> print(tmpFigHandle, '-dtiffn',
'-r0','-noui','-loose','im1.tiff');
>
>
>
>
>
> --
> Rich Quist
> x7895
Hi Richard,

Thanks, the extra nudge did the trick

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us