Importing image sequence (or folder) with varying image sizes

When trying to import a directory with images (via File > Import > Image Sequence…, or by dragging the folder onto the ImageJ toolbar), the opened stack will have the dimensions of the first image, and for each image with differing dimensions, an error message is logged:

image2.tif: wrong size; ...x... expected, ...x... found

and the image is skipped.

In some cases, you might want to open all images even if some of them have different dimensions, by pasting the image onto the canvas defined by the first image dimensions, such that:

  • the image is padded with the current background value when it is smaller, or
  • the image is cropped when it is larger than the first image.

A similar functionality is available already when using Image > Stacks > Images To Stack, where you can choose between the options:

  • Copy (top-left)
  • Copy (center)
  • Scale (smallest)
  • Scale (largest)

@Wayne how about adding similar functionality to the FolderOpener class? While we might not want to parse all image files for their dimensions, we could at least offer the options Crop/Pad (top-left-aligned or center-aligned) and Scale with respect to the dimensions of the first image. What do you think?

1 Like

Images that differ in size or type are not skipped if you open the sequence as a virtual stack. Open a folder as a virtual stack by dragging and dropping it on the “>>” icon in the toolbar. Duplicate a virtual stack to get an in-memory stack.

1 Like

Ah, great, thanks @Wayne for reminding me of that functionality! :slight_smile:

Did this work for you @imagejan?

I was having the same issue with Import > Image Sequence…, and when I open the folder as a virtual stack by dragging to the “>>” icon, it simply opens a virtual stack with first image in the folder repeated as many times as there are images in the folder.