15 Replies Latest reply on May 26, 2011 8:29 AM by amademan

    Changing crop size without changing crop positioning on multiple DNGs

    amademan

      I have a question about cropping in camera raw. Lets say I have a batch of images open in camera raw which all have custom positioned crops at 900x600 pixels. I then want to change them all to a 2:3 ratio. If I select all the images and go to the crop tool and change the crop from 900x600 to 2:3 it goes through and repositions all the crops similar to the first image. (So if the first image was cropped primarily in the upper left and the second image was primarily cropped in the lower right, the 2nd image will now have the crop moved to the upper left) The only way I have found to keep the crop positioning is to individually select each one and then change them from 900x600 to 2:3. Does anyone know another way to do this without losing the crop positioning. Since the sizes are proportionate to each other you would think there would be an easy solution but I haven't figured it out. By the way, I am using CS5. Any help would be appreciated. I asked this question about a year ago and still haven't found a solution.

       

      Please, please help. I don't want to have to make one of my employees go through tens of thousands of images and adjust the crop one by one.

        • 1. Re: Changing crop size without changing crop positioning on multiple DNGs
          ssprengel Adobe Community Professional & MVP

          Crops are not in pixels and 900x600 is a 3:2 ratio so it is unclear what it is you're wanting to do, flip portrait and landscape (3:2 to 2:3)?  Or just change the numbers from 900:600 to 3:2 in the metadata so the numbers look better?

          • 2. Re: Changing crop size without changing crop positioning on multiple DNGs
            amademan Level 1

            The crops are indeed in pixels. When you select the crop tool and go to custom you can crop by ratio/pixels/inches. Currently the crops are set to 900x600 (or 600x900) pixels. I want the crops to be set by a 2:3 ratio. Reason being, we are implementing a database that converts DNGs on the fly. Unfortunately if we convert to a 4"x6" print size it is upscaling a 900x600 since that is the image size info stored in the DNG currently. So I need to keep the same crop positioning on thousands upon thousands of images but change the size to a ratio so the database pulls it at it's original size.

             

            The change is simply enough if you select each DNG and change to 2:3. But if I synch that crop across multiples, the crop positioning from the initial image I'm synching from is applied to all. It's almost as if adobe needs to have crop size and crop positioning be two different elements. Right now they are applied together so i'm starting to lose hope.

             

            Crop_Screenshot.jpg

            • 3. Re: Changing crop size without changing crop positioning on multiple DNGs
              RASouthworth Level 3

              I set up some trial .nef's, initially sized crops within them to 600x900.  I used a text editor (Wordpad) to modify the .xmp file associated with each .nef.  Specifically, I found the Crop Unit parameter (in my setup it was near the bottom of the file) and changed the unit number from 0 to 3.  This apparently signals to Photoshop that the image should not be re-sized, but rather retain all the pixels within the crop area when opening.  I left the 600 and 900 height and width fields alone since the ratio was proper, i.e. 2:3 or 3:2 depending upon orientation.  The file did open properly in PS after the mod.

               

              It should be easy to use a search and replace within a text editor on each file.  Obviously proceed with caution, check several .xmp files for consistency on the crop parameters.

               

              Richard Southworth

              • 4. Re: Changing crop size without changing crop positioning on multiple DNGs
                amademan Level 1

                Thanks for the info Richard. But how would one edit the xmp data embedded into the DNG? There would be no sidecar file.

                • 5. Re: Changing crop size without changing crop positioning on multiple DNGs
                  RASouthworth Level 3

                  Works the same, although the text data is buried in the .dng file.  As far as I can tell, it is identical to the .xmp data.

                   

                  You're going to have to get a little nerdie on this one - assuming you're running Windows, go to portableapps.com and download the free Notebook++ super text editor.  It contains the ability to search and replace on multiple files.  I used it to go back and forth between a .dng file, changing the crop parameter from 0 to 3.  Files opened ok in Photoshop with the desired changes.

                   

                  When you open a .dng file in Notebook++ and browse, you will be able to see the text section near the beginning of the file.  Again, check on a few files before you turn loose the search and replace, and of course do it on copies rather than originals.

                   

                  Richard Southworth

                  • 6. Re: Changing crop size without changing crop positioning on multiple DNGs
                    amademan Level 1

                    Thanks again Richard. I'll have to do some testing once I get back to work tomorrow. Of course this will only be useful if changing that crop paramater has the same affect in Cumulus (our database) as it does in PS.

                     

                    I'll owe you some huge thanks and a cookie if this actually works!

                     

                    I'm curious now if one could actually change the dimensions in the xmp data without affecting the position through a search and replace just incase Cumulus doesn't handle the crop paramater in the same way as PS. I was checking out the xmp data through the file info in PS earlier today and I saw dimension details as well as crop position data fields I believe. But I didn't think I would be able to edit that data with a text editor. Although if I remember correctly the dimensions just showed 600 and 900 with no indication of those numbers being "pixels". So not sure how changing those to 2:3 would be done, unless the pixel/ratio identifiers were somewhere else in the long list of data. I'm just thinking to myself here haha.

                     

                    Can't wait to check this out tomrrow.

                     

                    Message was edited by: amademan

                    • 7. Re: Changing crop size without changing crop positioning on multiple DNGs
                      RASouthworth Level 3

                      I suspect as soon as the crop type parameter is changed from "pixels" (0) to "ratio" (3) the 600 and 900 parameters become superfluous for Photoshop.  The top left and bottom right corners along with the angle are expressed in normalized decimal form, so the ratio parameters are probably only used by ACR to control the aspect ratio of the surrounding rectangle, nothing for Photoshop (or Cumulus) to do with them once the boundaries are set.

                       

                      When I re-opened either the .nef/.xmp or .dng test files in ACR, it had no problem using 600:900 instead of 2:3 to maintain the ratio.

                       

                      Richard Southworth

                      • 8. Re: Changing crop size without changing crop positioning on multiple DNGs
                        amademan Level 1

                        Hahaha, it's been a long day. This whole time I was trying to think of what the significance of "0" and "3" were but I guess that's the identifier I was looking for. So basically any program that can handle DNG/RAW would see the crop as a 600:900 ratio rather than 600x900 pixels, and of course 600:900 = 2:3. I get it now.

                         

                        I'm more hopeful that this will work!

                        • 9. Re: Changing crop size without changing crop positioning on multiple DNGs
                          amademan Level 1

                          So it looks like it's working well. I changed the crop unit to 3 and it opened fine. I then compared it side by side (the one with 600:900 and one with 2:3) and they look exactly the same quality wise at 100%. I did go ahead and try changing the crop width and height to 2 and 3 respectively but it makes the file unrecognizable, weird. But, just changing the crop unit will work for me! It will be a little while before I can try the on-the-fly conversions in Cumulus but that should work too.

                           

                          Thanks again Richard, you're a life safer!

                          • 10. Re: Changing crop size without changing crop positioning on multiple DNGs
                            RASouthworth Level 3

                            Hadn't thought about it before, but the .dng format is like several others in that it consists of tags with section lengths, probably changing the number of characters in a section, i.e. "600" goes to "2" loses 2 characters, messes up the internal references.  You may be able to find a .dng editor, although probably not one with the capability to do search and replace on a group of files.

                             

                            Richard Southworth

                            • 11. Re: Changing crop size without changing crop positioning on multiple DNGs
                              ssprengel Adobe Community Professional & MVP

                              Changing the "600" and "900" to "2" and "3" would shorten the file contents up by 4 bytes, and this would make the byte-offsets to things after the XMP metadata not right, anymore.  There are offsets to the main image data and to the embedded prevew as well as other things.  If you found some way to add 4 spaces after the 2 and 3 then it might work.

                              • 12. Re: Changing crop size without changing crop positioning on multiple DNGs
                                RASouthworth Level 3

                                Good point, token separators such as "space" usually work in multiples.  However, from my experimentation, ACR is equally happy with 600:900 as compared to 2:3, so no real need to modify.

                                 

                                Richard Southworth

                                • 13. Re: Changing crop size without changing crop positioning on multiple DNGs
                                  amademan Level 1

                                  I know there is no difference by making it show 2:3 over 600:900 but I'm just being anal. I was just curious if it COULD work. I ended up using "002" and "003" and that worked perfectly.

                                   

                                  Thanks again to both of you! This is going to save me and my people tons and tons of work!

                                  • 14. Re: Changing crop size without changing crop positioning on multiple DNGs
                                    RASouthworth Level 3

                                    I see one minor complication substituting values for the 600 and 900, depending upon how you define the search string.  Depending upon whether the image is portrait or landscape orientation, the 600 and 900 may be in different strings, either may be embedded in the cropwidth or cropheight parameter.  I guess you could have the search and replace strings defined both ways, and assume the software won't care if it can't find the string.

                                     

                                    IMO you'd be better off just leaving the 600 and 900 alone, I see no intrinsic or aesthetic advantage in having 002:003 instead of 600:900.

                                     

                                    Richard Southworth

                                    • 15. Re: Changing crop size without changing crop positioning on multiple DNGs
                                      amademan Level 1

                                      I think I would just have to do multiple search/replaces. The interesting thing is that whether it's a horz. or vert. the width is always 2 and the height is always 3.