MATLAB Answers


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)
thanks in advance

  1 Comment

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

Sign in to comment.


2 Answers

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

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' ?


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{:} );
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'


Sign in to comment.