bugGNU Octave - Bugs: bug #37369, imread "Index" option is...


bug #37369: imread "Index" option is ignored (always returns first frame)

Submitted by:  Carnë Draug <carandraug>
Submitted on:  Sun 16 Sep 2012 05:32:21 PM UTC  
Category:  Libraries Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  Carnë Draug <carandraug>
Originator Name:  Open/Closed:  Closed
Release:  3.6.2 Operating System:  GNU/Linux

Add a New Comment(Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


Tue 30 Jul 2013 12:06:51 PM UTC, comment #2:

I have implemented this with cset 997efb8d0b19 and am closing this bug.

Carnë Draug <carandraug>
Project MemberIn charge of this item.
Wed 28 Nov 2012 07:09:29 PM UTC, comment #1:

So, I looked into the imread functionality a bit. Here is what I came up with. The Matlab spec has the abbreviated functionality for imread for the different image formats that it supports:

BMP — Windows Bitmap

CUR — Cursor File
(..., idx)

GIF — Graphics Interchange Format
(..., idx) idx is a scalar integer or a vector of integer values
(..., 'frames', idx) same as above. idx can be 'all'

HDF4 — Hierarchical Data Format
(..., ref) get the ref image. not necessarily in order

ICO — Icon File

JPEG — Joint Photographic Experts Group

JPEG 2000 — Joint Photographic Experts Group 2000
(..., 'p1','v1','p2','v2',... )
'ReductionLevel' - non-negative integer
'PixelRegion' - {ROWS, COLS} - 2 element vectors representing [START, STOP]

PBM — Portable Bitmap

PGM — Portable Graymap

PNG — Portable Network Graphics
(..., 'BackgroundColor', BG ) - pretty complicated.

PPM — Portable Pixmap

RAS — Sun Raster

PCX — Windows Paintbrush

TIFF — Tagged Image File Format
(..., 'p1','v1','p2','v2',... )
'Index' -> integer for value
'Info' - structure from imfinfo - improves perf
'PixelRegion' - {ROWS, COLS} - 2 or 3 element vectors

XWD — X Window Dump


In the Octave code there seems to be very limited support for any of the additional functionality for the different formats. In fact the only additional functionality is the GIF support, 'frames' and 'all', which is transparently passed through to all formats. It is not clear what GraphicsMagick does with the image index/number information on all formats. Probably ignores it.

My solution to the problem is to add a check for "Image" so that imread acts the same as if "frames" were passed in.

The default behaviour is to notice that there were 3 parameters passed in, but since the second was not "frames" silently error out and return the first image. Unexpected behaviour is a poor user experience.

The only functionality seems to be
" (..., idx) " for all the format

Mark Wistrom <mwistrom>
Sun 16 Sep 2012 05:32:21 PM UTC, original submission:


I have a multipage tiff whose pages I can read just fine if I pass their index as the second argument. However, if I specify the index thourgh the Index option, it completely ignores it and reads only the first frame. For example:


Carnë Draug <carandraug>
Project MemberIn charge of this item.


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by mwistrom (Posted a comment)
  • -email is unavailable- added by carandraug (Submitted the item)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.




    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2013-07-30 carandraug StatusNone => Fixed
        Assigned toNone => carandraug
        Open/ClosedOpen => Closed

    Back to the top

    Powered by Savane 3.3