Page 1 of 2

Different result in Scripting |Run Scripts than run from CTB

Posted: 17 Sep 2014 18:46
by klownboy
Don, it was driving me crazy as to why a script I had been using nearly daily is now not working on certain images. Well I finally tracked it down. The exact same script run from Scripting | Run script... yields a different result than running/loading the same script file from a CTB. Now that shouldn't be! When I run this bastardized slimmed down version of the problem portion of the script on a Canon photo with a width of "2592" and a height of "3888", I get the correct result from the "Run script..." and the opposite result when run from a script loaded from a CTB - it yields a result of width 3888 and height 2592. WOW very weird. Don I'll send you the image if that's OK.

You may be thinking that's an odd ball situation or an odd ball photo, but no the photo is straight from a common Canon EOS. It appears to happening when the property "Orientation" is null or nothing as opposed to Normal or a Rotated value. In any case there's no way regardless that I should be getting 2 different results depending on whether I run the script from a CTB or from Scripting | Run script... Note: If you're using the German language you may have to change the property value or comment the line out. I think ImageX and ImageY should work regardless.

Code: Select all

  foreach($file, <get selecteditemspathnames |>) { 
     $p = property("#11", $file);   
   if ($p == "Picture") {
    $d = property("dimensions", $file);
    $rotate = property("#245", $file);
    $orig_width = property("ImageX", $file);
    $orig_height = property("ImageY", $file);
	echo Width: $orig_width   Height: $orig_height;
    }
  }
Hovering File Info Tips does get it right. I just sent the image. Thanks,
Ken

Re: Different result in Scripting |Run Scripts than run from

Posted: 17 Sep 2014 18:56
by admin
Hm, tried it. Script yields same results in all contexts here.

Re: Different result in Scripting |Run Scripts than run from

Posted: 17 Sep 2014 18:58
by TheQwerty
Are you absolutely positive they are both running the same exact script?

Re: Different result in Scripting |Run Scripts than run from

Posted: 17 Sep 2014 19:55
by admin
I tested with the central part:

Code: Select all

$orig_width = property("ImageX");
   $orig_height = property("ImageY");
   echo "Width: $orig_width   Height: $orig_height";

Re: Different result in Scripting |Run Scripts than run from

Posted: 17 Sep 2014 20:12
by klownboy
Why did I know this would happen! Were you testing in English language, etc?
Absolutely positive I was running the exact same script. To make sure, I copied the script from my "post" and ran it from "Run Script..." with the addition in the echo of "Run from Run Script" and did the same in a normal left click of a CTB with the addition in the echo of "Run from CTB". See the result.
WxH_run from CTB.PNG
WxH_run_from_Run_Script.PNG
By the way, the result from the CTB is the same whether I have the contents of the little script in left click edit box or if I have the script in a file that is loaded from the CTB left click. I can't think of any setting that should affect this result, can you? Anything I could do to further test? As I said before the File Info tips hover gets it right. I have checked image width and height and dimensions in Configuration. Thanks.

Edit: Don, I used the 3 lines you tested with and my results are the same as shown above. You might still have my XY ini file I sent a week ago for something else.

Re: Different result in Scripting |Run Scripts than run from

Posted: 17 Sep 2014 20:35
by Filehero
Hi Ken,

can't confirm over here with a Pentax PEF and the CTB test using the copied RUN code pasted into the 'On left click' edit popup.

Hmmmm :?:

Re: Different result in Scripting |Run Scripts than run from

Posted: 17 Sep 2014 20:55
by klownboy
Maybe this will help track the issue down. I put the folder in a large tile view and as you can see in the capture, the info provided in large tile view is wrong 3888x2592 where as the info tip hovering on the tile thumbnail is correct 2592x3888.
WxH_Large_tile_view.PNG
Is it possible that scripting from Run script could be getting the width and height from one place (which is correct) and the scripting from the CTB is getting it from somewhere else (which is wrong)? And as I mentioned earlier, this only seems to happen when the "orientation" which I also have checked in "File Info Tips" is null or nothing instead of normal or a rotation value. As you can see "Orientation" does not show up in the info tip even though it's checked off in configuration since it's null with this picture.

