megapixel-sort-20091214.10.zip
· Version History
· Update Log via RSS
· Installation instructions
· “Donationware” Registration Info
· More Lightroom Goodies
· All-Plugin Update Log via RSS
· My Photo-Tech Posts
· My Blog
This plugin is designed to fill a specific need that some pro photographers have, which is the ability to sort images by their megapixel size, even after cropping.
As shipped, Lightroom does have a “Megapixels” metadata item that is normally hidden, although it can be viewed by adding it to a metadata-viewer preset (such as with my Metadata-Viewer Preset Builder plugin). Unfortunately, that reflects the pixel size of the original image, not taking into account any crop that might have been applied. And even then, it's not among the items one can sort on, or even select via the Library Grid's Library Filter
|
Possible values for the
Megapixel Range custom metadata item | ||
| not yet computed | ||
| < 0.5 MP | ||
| 0.5 MP | - | 0.99 MP |
| 1 MP | - | 1.99 MP |
| 2 MP | - | 3.99 MP |
| 4 MP | - | 5.99 MP |
| 6 MP | - | 7.99 MP |
| 8 MP | - | 11.99 MP |
| 12 MP | - | 15.99 MP |
| 16 MP | - | 23.99 MP |
| 24 MP | - | 31.99 MP |
| 32 MP | - | 47.99 MP |
| 47 MP | - | 63.99 MP |
| 64 MP | - | 99.99 MP |
| 100 MP | - | 199.99 MP |
| 200 MP | - | 349.99 MP |
| 350 MP | - | 499.99 MP |
| > 500 MP | ||
Custom Metadata
This plugin creates two custom metadata items for each image it is applied to. The first, “Cropped Megapixels”, has values like “12.05 MP”. The second, and “Megapixel Range”, has one of the values listed in the box at right.
Once this data has been calculated for each image (see below), it can be viewed via the “All Plug-in Metadata” preset in the Metadata panel of the Library Module.
Calculating and Recalculating
Unfortunately, the Lightroom plugin infrastructure does not yet allow for custom metadata to be created and updated automatically, so you must explicitly tell the plugin to calculate the custom metadata.
So, this plugin adds two items to the File > Plug-in Extras menu, “Calculate Megapixels” and “Calculate Megapixels For Entire Catalog”. The former calculates the two custom-metadata values for each selected image, while the later does it for every image in the current catalog.
The plugin has no way of knowing when you make a cropping adjustment to an image, so you must remember to reapply the plugin to any images whose crop you change. That's a real hassle, and perhaps some future version of Lightroom will alleviate this burdensome requirement.
Still, even on my sort-of-old computer at home, the plugin can recalculate the data for my entire 45,000-image catalog in only about 30 seconds, so it's not that bad to just redo everything. Note that it's much more efficient to use “Calculate Megapixels for Entire Catalog” than selecting every image in the catalog and invoking “Calculate Megapixels”.
“Sorting” By Megapixel Size
You can't actually sort via megapixel size, even using this plugin, but you can use the Library Filter to do something close. The Library Filter is in the Grid Module; use the “/” key to bring it into view if it's not already visible.
(Be sure that you've calculated the plugin metadata, as described above, prior to this step.)
In the Library Filter, select “Metadata”, then click on one of the column heads and select “Megapixel Range”. You should then be presented with a list of the range items that apply to the currently-visible images. If they all have the same crop, they'll all be within one range, and so only one value will display. But if their image sizes or crop sizes put them into different ranges, multiple lines will show.
You can then click on one of the lines to isolate only the associated images.
Availability
This plugin is distributed as “donationware”. I wrote it and make it available for free — everyone can use it forever, without cost of any kind — but unless registered, its functionality is somewhat reduced after six weeks. Registration costs the minimum 1-cent PayPal fee; any additional donation you'd like to make in encouragement or thanks is optional and completely up to you. For details, see my blog post titled Lightroom Plugin Development: Now With Added Encouragement.
Lightroom 3 — Registrations in Lightroom 2.x will not carry over to Lightroom 3 when it is released, so plan that you'll have to re-register if you upgrade to Lightroom 3. (That's for the real Lightroom 3.... registration is not required in the Lightroom 3 Public Beta, but be warned that plugin support is spotty and plugins may not work well there.)
( Update Log via RSS| 20091214.10 | Broke out the “< 0.5 MP” item into two, “< 0.1 MP” and “< 0.1 - 0.49 MP”. The change is not immediately reflected in photos that were processed earlier, so if you're interested in the new slice, you'll want to recompute MP for ones currently marked “< 0.5 MP”, or just recompute for your whole library. |
| 20091205.9 | Minor internal debugging tweaks. |
| 20091022.8 | Added a first draft of some rudimentary support for Lightroom 3 Beta. See this important note about plugin support in Lightroom 3 Beta and Lightroom 3, including future plans for features and my registration system. |
| 20090802.7 | Sigh, I shouldn't try to program while on vacation... the previous version was totoally broken. Trying again. |
| 20090801.6 | It seems that Lightroom reports that some images have no size (which makes no sense, of course), so I've added more debugging stuff to the log for these cases... |
| 20090801.5 | Corrects a few misspellings. |
| 20090703.4 | Expanded the upper end of the range from “> 64 MB” to “> 500 MP” to accommodate the fact that Lightroom can handle images up to 512 megapixels. Enhanced the one-click upgrade stuff quite a bit, now detecting ahead of time when it will fail because the plugin is installed where Lightroom can't write (if Lightroom can't write to it, it can't update itself). I also added a progress bar, and now download in smaller chunks to avoid 'out of memory' errors on the larger plugins. Do remember that this new functionality becomes available after you upgrade to or past this version, when you then upgrade with it. |
| 20090521.3 | Fixed a "loadstring" error some users got. |
| 20090510.2 | Added a link in the Plugin Manager to the plugin's update-log RSS feed. |
| 20090428.1 | First public release. |
Hello, interesting plugin, do you think one that allow sorting by focal length would be possible as well? I find that lack in LR annoying (I even mentioned it on the Adobe forum…).
Cheers and thanks!
As Ollivier Robert suggested, it would really be usefull to allow sorting by focal length. It would then be possible to create Smart collections with different groups of focal lenghts. like 40mm, … or even tele, wide, …
The problem is that compact camera’s tend to record the compact focal length, so a 7mm would be in reality a 28mm for a 35mm camera. The 35mm equivalent should be then calculated one way or another. I believe there is an exif attribute holding the 35mm equivalent but I’m not sure.
Yes, I agree focal length filter/sorter would be a very useful.
Another vote for the Focal Length. Having just got a Leica M8 I really want to be able to filter based on the lens I used.
regards from the Stockholm archipelago.
I can`t find how to get the cropped dimensions in lightroom SDK API. How did you managed?
Thank you
local size = photo:getRawMetadata('croppedDimensions') —Jeffrey
Thanks a lot for the answer. It works fine. I don’t understand why it is not on the SDK documentation. Is there any additional source of information?
There’s a Lightroom SDK forum over at Adobe as well. —Jeffrey
I need to be able to determine the UNCOMPRESSED size of a JPEG file.
My stock agency requires the JPEG, when opened in Photoshop or any other application, to be at least 48MB in file size. Is it possible to make a plugin that would calculate this?
For example, one of my JPEG files is caclulated by your plugin to be 12.1 Megapixels. The JPEG is 7.6MB. Opened in Photoshop, it’s 34.4MB.
The only two image editing programs that I know to give me this data are ACDSee Pro 3 and Photoshop. Sure would be nice to see it in Lightroom.
Alan
I don’t see how you’re getting 34.4MB from 12.1 MP (2.8 bytes/pixel?), but you can upsize on export to meet arbitrary size requirements. Tim Armes’ LR2/Mogrify plugin has some options to do this automatically. —Jeffrey