musselwhizzle / Focus-Points

Plugin for Lightroom to show which focus point was active in the camera when a photo was taken
Apache License 2.0
340 stars 42 forks source link

Filename or extension too long error #179

Closed Wernfried closed 1 week ago

Wernfried commented 2 weeks ago

I try to use your Plugin in latest Lightroom Classic 13.3 on Windows 11. Pictures are taken by my new Canon EOS R7 It thows error: Internal Error: Win32 API error 206 (The filename or extension is too long) when calling ShellExecuteExW from AgWorkspace.shellExecute

Metadata display is working fine.

No idea where it comes from. Plugin Folder is the default c:\Users\Wernfried\AppData\Roaming\Adobe\Lightroom\Modules\focuspoints.lrdevplugin\

Filename is not particular long either: d:\Photos_Orginal\2024\06\IMGL0269.JPG

I attached metadata and logfile

Any ideas?

libraryLogger - Kopie.log Metadata.txt

capricorn8 commented 2 weeks ago

Thank you for this detailed error report!

After a quick check I can say that the problem is not due to filename / location.

It happens during the construction of the ImageMagick call which creates an image of the selected photo with AF overlay information. From the logfile it can be seen that the length of the resulting command line is 59.720 characters which by far exceeds Windows' limitation of 8191 chars.

I cannot believe that such a complex call is reasonable. The Canon R7 is a new camera, so it could be possible that the plugin misinterprets some AF related information in R7 EXIF.

I have not been involved in the development of the according parts of the plugin.

Maybe @ropma can help with further analysis?

Wernfried commented 2 weeks ago

The Canon EOS R7 has 651 focus points (31 x 21). I think the tool does not misinterprets any EXIF information, the huge command line is caused by the number of focus points. The professional Canon R3 has even 1053 focus points.

One solution would be the -script option. I made a quick test, it seems to work well. I created a file options.mgk

-read "C:\Users\Wernfried\AppData\Local\Temp\IMGL0269-fpoints.jpg"
-resize 1406x937 -fill none 
-strokewidth 2 -stroke red -draw "roundRectangle 53,21 91,59 1,1" 
-strokewidth 2 -stroke red -draw "roundRectangle 95,21 133,59 1,1"
...
... thousands of lines omitted
...
-strokewidth 2 -stroke red -draw "roundRectangle 1315,878 1353,916 1,1"
-write "C:\Users\Wernfried\AppData\Local\Temp\IMGL0269-fpoints-out.jpg"

And then run it as

"%APPDATA%\Adobe\Lightroom\Modules\focuspoints.lrdevplugin\bin\ImageMagick\magick.exe" -script options.mgk

Output file C:\Users\Wernfried\AppData\Local\Temp\IMGL0269-fpoints-out.jpg looks as expected.

Kind Regards Wernfried

capricorn8 commented 2 weeks ago

My OM-1 also has 1053 focus points but the resulting command is only 230 chars long.

The issue you experience does not seem to be a general one for R7. I have downloaded some R7 sample raw files from the internet and could generate the Focus Point view for all of them, with ImageMagick commands of ~300 chars.

Could you provide an example of a .CR3 file that leads to the error?

capricorn8 commented 2 weeks ago

Thank you for providing this information.

Try to make a photo where "All" focus points are used and make a shot of a plain and glossy plane, then you may get similar result as I got.

Unfortunately, no. All the cameras that I have been using (various Olympus models) display a single small red box with a centered dot - which indicates the single AF point chosen by the camera (from whatever AF area I chose to focus) to determine the focus distance and focus step count to control the lens. Even if multiple AF points in my selection would lead to the same result.

=> Every camera maker has its own logic to represent AF related information in EXIF.

Looking at the EXIF data of the image you provided yesterday I can see that 651 AF points have been selected (AF Points Selected) and 216 of them are listed to be "in focus" (AF Points In Focus). Accordingly, the AF overlay image (you posted yesterday) seems to be correct in terms of the logic described in README. Anyway, to me that's odd.

