Megapixels column

I don't think it's part of the metadata, but a custom column is simple:

function OnInit(initData) {
  initData.name = 'Megapixels';
  initData.version = '2021-09-15';
  initData.url = 'https://resource.dopus.com/t/megapixels-column/39332';
  initData.default_enable = true;
  initData.min_version = '12.0';
}

function OnAddColumns(addColData) {
  var col = addColData.AddColumn();
  col.name = 'Megapixels';
  col.label = 'Megapixels';
  col.header = 'Megapixels';
  col.justify = 'right';
  col.type = 'double';
  col.autogroup = true;
  col.method = 'OnColumn';
}

function OnColumn(scriptColData) {
  var item = scriptColData.item;
  if (item.is_dir) return;
  if (item.metadata != 'image') return;

  var w = item.metadata.image.picwidth;
  var h = item.metadata.image.picheight;

  if (typeof w != 'number') return;
  if (typeof h != 'number') return;

  var mp = w * h / (1024 * 1024);
  scriptColData.value = mp.toFixed(1);
}

ColumnMegapixels.js.txt (898 Bytes)


How to use buttons and scripts from this forum


(Such a column would also be available via ExifTool.)

2 Likes