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 Kommentar

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

Melden Sie sich an, um zu kommentieren.

 Akzeptierte Antwort

Jan
Jan am 4 Sep. 2019
Bearbeitet: Jan am 4 Sep. 2019

0 Stimmen

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

5 Kommentare

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 am 4 Sep. 2019
Okay. And with '-djpeg' ?
Nikolas Spiliopoulos
Nikolas Spiliopoulos am 4 Sep. 2019
with -djpeg it's working, just wondering if there is any option for jpg
DGM
DGM am 10 Nov. 2024
There is no '-djpg' device option. The option for JPG is '-djpeg'.
Walter Roberson
Walter Roberson am 10 Nov. 2024
The "-d" prefix stands for "device". The output is to be sent to the JPG "device"

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Fabio Freschi
Fabio Freschi am 4 Sep. 2019

0 Stimmen

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

Kategorien

Mehr zu Environment and Settings finden Sie in Hilfe-Center und File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by