How to save an image using its URL

51 views (last 30 days)
Arthur Melo
Arthur Melo on 16 Oct 2014
Commented: Arthur Melo on 17 Oct 2014
I did this steps and it didn't worked!
url_img =
name_file_img =
20141015-00:00.jpg
>> urlwrite(url_img, name_file_img); Error using urlreadwrite>getFileOutputStream (line 245) Could not open output file "C:\Users\Albm\Documents\MATLAB\2014\10\15\2014\10\15\2014\10\15\2014\10\15\20141015-00:00.jpg".
Error in urlreadwrite (line 69) [file,outputStream] = getFileOutputStream(inputs.filename);
Error in urlwrite (line 38) [f,status] = urlreadwrite(mfilename,catchErrors,url,filename,varargin{:});

Accepted Answer

matt dash
matt dash on 17 Oct 2014
You just can't have a colon in a file name, that's all.
  2 Comments
Arthur Melo
Arthur Melo on 17 Oct 2014
Thanks everybody and sorry, but matt dash gave me the perfect answer, some times we forget too basics things. I don't know why. Thank you matt, now I have no problem.

Sign in to comment.

More Answers (1)

Image Analyst
Image Analyst on 17 Oct 2014
You need to use imwrite() if you want to save an image, not urlwrite().
  1 Comment
Image Analyst
Image Analyst on 17 Oct 2014
This code saves the image to my computer just fine for me. Does it work for you?
% Specify the filename (URL).
filename = 'http://satelite.cptec.inpe.br/repositorio7/goes13_met10/goes13_met10_web/ams_afc_alta_jpg/2014/10/S11185873_201410150000.jpg';
% Read it in to a variable in my m-file.
rgbImage = imread(filename);
% Display the image.
imshow(rgbImage);
% Save the image to a file on my local hard drive.
imwrite(rgbImage, 'satellite image.jpg');

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!