#1 2011-12-07 04:39

Lukers18
Member
Registered: 2011-12-07
Posts: 4

Naming based on image WIDTH x HEIGHT values

Hello, everyone.

I have some image files of comics and want to name it this way:

Name P###          - for single page images;
Name P###-###  - for double page images.

Want to choose the sequence's first number.

Thought that a script using file's WIDTH and HEIGHT values should do the trick, but doesn't know to use Pascal.


Really grateful since now for anyone that could help me. smile

Offline

#2 2011-12-07 07:05

Andrew
Senior Member
Registered: 2008-05-22
Posts: 542

Re: Naming based on image WIDTH x HEIGHT values

It should be possible to do what you want using a combination of meta tags, serialize rule and PascalScript. However, what if the single-page images in some high quality files are bigger and in low-quality files are smaller? In such a case depending on the cutoff values the bigger images could be misinterpreted as double-page ones.

Offline

#3 2011-12-07 09:35

SafetyCar
Senior Member
Registered: 2008-04-28
Posts: 446
Website

Re: Naming based on image WIDTH x HEIGHT values

@Lukers18 Please, I think we are not understanding you corrrectly.

Could you detail a little bit more?

How are the current names, and what should become?
name -> new name

And what do the dimensions have to do with it?

Last edited by SafetyCar (2011-12-07 09:49)


If this software has helped you, consider getting your pro version. :)

Offline

#4 2011-12-07 15:00

Lukers18
Member
Registered: 2011-12-07
Posts: 4

Re: Naming based on image WIDTH x HEIGHT values

Andrew wrote:

It should be possible to do what you want using a combination of meta tags, serialize rule and PascalScript. However, what if the single-page images in some high quality files are bigger and in low-quality files are smaller? In such a case depending on the cutoff values the bigger images could be misinterpreted as double-page ones.

It doesn't happen in any circumstance.

Single paged images will ALWAYS be taller than large. - e.g. Width x Height
Double paged images will ALWAYS be larger than tall. - e.g. 2xWidth x Height



SafetyCar wrote:

@Lukers18 Please, I think we are not understanding you corrrectly.
Could you detail a little bit more?
How are the current names, and what should become?
name -> new name
And what do the dimensions have to do with it?

Single paged:
Name > new name
no matter > 001.jpg

Double paged:
Name > new name
no matter > 001-002.jpg

The script should compare the dimensions to determine if it is single or double paged and apply the correct format to the name.

Offline

#5 2011-12-07 18:01

SafetyCar
Senior Member
Registered: 2008-04-28
Posts: 446
Website

Re: Naming based on image WIDTH x HEIGHT values

Lukers18 wrote:

Single paged images will ALWAYS be taller than large. - e.g. Width x Height
Double paged images will ALWAYS be larger than tall. - e.g. 2xWidth x Height

Single paged:
no matter > 001.jpg

Double paged:
no matter > 001-002.jpg

The script should compare the dimensions to determine if it is single or double paged and apply the correct format to the name.

For that description I think this should do it:

var
  Ext, Ratio: WideString;
  I: Integer;

function NextPage(): WideString;
begin
  I := I + 1;
  Result := IntToStr(I);
  while length(Result)<3 do Result := '0' + Result;
end;

begin
  Ratio := CalculateMetaTag(FilePath, 'Image_AspectRatio');

  if (Ratio <> '') then
  begin
    Ext := WideExtractFileExt(FileName);

    if (Ratio[1]='0') then
      FileName := NextPage() + Ext
    else
      FileName := NextPage() + '-' + NextPage() + Ext;
  end;
end.

If this software has helped you, consider getting your pro version. :)

Offline

Board footer

Powered by FluxBB