Troubles reading height and width of images

Advanced Renamer forum
#1 : 17/09-16 16:39
Posts: 1
Hello, I made a JS script for rename some pages inside a folder. The pages are in png or psd format. Here's the code:

function(index, item){
// settings
var getFromFolder = true;
var startName = '';
var endName = '';
var startNumber = 0;
var startDoublePageAnalisys = 1;
var digits = 2;

// operations
if (getFromFolder){
var path = item.path;
var regex = /\\([^\\]+)\\?$/;
var match = regex.exec(path);
var folder = match[1];
regex = /([^\[]+)([^\]]+\])/;
match = regex.exec(folder);
startName = match[1] + '_p';
endName = match[2];
if (index == 0){
window.index2 = startNumber;
var number = window.index2 + '';
while (number.length < digits){
number = '0' + number;
window.index2 ++;
var name = number;
if (index >= startDoublePageAnalisys &&
item.imgHeight < item.imgWidth){
number = window.index2 + '';
while (number.length < digits){
number = '0' + number;
name += '-' + number;
window.index2 ++;
return startName + name + endName;

It's applied only to the name. The folder is named every time properly, like "title[creator]" and I want to rename the files inside in title_p##[creator].png/psd in case of a single page, title_p##-##[creator].png/psd in case of a double page. My problem is located, after trying a lot, in the condition "if (index >= startDoublePageAnalisys && item.imgHeight < item.imgWidth)" with the psd files. Advanced Renamer doesn't tell me anything, it keeps OK on the error column and it doesn't change the name in new name column, but it seems that it can't read the height or the width of the file. The weird thing is that if I select all the files to rename one by one it displays the dimensions in the info. Anyone know how I can solve this? Or maybe if you know other methods that do that. Thank you.
(Sorry for any mistake of my english)

17/09-16 16:39 - edited 17/09-16 17:15
#2 : 17/09-16 19:13
G. Lambany
G. Lambany
Posts: 187
Reply to #1:
I would first check if there is an issue with the psd files.. since they seems to be the only ones that won't work.

download ExifTool GUI and run it on them, if you can see width and height, AR should see the same.

ExifTool GUI:

also, your script seems to work, but there is an extra } at the end that make the script fails to run. Without it tho, it runs fine here (even on psd files).

You should give a typical case of filenames that are problematic, so that the problem can be repeated... else, there isn't much that can be done.


17/09-16 19:13