MATLAB Answers

0

Save figure as jpg with 600dpi

Asked by Nikolas Spiliopoulos on 4 Sep 2019
Latest activity Commented on by Nikolas Spiliopoulos on 4 Sep 2019
Accepted Answer by Jan
Hi all,
I am trying to save some figures through coding, in jpg format and 600dpi.
Hovewer I have tried these, but still getting error (Matlab version 2019a)
saveas('figure.jpg')
print(gcf,'figure.jpg','-jpg','-r600');
thanks in advance

  1 Comment

Jan
on 4 Sep 2019
Whenever you mention an error in the forum, post a copy of the complete message.

Sign in to comment.

Tags

2 Answers

Jan
Answer by Jan
on 4 Sep 2019
Edited by Jan
on 4 Sep 2019
 Accepted Answer

saveas('figure.jpg')
The first input must be the handle of a figure.
print(gcf, 'figure.jpg', '-jpg', '-r600');
There is no '-jpeg' option for the print command. Do you mean '-djpeg' ?

  3 Comments

Hi there,
thanks for the anwser . I tried this and I get an errror
Error using inputcheck
Illegal option '-jpg' given.
Error in inputcheck
Error in print (line 41)
[pj, devices, options ] = inputcheck( pj, inputargs{:} );
Jan
on 4 Sep 2019
Okay. And with '-djpeg' ?
with -djpeg it's working, just wondering if there is any option for jpg

Sign in to comment.


Answer by Fabio Freschi on 4 Sep 2019

In print command, for jpg images, the flag is '-djpeg'

  0 Comments

Sign in to comment.