Re: Different result in Scripting |Run Scripts than run from

Posted: 17 Sep 2014 21:10
by Filehero
Even with your last reproduction steps I don't seeany difference here. Maybe, you can put the image somewhere for public download?

Of course, you have already applied the most boring amongst the usual suspects-pattern known as ::fresh? :oops: & sorry

Re: Different result in Scripting |Run Scripts than run from

Posted: 17 Sep 2014 21:22
by klownboy
Thanks Filehero, silly me hadn't tried in a fresh copy, but I just did. Same result, incorrect in the CTB ran script and correct in the Scripting | Run Script.

Re: Different result in Scripting |Run Scripts than run from

Posted: 17 Sep 2014 21:24
by admin
I can confirm that the tile view gets it wrong because it uses an ultra-optimized algorithm that does not know about rotated JPGs.

But this does not explain the differences in scripts. are the scripts really identical?

Re: Different result in Scripting |Run Scripts than run from

Posted: 17 Sep 2014 21:45
by klownboy
Definitely identical. I also copied your posted 3 liner shortened version and used it in "Run Scripts" and in a "CTB" both as a loaded script file and with the contents input in the CTB left click edit box and the results were still the same (i.e., different). I again did the same thing in a fresh copy with the same result. I know my PhotoCropping script worked fine (and with this image file type) for nearly the last 2 years and within the last couple months something went haywire and I hadn't been able to nail it down but I saw today stepping through the script that the widths and heights were messed up. Thanks, anything else I can try to nail it down? Did you still have my XY ini file I sent a week ago?

Re: Different result in Scripting |Run Scripts than run from

Posted: 17 Sep 2014 21:53
by admin
From my POV this is impossible. Just went through the code. There CANNOT be a difference. So it must be voodoo. Take care.

Re: Different result in Scripting |Run Scripts than run from

Posted: 17 Sep 2014 22:16
by klownboy
Don, impossible but it's happening. Do codecs come into play in this situation? I ask because both Irfanview and ImageEye file viewers get the dimensions right, but FastPictureViewer gets it wrong. I have the FastPictureViewer Pro Codec Pack installed and when I open that image in FastPictureViewer it's not rotated properly whereas it is in both ImageEye and Irfanview. Is it possible that the FastPictureViewer Codec Pack is somehow affecting the result? I don't want to uninstall unless you think it could be an issue.
Thanks

Re: Different result in Scripting |Run Scripts than run from

Posted: 18 Sep 2014 01:04
by klownboy
I know you're sleeping or should be, but I think I answered my question I asked in the previous post concerning whether codecs installed may be affecting the results I have more specifically codecs from FastPictureViewer. Well it does, but why should it Don if your coding is the same whether we run it from "Run Script" or from a "CTB"? That's the question.

I didn't uninstall the entire FastPictureViewer Pro Codec Pack. The install/remove in Control Panel does allow individual features to be changed so I uninstalled the 1st feature which is: "WIC - Enabled fast JPEG decoder with EXIF auto-rotation". Low and behold, after reboot both values from "Run Script" and from the CTB are both the same - 3888 for width and 2592 for width which is the opposite of what it should be for that portrait image, but at least it is consistent.
admin wrote:Hm, tried it. Script yields same results in all contexts here.
Don, are those the same values you came out with for the image I sent? I can't ask anyone else since they don't have the picture. So why would the codec affect the script running in one situation and not the other?
Thanks,
Ken

Re: Different result in Scripting |Run Scripts than run from

Posted: 18 Sep 2014 15:10
by klownboy
I forgot to mention in addition to what I stated above and as a follow-up incase someone else has a similar issue with the codecs from FastPictureViewer Pro Codec Pack, having the Jpeg decoder installed also removed the "Orientation" value for that particular photograph which was "Rotate 270 degrees". Now that I've uninstalled that codec, the value is back instead of being null. This is was messing up the script since it checks the "Orientation" value and acts accordingly to crop the photo.