MATLAB Answers

Save figure as jpg with 600dpi

133 views (last 30 days)
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
Jan on 4 Sep 2019
Whenever you mention an error in the forum, post a copy of the complete message.

Sign in to comment.

Accepted Answer

Jan
Jan on 4 Sep 2019
Edited: Jan on 4 Sep 2019
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

Nikolas Spiliopoulos
Nikolas Spiliopoulos on 4 Sep 2019
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
Jan on 4 Sep 2019
Okay. And with '-djpeg' ?
Nikolas Spiliopoulos
Nikolas Spiliopoulos on 4 Sep 2019
with -djpeg it's working, just wondering if there is any option for jpg

Sign in to comment.

More Answers (1)

Fabio Freschi
Fabio Freschi on 4 Sep 2019
In print command, for jpg images, the flag is '-djpeg'

  0 Comments

Sign in to comment.

Sign in to answer this question.

Tags


Translated by