2 Fixed the order of operations; added code
source | link
  • Start by replacing Import with

    First@ImageData@Image`ImportExportDump`ImageReadPNG[fNames[[‌​i]]]ImageData@First@Image`ImportExportDump`ImageReadPNG[fNames[[‌​i]]]
    

    This is the low level function called by Import on PNG files; calling it directly bypasses A TON of behind-the-scenes checking. On a 350-picture subset, the ParallelDo[Import...] alone was taking 70s on my laptop; the ImageReadPNG version took 4s.

  • The Flatten call within the ParallelDo loop also doesn't seem necessary, since byteValues[[1, 1;;24]] is already a flat vector. That won't probably affect timing quite as much though.

In short, I propose to use:

ParallelDo[
  byteValues = ImageData@First@Image`ImportExportDump`ImageReadPNG[fNames[[i]]];
  timeStampValues[[i]] = byteValues[[1, 1 ;; 24]],
  {i, 1, n}]

On your sample data set, I get the following timings:

  • your version: 61 seconds
  • my version: 9.2 seconds
  • Start by replacing Import with

    First@ImageData@Image`ImportExportDump`ImageReadPNG[fNames[[‌​i]]]
    

    This is the low level function called by Import on PNG files; calling it directly bypasses A TON of behind-the-scenes checking. On a 350-picture subset, the ParallelDo[Import...] alone was taking 70s on my laptop; the ImageReadPNG version took 4s.

  • The Flatten call within the ParallelDo loop also doesn't seem necessary, since byteValues[[1, 1;;24]] is already a flat vector. That won't probably affect timing quite as much though.

  • Start by replacing Import with

    ImageData@First@Image`ImportExportDump`ImageReadPNG[fNames[[‌​i]]]
    

    This is the low level function called by Import on PNG files; calling it directly bypasses A TON of behind-the-scenes checking. On a 350-picture subset, the ParallelDo[Import...] alone was taking 70s on my laptop; the ImageReadPNG version took 4s.

  • The Flatten call within the ParallelDo loop also doesn't seem necessary, since byteValues[[1, 1;;24]] is already a flat vector. That won't probably affect timing quite as much though.

In short, I propose to use:

ParallelDo[
  byteValues = ImageData@First@Image`ImportExportDump`ImageReadPNG[fNames[[i]]];
  timeStampValues[[i]] = byteValues[[1, 1 ;; 24]],
  {i, 1, n}]

On your sample data set, I get the following timings:

  • your version: 61 seconds
  • my version: 9.2 seconds
1
source | link

  • Start by replacing Import with

    First@ImageData@Image`ImportExportDump`ImageReadPNG[fNames[[‌​i]]]
    

    This is the low level function called by Import on PNG files; calling it directly bypasses A TON of behind-the-scenes checking. On a 350-picture subset, the ParallelDo[Import...] alone was taking 70s on my laptop; the ImageReadPNG version took 4s.

  • The Flatten call within the ParallelDo loop also doesn't seem necessary, since byteValues[[1, 1;;24]] is already a flat vector. That won't probably affect timing quite as much though.