megapixel-sort-20120330.25.zip
· FAQ
· 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 fills a specific need that some pro photographers have, which is the ability to sort images by their megapixel size, even after cropping.
This plugin works in Lightroom 4, Lightroom 3, and Lightroom 2. (Though for Lightroom 3, you must have at least version 3.5)
The same download works for both Windows and Mac. See the box to the upper right for the download link link (in orange) and installation instructions.
Note: a Lightroom major upgrade, such as from Lr3 to Lr4, de-registers the plugin in the upgraded version, thus requiring a new (1-cent if you like) registration code in the upgraded version. It makes for a hassle every couple of years, I know. Sorry. See this note for details.
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 have chosen to 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 is done via PayPal, and if you choose to register, it costs the minimum 1-cent PayPal fee; any amount you'd like to add beyond PayPal's sliding fees as a gift to me is completely optional, and completely appreciated.
For details on plugin registration and on how I came into this hobby of Lightroom plugin development, see my Plugin Registration page.
Version History
(
Update Log via RSS
)
| 20120330.25 | Update to handle 4.1RC |
| 20120309.24 | Had broken registrations in Lr2; Update to the debug logging to better track down timing issues that might arise. |
| 20120304.23 | More updates for Lr4. |
| 20120221.22 | More updates for Lr4. |
| 20120128.20 |
More on the march toward Lr4, including upheaval in the code to handle Lightroom APIs being discontinued in Lr4. |
| 20120114.19 | More tweaks for Lr4b |
| 20120112.18 |
Update for Lr4 beta: explain in the plugin manager that the plugin can't be registered in the beta. |
| 20111210.17 |
Had issues with the registration button sometimes not showing. When doing a plugin upgrade, offer the ability to flush all the old copies of the plugin. Added a system-clock check and reports to the user if the system clock is more than a minute out of date. An incorrect system clock can cause problems with various kinds of communication and authentication with some of my plugins, so I've just gone ahead and added this to every plugin. |
| 20100829.16 | Made the revalidation process much simpler, doing away with the silly need for a revalidation file. |
| 20100820.15 | Discovered a bug in my plugin build system that caused horribly difficult-to-track-down errors in one plugin, so am pushing out rebuilt versions of all plugins just in case. |
| 20100625.14 | Yikes, shaking out some more build issues. |
| 20100624.13 | Discovered a nasty build bug; pushing a new version in case it affects this plugin. |
| 20100609.12 |
This version can be registered in Lightroom 3. It can run in Lightroom 2 or Lightroom 3; it does not work in the Lr3 betas. It uses my new registration system when run on Lightroom 3, which avoids some of the silly issues of the old one. Please take care to note the details on the registration page: use of this version (or later) of the plugin in Lightroom 3 requires a new registration code, even if you had registered some older version of the plugin. |
| 20100315.11 |
Completely changed how the one-click upgrade applies the newly-downloaded zip file, in the hopes that it'll work for more people. Rather than unzipping over the old copy, it now unzips to a temporary folder, then moves the old folder out of the way and the new folder into place. Prior versions' folders are now maintained (with the version number in the folder) in case you want to revert a version; you may want to clear them out from time to time. Of course, it won't take affect until you try to upgrade after having upgraded to or beyond this version. Wholesale changes that attempt to honor the user's locale settings for numeric display (e.g. Europeans writing 3,14156 for pi). I've probably missed some spots, so let me know if you find some. |
| 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
Interesting plugin. I’m trying t find a way to sort by file size.
Essentially, I want to create a smart collection that shows me excessively large files (TIF and PSD) that are over a year old. My thought is that at that point, some/many/most of them can be flattened and I can reclaim hard drive real-estate. But I’m stymied by the lack of file size sort. Any suggestions?
The best I can suggest is to use the Library Grid Filter to isolate images that have not been edited in a while, then among those, use my Extended-Search plugin to isolate ones that have a large file size. —Jeffrey
I was shocked to discover Lightroom doesn’t ship with this functionality built-in. Thank you so much for your work on this. The plugin works great.
I tried this plugin, and it does what it claims, but I find myself needing different “megapixel buckets” than it gives me.
While you could solve this by allowing the user to enter custom ranges, I think it would be better if the plugin could calculate optimum buckets by itself based on the population of photos in my particular library. For algorithm inspiration, I suggest looking into Heckbert color quantization. (http://en.wikipedia.org/wiki/Color_quantization) Instead of subdividing 3D color space, you’d be subdividing 1D megapixel space.
So you understand where I am coming from, my immediate need here is that I have a bunch of old photos in my library, scattered all over, and I want to start deleting or downrating ones that have too few megapixels by today’s standards. The < 0.1 MP bucket is minimally useful to me because I have very few photos that were that bad. The next bucket up (0.1-0.5 MP) catches too many photos I want to keep. I suspect I’d be most interested in removing things in the 0.2-0.3 MP range.
I think if you did a Heckbert-like automatic clump finder on the population of megapixel values in my library, you’d automatically generate a bucket in the right sort of range for my needs. It might be necessary to allow a custom number of buckets, to get enough resolution.
The problem is that Lightroom doesn’t allow any of this to be dynamic, so the best I can do is come up with something that seems useful to the most folks. It would be much better for Lightroom to deal with this as a first-class bit of metadata, so the plugin wasn’t needed at all. )-: —Jeffrey