File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -298,7 +298,7 @@ function mustBeValidSize(this, imagesize)
298
298
% Output the images
299
299
if isfield(response .Body .Data .data ," url" )
300
300
urls = arrayfun(@(x ) string(x .url ), response .Body .Data .data );
301
- images = arrayfun(@imread ,urls ,UniformOutput= false );
301
+ images = arrayfun(@myImread ,urls ,UniformOutput= false );
302
302
else
303
303
images = [];
304
304
end
@@ -357,4 +357,14 @@ function mustBeValidFileType(filePath)
357
357
function mustBeNonzeroLengthTextScalar(content )
358
358
mustBeNonzeroLengthText(content )
359
359
mustBeTextScalar(content )
360
- end
360
+ end
361
+
362
+ function data = myImread(URI )
363
+ % imread usually, but not always, fails to read from the
364
+ % https://oaidalleapiprodscus.blob.core.windows.net URLs returned by
365
+ % DALL•E. Use websave instead.
366
+ filename = tempname + " .png" ;
367
+ clean = onCleanup(@() delete(filename ));
368
+ websave(filename ,URI );
369
+ data = imread(filename );
370
+ end
You can’t perform that action at this time.
0 commit comments