5 Replies Latest reply on Jun 6, 2010 1:20 PM by Lichtzeichenanlage

    Individual pixels from an image?

    PaulWaldo Level 1

      Hi all,

       

      I'm new to Lightroom plugin development, and hopefully this problem won't stop me in my tracks :-)

       

      I've search the SDK docs as well as google, but I have not been able to find out how you can get the individual pixel values for an image.  Given an image, I want access to every RBG value.  Is this even possible?  Thanks in advance!

        • 1. Re: Individual pixels from an image?
          PaulWaldo Level 1

          I've realized I probably need to be a little more specific :-)  What I want to do is examine an image's RBG data in a read-only fashion and update the image's metadata based on crunching the RGB data.  From more perusal of the docs, I'm pretty sure this is not possible and maybe even discouraged.  The only other option I see is using an Export Post Process action.  I would have to export all the photos to disk, pull out the RBG data using some external process, then somehow push that value back to Lightroom.  Methinks this plugin will be no speed demon :-O

           

          I can handle the exporting of the images, and can easily get the RBG info I need, but I don't see how I can the data pushed back into LIght room when done.  Any ideas?  Thanks in advance!

          • 2. Re: Individual pixels from an image?
            JW Stephenson Level 4

            First off, be sure the data you want to change can be modified by the LR SDK.  Review the fields in photo:setRawMetadata documentation.

             

            If you can write the LR fields you desire, or if you are planning on modifying user-defined fields, the I think the only way you can do this is to (1) create your own export routine, (2) pause after each LR rendering and execute your external RBG reading software, (3) have the RBG reading software somehow write the data you need out to a low level file such as a text file, and (4) using lua file commands, read that file into a LR variable that you can then stuff back into LR.  Since lua is not a language I am deeply familiar with, I only assume it has low-level file reading capability - I don't personally know the command or syntax.

             

            This may or may not work, I obviously have not tried it personally.  There may also be an easier way to get LR to bring the results of an external application into a memory variable but I could not find it.  Hopefully someone else will make a suggestion as well.

             

            Good Luck!

             

            Jeff

            • 3. Re: Individual pixels from an image?
              escouten Adobe Employee

              JW has pointed you in basically the right direction. There is no provision in the SDK for pixel-level access, so you would have to do the pixel interpretation via some sort of external process.

              • 4. Re: Individual pixels from an image?
                PaulWaldo Level 1

                The data I want to modify is my plugin's own metadata, so no problem there...

                 

                That was my general plan, but the implementation of getting the data back into LR looks hairy.  It appears to

                me that image rendering is done asynchronously, so there is no direct linkage to a LR image (where I can set metadata) and a rendered image "results file"

                 

                Why is it that whenever I pick a project for a new language, it gets really hairy really quick?  Yikes!

                 

                Thanks for the encouragement, I'll be giving it a shot!

                • 5. Re: Individual pixels from an image?
                  Lichtzeichenanlage Level 1

                  Hi,

                   

                  unless LR's philosophy is not pixel-based this is IMHO hardly manageable by LR. However some hints:

                   

                   

                  That was my general plan, but the implementation of getting the data back into LR looks hairy.  It appears to

                  me that image rendering is done asynchronously, so there is no direct linkage to a LR image (where I can set metadata) and a rendered image "results file"

                   

                   

                  Within an export session you do have informations about the source (exportRendition.photo) and a path to the rendered image (exportRendition.destinationPath). If you implement a MyPlugin.processRenderedPhotos function you should be able manage the asyn problems. Perhaps you can an external tool

                   

                   

                  Why is it that whenever I pick a project for a new language, it gets really hairy really quick?  Yikes!

                   

                   

                  It looks the same to me but pixel based stuff is not LR's world.

                   

                  rgds - wilko