DeAspect

Quite correctly, Lightroom 4 reads the AspectFrame metadata of raw files and crops the photo accordingly on import. The only drawback of this approach is, that it is not possible to change this later on in Lightroom.
As a reaction to this, I sat down and got into Lua, in order to write a little plugin automating the exiftool workflow proposed in some user forums.

The workflow looks as follows:

  • A new menu entry “DeAspect current selection” is added in the Library menu.
  • If the entry is called without a selection, nothing happens.
  • If the entry is called with a selection, the selected photos will be passed to
    exiftool -AspectRatio=”” -AspectFrame=”0 0 0 0″ -DefaultCropOrigin=”” -DefaultCropSize=”” -CroppedImageWidth=”WIDTH” -CroppedImageHeight=”HEIGHT” -o “NEW” “ORIG”
  • The newly created file NEW is then imported and stacked on top of the original photo.
  • As a manual step, the previews should be re-rendered for the new files.

Clarification:

In order to avoid any confusion regarding some problems reported in the comments below: DeAspect is designed NOT to delete any original files. Although I would advise against it, it is up to the user to manually delete the stacked original file after the conversion.

Requirements:

  • exiftool needs to be installed and available on PATH

License:

Creative Commons License
DeAspect by Tim Jagenberg is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.

GitHub:

In order to support the community development of a LR5 compatible version, I added the current state as a GitHub repository:
https://github.com/TimJay/DeAspect

Download:

2012-08-16: DeAspect_0-1-3.lrplugin.zip

  • New exiftool call
    “exiftool -AspectRatio=”” -AspectFrame=”0 0 0 0″ -DefaultCropOrigin=”” -DefaultCropSize=”” -CroppedImageWidth=”WIDTH” -CroppedImageHeight=”HEIGHT” -o “NEW” “ORIG””
    reading WIDTH and HEIGHT from exiftool -ImageWidth -ImageHeight
    works with DNG, ORF and CR2.

2012-05-15: DeAspect_0-1-2.lrplugin.zip

  • Changed call from “exiftool.exe” to “exiftool” for cross platform compatibility
  • New exiftool call
    “exiftool -AspectRatio=”” -AspectFrame=”0 0 0 0″ -DefaultCropOrigin=”” -DefaultCropSize=”” -o “NEW” “ORIG”
    works with DNG and ORF.

2012-05-13: DeAspect_0-1-1.lrplugin.zip

  • Initial public release

Just to make it perfectly clear: This is my first, inexperienced work with Lua and Lightroom plugins, it is a quick and dirty solution. Let me cite section 5 and 6 from the cc-by-sa license agreement:

5. Representations, Warranties and Disclaimer
UNLESS OTHERWISE MUTUALLY AGREED TO BY THE PARTIES IN WRITING, LICENSOR OFFERS THE WORK AS-IS AND MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND CONCERNING THE WORK, EXPRESS, IMPLIED, STATUTORY OR OTHERWISE, INCLUDING, WITHOUT LIMITATION, WARRANTIES OF TITLE, MERCHANTIBILITY, FITNESS FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR THE ABSENCE OF LATENT OR OTHER DEFECTS, ACCURACY, OR THE PRESENCE OF ABSENCE OF ERRORS, WHETHER OR NOT DISCOVERABLE. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF IMPLIED WARRANTIES, SO SUCH EXCLUSION MAY NOT APPLY TO YOU.
6. Limitation on Liability.
EXCEPT TO THE EXTENT REQUIRED BY APPLICABLE LAW, IN NO EVENT WILL LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY FOR ANY SPECIAL, INCIDENTAL, CONSEQUENTIAL, PUNITIVE OR EXEMPLARY DAMAGES ARISING OUT OF THIS LICENSE OR THE USE OF THE WORK, EVEN IF LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

