hi ,
I have a image and have to find the image height & widht and then based on that I need to process further .
Is this possible from enfocus inbuilt variables. Or do I have to call external command to fetch this value.
I see Photo.PixelXDimension in script option but don't know how to use it .
Finding Image Height Widht
-
- TOP CONTRIBUTOR
- Posts: 628
- Joined: Mon Nov 29, 2010 8:45 pm
- Location: Alpharetta GA USA
- Contact:
Finding Image Height Widht
Select "single line with variables" and select Photo->PixelXDimension
-
- Newbie
- Posts: 9
- Joined: Tue Mar 18, 2014 3:17 pm
Finding Image Height Widht
Thanks . But which flow element should I select for this and how I can use this in script .
I tried with below code in script
var imageWidth = job.getVariableAsNumber("[Photo.PixelXDimension]");
It is giving error Photo Object is not recognized.
I tried with below code in script
var imageWidth = job.getVariableAsNumber("[Photo.PixelXDimension]");
It is giving error Photo Object is not recognized.
Finding Image Height Widht
pradeepnitp wrote: Thanks . But which flow element should I select for this and how I can use this in script .
I tried with below code in script
var imageWidth = job.getVariableAsNumber("[Photo.PixelXDimension]");
It is giving error Photo Object is not recognized.
So... I think what he is saying, you would have to have an element grab this value ahead of time -- said another way: he isn't explaining how to get this value inside the actual script.
What I would do is drop a "write to private data script" that writes the key "PixelXDimension" to value, select "Single line text with values". Then Photo > PixelxDimension. Then flow that into your script.
Now, in your script, you can do:
var PixelXDimension = job.getPrivateData("PixelXDimension");
I tried with below code in script
var imageWidth = job.getVariableAsNumber("[Photo.PixelXDimension]");
It is giving error Photo Object is not recognized.
So... I think what he is saying, you would have to have an element grab this value ahead of time -- said another way: he isn't explaining how to get this value inside the actual script.
What I would do is drop a "write to private data script" that writes the key "PixelXDimension" to value, select "Single line text with values". Then Photo > PixelxDimension. Then flow that into your script.
Now, in your script, you can do:
var PixelXDimension = job.getPrivateData("PixelXDimension");
Chat: open-automation @ gitter
Code: open-automation & dominickp @ GitHub
Tools: Switch, Pitstop, EPMS, Veracore, PageDNA, SmartStream, Metrix
Code: open-automation & dominickp @ GitHub
Tools: Switch, Pitstop, EPMS, Veracore, PageDNA, SmartStream, Metrix
-
- TOP CONTRIBUTOR
- Posts: 628
- Joined: Mon Nov 29, 2010 8:45 pm
- Location: Alpharetta GA USA
- Contact:
Finding Image Height Widht
Here's how I get info from any PDF file in a script. Photo should be similar.
var stats = new FileStatistics(filename);
var numPages = stats.getNumber("NumberOfPages");
var pageWidth = stats.getNumber("PageWidth");
var pageHeight = stats.getNumber("PageHeight");
and for a PDF job
var numPages = job.getVariableAsNumber("[Stats.NumberOfPages]");
var pageWidth = job.getVariableAsNumber("[Stats.PageWidth]");
var pageHeight = job.getVariableAsNumber("[Stats.NPageHeight]");
var stats = new FileStatistics(filename);
var numPages = stats.getNumber("NumberOfPages");
var pageWidth = stats.getNumber("PageWidth");
var pageHeight = stats.getNumber("PageHeight");
and for a PDF job
var numPages = job.getVariableAsNumber("[Stats.NumberOfPages]");
var pageWidth = job.getVariableAsNumber("[Stats.PageWidth]");
var pageHeight = job.getVariableAsNumber("[Stats.NPageHeight]");
Finding Image Height Widht
dkelly wrote: Here's how I get info from any PDF file in a script
Was not aware of that class. Very cool. Thank you!
Was not aware of that class. Very cool. Thank you!
Chat: open-automation @ gitter
Code: open-automation & dominickp @ GitHub
Tools: Switch, Pitstop, EPMS, Veracore, PageDNA, SmartStream, Metrix
Code: open-automation & dominickp @ GitHub
Tools: Switch, Pitstop, EPMS, Veracore, PageDNA, SmartStream, Metrix
-
- Newbie
- Posts: 9
- Joined: Tue Mar 18, 2014 3:17 pm
Finding Image Height Widht
HI Thanks , I am new to scripting .
But which flow element should I select for writing private data.
But which flow element should I select for writing private data.
Finding Image Height Widht
pradeepnitp wrote: HI Thanks , I am new to scripting .
But which flow element should I select for writing private data.
Switch doesn't come with one right out of the box but it's a pretty simple script (and very handy). Mine has a bunch of input values (Key1, Value1, Key2, Value2, etc..) and you can specify key and value pairs with single line text with values. Then just pass your job through and access the private data anywhere later.
The script is as simple as:
job.setPrivateData( key1, value1 );
If you can't figure it out, let me know and I can share mine with you.
But which flow element should I select for writing private data.
Switch doesn't come with one right out of the box but it's a pretty simple script (and very handy). Mine has a bunch of input values (Key1, Value1, Key2, Value2, etc..) and you can specify key and value pairs with single line text with values. Then just pass your job through and access the private data anywhere later.
The script is as simple as:
job.setPrivateData( key1, value1 );
If you can't figure it out, let me know and I can share mine with you.
Chat: open-automation @ gitter
Code: open-automation & dominickp @ GitHub
Tools: Switch, Pitstop, EPMS, Veracore, PageDNA, SmartStream, Metrix
Code: open-automation & dominickp @ GitHub
Tools: Switch, Pitstop, EPMS, Veracore, PageDNA, SmartStream, Metrix
-
- Newbie
- Posts: 9
- Joined: Tue Mar 18, 2014 3:17 pm
Finding Image Height Widht
If you can share it. It will be great help for me.
I
I
Finding Image Height Widht
pradeepnitp wrote: If you can share it. It will be great help for me.
I
Here you go: https://github.com/dominickp/SwitchWriteToPrivateData
I
Here you go: https://github.com/dominickp/SwitchWriteToPrivateData
Chat: open-automation @ gitter
Code: open-automation & dominickp @ GitHub
Tools: Switch, Pitstop, EPMS, Veracore, PageDNA, SmartStream, Metrix
Code: open-automation & dominickp @ GitHub
Tools: Switch, Pitstop, EPMS, Veracore, PageDNA, SmartStream, Metrix