changeset 17911:c98ffba88c78

imread: ping image correctly when "Index" or "Frames" option is "all". * private/__imread__.m: when the "Index" or "Frames" options were set with the string "all", its first letter was being used as index for the image to ping. Fix this by using an index of 1 for such cases. In addition, add the "Frames" and "Index" to the loop processing the options and skip them (it was causing an error about invalid option).
author Carnë Draug <carandraug@octave.org>
date Wed, 13 Nov 2013 00:12:20 +0000
parents c2bbbef6ab1f
children 01496d4811b1
files scripts/image/private/__imread__.m
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/image/private/__imread__.m	Tue Nov 12 17:33:30 2013 -0800
+++ b/scripts/image/private/__imread__.m	Wed Nov 13 00:12:20 2013 +0000
@@ -92,7 +92,11 @@
 
   try
     ## Use information from the first image to be read to set defaults.
-    info = __magick_ping__ (fn, options.index(1));
+    if (ischar (options.index) && strcmpi (options.index, "all"))
+      info = __magick_ping__ (fn, 1);
+    else
+      info = __magick_ping__ (fn, options.index(1));
+    endif
 
     ## Set default for options.
     options.region = {1:1:info.rows 1:1:info.columns};
@@ -100,6 +104,9 @@
     for idx = offset:2:(numel (varargin) - offset + 1)
       switch (tolower (varargin{idx}))
 
+        case {"frames", "index"}
+          ## Do nothing. This options were already processed before the loop.
+
         case "pixelregion",
           options.region = varargin{idx+1};
           if (! iscell (options.region) || numel (options.region) != 2)