How does the AF Point Display for the above image look on your camera display? Does it display the same grid structure with 216 AF points in focus?

The plugin uses exiftool to read and process image EXIF data. AF related information is part of the maker notes, i.e. maker specific section: Canon makes notes.

For your image, EXIF data say it has been captured with an "unknown" AF Area Mode (22). See here for a complete list of modes known by exiftool. Which mode did you use to take the image?

  • As you see in attached picture (generated by options.txt which is composed from the logfile) the focus points are wrong. The screenshot from my camera shows the correct positions. This problem may require some deeper investigations.

Understood.

Wernfried commented 2 weeks ago

Somehow I made a mistake when I created the picture in last comment. Now I modified the code directly and it looks perfect.

Picture was taken with Servo AF, Whole area AF, Subject tracking Off, Subject to detect: People, Eye detection: Enabled

grafik

I would say, it matches

Currently, 5 types of AF-points will be displayed :

  • AF selected The AF-Point is selected and in focus
  • AF selected in focus The AF-Point is selected

I created a pull request: https://github.com/musselwhizzle/Focus-Points/pull/180

Kind Regards Wernfried

capricorn8 commented 2 weeks ago

I created a pull request: #180

Very good 👍

How does the AF Point Display for the above image look on your camera display? Same as in Focus Points viewer?

Wernfried commented 2 weeks ago

How does the AF Point Display for the above image look on your camera display? Same as in Focus Points viewer?

No, see screenshot above. The camera shows only the "AF-Points in focus". From the camera it is not possible to see "AF-Points selected", you get only the information of AF Area Mode.

capricorn8 commented 2 weeks ago

The camera shows only the "AF-Points in focus". From the camera it is not possible to see "AF-Points selected", you get only the information of AF Area Mode.

Just to confirm my understanding of what you have written - the screenshot of your camera display is NOT the display at the time of capturing the image, but the display of the image taken?

Wernfried commented 2 weeks ago

I just took two pictures with the same settings (Servo AF, Whole area AF, Eye Detection: Off, Subject to detect: None)

At first picture the camera was able to look the focus. Result from Focus-Points: IMGT0324-fpoints

Focus-points shown by camera: 20240630_144738

At second picture the camera was not able to look to focus. Result from Focus-Points: IMGT0323-fpoints

Focus-points shown by camera: 20240630_144748

Over all, for me the plugin is working as designed.

capricorn8 commented 2 weeks ago

Thank you, Wernfried - I can see the similarities between camera display and the plugin display.

I assume that this strange effect only happens if you focus on a plane subject where (most parts of) the surface is practically in the same focal plane?

Regards and greetings from Germany Karsten

Wernfried commented 2 weeks ago

Yes, for normal subjects the camera is way to fast to get such effect. I have to disable eye detection and subject detection to get this effect. In real life you would never use this setting in combination with "Whole area AF". And even if you do such stupid AF settings, many times the camera hit the correct focus anyway.

BTW, I requested update of AF Area Mode Values

Thanks for your support and greetings from Switzerland Wernfried

capricorn8 commented 2 weeks ago

BTW, I requested update of AF Area Mode Values

Oh, I didn't know that this can be done via GitHub too :-) I'm usually addressing my requests via the exiftool forum.

P.S.: "Nati" did really well yesterday, congrats 👍 Looking at their potential opponents I'm confident that they will also make it to the semi-final. Not so sure for our team 🤔 We'd better should have lost the match against Switzerland 😄

ropma commented 2 weeks ago

Maybe @ropma can help with further analysis?

Sorry for the late response, I was on a shot vacation is Switzerland!

The analysis of Kasten is correct and the the solution to use the script option is a good idea. It make the plugin more stable for future developments in the area the focus points.

Greetings from Germany Roland