46 Replies to “DeAspect”

  1. Nice tool!

    ### Here a little feature request:
    Possibilty to stop DeAscpect-Progress

    ### Solution for DeAspect.lua:
    23a23
    > progress:setCancelable(true)

    31a31
    > if progress:isCanceled() then
    > break
    > end

  2. need help with the plug in and how it works. I just shot a job and did not realize the aspect ratio lines were a hard crop. I am desperate to regain the original information that I can see in preview (which is 2×3) and not the 4:3 that was set in the mark iii camera. I am using Lightroom 4 and a Mac

  3. Thank you for creating this plugin! I spend a whole day shooting in 1:1 format with my E-M5 thinking it would write a RAW file in 4:3 aspect ratio and JPG in 1:1. Boy was I surpised to see nothing but RAW files. Your plugin allowed me to reset the aspect ratio very easily.

  4. Hi Tim – thanks very much for this. Does this pug-in work with 5D III files? I have downloaded it and tried working with 5D III files in Lightroom but it seems to create a file with deaspect in the name but with no change to the file. Any comment would be appreciated.

  5. Hi Tim, you saved my day ! I was looking were this f… crop information (E-M5) was. Trying with GraphicConverter led me to ExifTools, which led me to your site. Just great !! Thanks.

  6. Hi, thanks for this plugin! Much appreciated. I used to run exiftool command-line as I couldn’t find the courage to build a LR plugin 🙂

    I have one problem though. It works perfectly fine in LR but the new file cannot be previewed on mac osx. I mean in the finder or Preview. I get a grey square. Maybe with the way you change the aspect ratio values?

    I don’t have this problem if I do the same task with

    -AspectFrame=”0 0 4031 3023″ -AspectRatio=4:3

    for my Olympus E-P3 (ORF) camera RAW files.

    Could you provide a way to customize the parameters to exiftools?

    Thanks!

  7. Thanks for your comment, I’ll look into that issue.
    Might need you help for testing, as I don’t have OSX.

  8. Hi thanks for putting this together, however I can’t seem to get it to work with my EM-5 files on Lightroom 4. When I try the export i receive “an internal error has occured: [string “deaspect.lua”]44: attempt to concatenate local ‘heigh’ (a nil value)

    IF you could help with that, or tell me the correct command to run exiftool separately (im quite comfortable running command lines, i just cant get it to run correctly with the right variables) I would greatly appreciate it. I only need to do one file! lol

  9. Sorry, even with the additional information you provided me, I could not replicate the issue.
    I guess Lightroom cannot find exiftool on the path.

  10. just wanted to say thank you Tim for saving my butt! i just got a new 5d mkIII and din’t realise that my friend had changed my aspect ratio till 3/4 of the way through shooting a wedding! spewing!

  11. Tim, I’m having the exact same problem as billy up there. Whenever I try to use the DeAspect, it gives me this error message:

    “An internal error has occurred: [string “DeAspect.lua”]:44: attempt to concatenate local ‘height’ (a nil value)”

    I’m using Lightroom 4.2 64-bits, on a Windows 7 PC, with 5D3 files shot in video-mode.
    Thanks!

  12. Thanks a lot for this really helpful script.
    I love to shoot in 1:1 RAW format on my OM-D and I’ve been so disappointed to see that LR4 was not allowing to retrieve the original 4:3 picture (ideal for framing adjustment).
    I’ve now been able to rework some very precious pictures’ framing 🙂
    Thanks again !

  13. Addition to Andre’s great correction for blind previews of “DeAspected” pictures in the Finder:

    – Open the DeAspect.lrplugin package (Mac user)
    – Edit “DeAspect.lua” (TextEdit app is well suited for this)
    – look for this text section:
    “exiftool -AspectRatio=\”\” -AspectFrame=\”0 0 0 0\”

    – For the Olympus OM-D you the have to replace it by the following text:
    “exiftool -AspectRatio=\”4/3\” -AspectFrame=\”0 0 4608 3456\”

    In general I guess that you have to put the appropriate AspectRatio (3/2 or 4/3) et your RAW file native resolution (4608 x 3456 pixel on the OM-D) and it should work for any camera 🙂

  14. Tim, could you help me please.
    I get only msg »“An internal error has occurred: [string “DeAspect.lua”]:44: attempt to concatenate local ‘height’ (a nil value)”
    What do i wrong?
    Thanks!

  15. You need to make sure that exiftool is accessible without the full path, i.e. the location of it needs to be in your system path variable. Restart Lightroom to ensure it’s using the updated path variable.

  16. This is fabulous! Thanks very much.

    How hard would it be to make a version of the plugin that operated on the selected file without creating a duplicate file? (It would be great if it created a Develop Module Snapshot with the current crop before it reset, but adding a crop afterwards isn’t exactly difficult.)

    As a side note, this works fine on DNG files which were created from Olympus OMD-EM5 ORFs which had an in-camera crop set.

  17. To help clarify for anyone else who also had issues, you have place the exiftool.exe in the folder that is defined as your system’s path variable. See http://en.wikipedia.org/wiki/PATH_(variable) for an explanation. I followed the steps at http://java.com/en/download/help/path.xml to determine the default PATH variable location for my system. As a Windows 7 user, the first default variable value was C:\Program Files\Common Files\Microsoft Shared\Windows Live, so I copied exiftool.exe here, and it worked.

  18. Hey Daniel,

    thanks a lot for the information! I guess this will help a few users to avoid the PATH issues.

  19. I only get an error message. I tried restarting Lightroom several times.

    [string “DeAspect.lua”]:44: attempt to concatenate local ‘height’ (a nil value)

  20. Nothing listed above comes close to working.
    I’ve edited the path, and supposedly installed the exiftool
    I’ve tried to add the DeAspect.lua file..but get an error message..
    I’ve followed every step exactly as outlined and nothing…

    So i am stuck, and I think this process is too difficult to get to work.
    Might be a lifesaver, as this Aspect Ratio has bitten me bad on a job.

  21. How should I modify the code if i dun want to create a backup copy of the raw file but restore the aspect ratio directly in the source raw file?

  22. Hi Tim,
    I am new to computer coding, but have managed to get this to ALMOST work. I am able to run the plugin with DNG converted (from ORF) files in Lightroom. However the aspect ratio remains the same on the stacked image. I am maybe missing what to do for the “a manual step, the previews should be re-rendered for the new files” part. Can you give some sort of explanation on what you mean here.

    Sam

  23. What happens if you try it with the ORF directly? Could you sent me the ORF and DNG files as samples?

  24. Hi Tim,

    just installed the plugin and applied it to a set of cropped pictures shot with my 5d mkiii (I’m using LR5). It works smoothly. A big thank you for your great work!!!

    Marco

  25. Could you please give me explanation on how to install exiftool, please?

  26. If you are still getting only error messages after the path is correclty set, check that if the exiftool executable is renamed to exiftool.exe. In the original exiftool package the executabl file name is exiftool(-k).exe for some reason and that might prevent the Lightroom plugin finding it even when the Path is correctly set.

  27. Here is a bash script which detects and corrects the files to *-fixed.CR2. Just run it in the folder with the CR2 files. You can easily change extension, or new AR. I made this for the Canon 5D mark 3.
    ——– cut here ——-
    #!/bin/bash

    EXT=”CR2″
    FILES=`ls -1 *.${EXT}`
    FIX=”-fixed”

    for f in $FILES
    do
    find=`exiftool -AspectRatio $f | grep 16:9`

    if [ “$find” != “” ]; then
    out=”${f%.*}${FIX}.${EXT}”
    echo “Processing $f to $out”
    exiftool -AspectRatio=”3:2″ -AspectFrame=”0 0 0 0″ -DefaultCropOrigin=”” -DefaultCropSize=”” -CroppedImageTop=0 “-CroppedImageHeight<ImageHeight" -o "$out" "$f"
    fi
    done
    ——— cut till here ——-

  28. Hi Tim,

    unfortunately this nice tool doesn’t work with Lightroom 5.7 (probably 5.x). Would be great to have a fix for that!

    Best regards,
    Thomas

  29. As I am still in LR4, it is hard for me to adapt DeAspect to LR5. Can other users confirm these issues with LR5? Maybe someone out there with LR5 has some experience with LR plugin development / Lua and can help?

  30. I’ve been using this tool to dispatch 5D III files shot while in video mode. However, I recently upgraded one of my libraries to Lightroom 5.7 and the deaspected files now show as being ‘unsupported or corrupt’. It was fine in 5.6.

    This is worrying as I have deleted the original raw files and just have the deaspected files remaining. It would be awesome if we could have a workaround for this.

    Cheers,
    Peter

  31. So it seems this is related to the Camera Raw 8.7 update.
    Could you try the following work-around for now: Open the relevant photos in the old LR and convert them to DNG, then see of they work in LR5?

  32. Hi Tim –
    I actually got in touch with Eric Chan about this, and he gave the following reply:

    The issue with the 5D III images that have been run through the Deaspect tool is that they actually contain incorrect metadata for the sensor width/height. This is actually being specified as larger than the physical sensor size, and thus it's failing an internal check in Lr, and therefore triggering the Import error.

    The specific issue is that the new width/height written into the .CR2 file is stated as 5920 x 3950 pixels. However, the raw mosaic file only contains 5760 x 3840 pixels. If the Deaspect tool can be modified to write the same metadata as a standard (non-16:9) aspect .CR2 (i.e., as it came from the camera), then ACR/Lr should be able to read it fine.

    Can you try making this change, and I can test it for you?

    Thanks!
    Peter

  33. Tim and Peter – did you try this yet? I’m running into the 1:1 aspect ratio bug now and it’s preventing me from getting off aperture and going FT lightroom.

  34. Hi Tim –
    Have you had a chance to look at this? I’m in sort of a bad way now as I have discarded the original images after applying the DeAspect plugin to them, and I’m now left with raw files that I can’t read in newer versions of Lightroom..

    Thanks,
    Peter

  35. Hei Peter,

    I’m sorry, I haven’t had a look at this. When LR6 comes out with face recognition (as it was reported on some news sites) I might update. Unless 6 covers the aspect ratio functionality itself, I will probably update DeAspect.
    In the meantime you could try running exiftool manually in order to update the CroppedImageWidth and CroppedImageHeight according to what Eric proposed. Just in case that is not enough, the other attributes changed by DeAspect are AspectRatio=””, AspectFrame=”0 0 0 0″, DefaultCropOrigin=””, DefaultCropSize=””.

    Remember to make backups of any files you plan to touch, before trying something.

    Greetings
    Tim

  36. Hi, has anyone been able to find a solution for 5d mk3 files with 1:1 embedded aspect ratio? i tried running the DeAspect plug in but the LR is not able to edit the new “corrected” files. anyone has a fix for that? or a command line version i can run to save my batch? I’ve not been able to find a fix using the info in this thread, but then again, Im not a computer expert.. so if anyone can help (the more specific the better 🙂 i’d really appreciate it

    thanks

  37. Many Thanks! Saved lots of shots and nerves. Both my girlfriend’s and mine 🙂 Will make sure to setup correct aspect ratio in camera before shooting raw from now on.

  38. Hello Tim,
    it seems that deaspect is not worling any longer on my system. If I start it the following error is reported:

    [string “DeAspect.lua”]:44: attempt to concatenate local ‘height’ (a nil value)

    I´m using Lightroom 6.6.1 on a Max running MacOS Sierra 10.12

    kind regards
    martin

  39. Hei Martin,

    I am currently rather busy but I will try to test this sometime soon.
    Thank you for letting me know.

    Cheers
    Tim

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.