17 Replies Latest reply on Jul 30, 2009 12:17 PM by Thydell

    Restoring bitmap (image) dimensions and PPI

    Thydell

      Here's something I haven't found a quick solution to after several years of use.

       

      The scenario is the following:

       

      1. You receive a document that has the images embedded and no access to original links.

      2. The images are scaled and proportions have changed. For example, PPI: 85.372 x 71.954 and Image Scale (H, V): 84.337%, 100.065%.

       

      Is there a quick way to change image scale to 100%, 100% or PPI to 72 x 72??

      I always have to do this by calculating the percentage the image has to be restored by horizontally and vertically to get the original ratio.

       

      Cheers.

        • 1. Re: Restoring bitmap (image) dimensions and PPI
          Jesseham Level 4

          Not built in, that I know of, but that sounds like something that could be solved with a script.  You might try asking over in the Illy scripting forum.

          • 2. Re: Restoring bitmap (image) dimensions and PPI
            Jesseham Level 4

            Also, if you have Acrobat, you can save the .ai file as a .pdf and open it in Acrobat and use the "Extract Images" command, which will save them all out (hrm, will it un-distort them first?)

            • 3. Re: Restoring bitmap (image) dimensions and PPI
              Mylenium Most Valuable Participant

              Jesseham wrote:

               

              Also, if you have Acrobat, you can save the .ai file as a .pdf and open it in Acrobat and use the "Extract Images" command, which will save them all out (hrm, will it un-distort them first?)

               

              Depends on how they were embedded when saving. If no conversion options of any kind were used, they are in a format Acro natively supports (TIFF, JPEG, PNG etc.) and they don't overlap with other objects, they should have been embedded 1:1, even if their bounding box is scaled. If however they were cropped, have mixed color profiles or another object intersects them, they usually are resampled and/ or tiled to retain appearance. Hard to tell. A lot of that really depends on how the programs translate features to PDF.

               

              Mylenium

              • 4. Re: Restoring bitmap (image) dimensions and PPI
                Larry G. Schneider Adobe Community Professional & MVP

                You could always just choose Rasterize from the Object menu and choose a PPI.

                • 5. Re: Restoring bitmap (image) dimensions and PPI
                  Thydell Level 1

                  Almost works...

                  • 6. Re: Restoring bitmap (image) dimensions and PPI
                    Thydell Level 1

                    Mylenium: Thanks, but that doesn't solve the dimension distortion.

                    • 7. Re: Restoring bitmap (image) dimensions and PPI
                      Thydell Level 1

                      Mylenium wrote:

                       

                      Jesseham wrote:

                       

                      Also, if you have Acrobat, you can save the .ai file as a .pdf and open it in Acrobat and use the "Extract Images" command, which will save them all out (hrm, will it un-distort them first?)

                       

                      Depends on how they were embedded when saving. If no conversion options of any kind were used, they are in a format Acro natively supports (TIFF, JPEG, PNG etc.) and they don't overlap with other objects, they should have been embedded 1:1, even if their bounding box is scaled. If however they were cropped, have mixed color profiles or another object intersects them, they usually are resampled and/ or tiled to retain appearance. Hard to tell. A lot of that really depends on how the programs translate features to PDF.

                       

                      Mylenium

                       

                      Thanks... Calculations work best so far I think... Tedious but accurate...

                      • 8. Re: Restoring bitmap (image) dimensions and PPI
                        Mario Arizmendi Level 3

                        In this situation, I use an script named UnScale from somebody, (Sorry, cant' rememeber his name)  see attached.

                         

                        After the script is applied to any photo, the scale and rotation are restored to original settings.

                         

                        Edition

                        The file is queved, so if you want tell me an I'll send you de code

                        • 9. Re: Restoring bitmap (image) dimensions and PPI
                          Wade_Zimmerman Level 6

                          Mario click on the persons name you can send a private message without having their e-mail.

                          • 10. Re: Restoring bitmap (image) dimensions and PPI
                            Mario Arizmendi Level 3

                            thanks wade, I know that. just waiting if Thydell still needs the script.

                            • 11. Re: Restoring bitmap (image) dimensions and PPI
                              Mike Sofa Level 2

                              Mordy Golding provides this method at his Real World Illustrator blog:

                              http://rwillustrator.blogspot.com/2008/11/technique-unembedding-images.html

                              He gives a detailed description, but basically it's save as PDF, open in Photoshop, choose the Images option.

                              Hope this helps

                               

                              Mike D.

                              • 12. Re: Restoring bitmap (image) dimensions and PPI
                                Thydell Level 1

                                Mario Arizmendi wrote:

                                 

                                In this situation, I use an script named UnScale from somebody, (Sorry, cant' rememeber his name)  see attached.

                                 

                                After the script is applied to any photo, the scale and rotation are restored to original settings.

                                 

                                Edition

                                The file is queved, so if you want tell me an I'll send you de code

                                 

                                I'd love to try it!

                                • 13. Re: Restoring bitmap (image) dimensions and PPI
                                  Thydell Level 1

                                  Mike Sofa wrote:

                                   

                                  Mordy Golding provides this method at his Real World Illustrator blog:

                                  http://rwillustrator.blogspot.com/2008/11/technique-unembedding-images.html

                                  He gives a detailed description, but basically it's save as PDF, open in Photoshop, choose the Images option.

                                  Hope this helps

                                   

                                  Mike D.

                                   

                                  This is great. Can't belive I was unaware of this feature!

                                  • 14. Re: Restoring bitmap (image) dimensions and PPI
                                    Luke Jennings Level 4

                                    One more way to do it is to save your .ai as a PDF, then in Acrobat use tools> advanced editing> touch up object tool, select the image, then right click (control click). Choose edit image and the image will open in Photoshop without the distortion, sometimes.

                                    • 15. Re: Restoring bitmap (image) dimensions and PPI
                                      Mario Arizmendi Level 3

                                      Ok, Suppsosing you are on a Mac, see bellow the code, copy and paste exactly as it is in whatever TexEditor, and save it naming it UnScale.js (remove manually whatever other extension like .txt or .rtf..ect).

                                       

                                      Then place that file into your script directory and access it form the Illustrator CS3 application File/Scripts/OtherScripts... you must selec first the photo before aplly the script.

                                       

                                      so here is the code

                                       

                                      //    UnScale.js
                                      //    http://www.pictrix.jp/    Umezawa
                                      //

                                       

                                      if ( documents.length > 0 ){

                                       

                                          SelObj = activeDocument.selection;

                                       

                                          for ( i = 0; i < SelObj.length; i++ ){

                                       

                                              gp( SelObj[ i ] );
                                          }
                                      }

                                       


                                      function gp( xObj )
                                      {
                                          if( xObj.typename == "GroupItem" ){

                                       

                                              var gnObj = xObj.groupItems;

                                       

                                              if ( gnObj.length > 0 ){

                                       

                                                  for ( var g = 0; g < gnObj.length; g++ ) gp( gnObj[ g ] );
                                              }

                                       

                                              gObj = xObj.placedItems;

                                       

                                              for ( j = 0; j < gObj.length; j++ ){

                                       

                                                  type = check( gObj[ j ] );
                                                  if ( type != 0 ) reset( gObj[ j ], type );           
                                              }

                                       

                                              gObj = xObj.rasterItems;

                                       

                                              for ( j = 0; j < gObj.length; j++ ){

                                       

                                                  type = check( gObj[ j ] );
                                                  if ( type != 0 ) reset( gObj[ j ], type );           
                                              }

                                       

                                          }
                                          else{

                                       

                                              type = check( xObj );
                                              if ( type != 0 ) reset( xObj, type );
                                          }
                                      }

                                       


                                      function check( pi )
                                      {
                                          type = 0;

                                       

                                          if ( pi.typename == "PlacedItem" ){
                                              if ( pi.file.name.indexOf('.eps') != -1 ) {
                                                  type = 1;
                                              }
                                              else type = 2;
                                          }

                                       

                                          if ( pi.typename == "RasterItem" ) type = 3;

                                       

                                          return ( type );
                                      }

                                       


                                      function reset( pi,  type )
                                      {
                                          pos = pi.position;
                                          mx = pi.matrix;

                                       

                                          mx.mValueA =  ( type == 2 )? -1.0 : 1.0;
                                          mx.mValueB = 0.0;
                                          mx.mValueC = 0.0;
                                          mx.mValueD = 1.0;

                                       

                                          pi.matrix = mx;

                                       

                                          pi.left    = pos[ 0 ];
                                          pi.top    = pos[ 1 ];

                                       

                                          if ( type == 2 ) pi.rotate( 180.0 );
                                      }

                                      1 person found this helpful
                                      • 16. Re: Restoring bitmap (image) dimensions and PPI
                                        Thydell Level 1

                                        Mario Arizmendi wrote:

                                         

                                        thanks wade, I know that. just waiting if Thydell still needs the script.

                                         

                                        Cheers. That works too.

                                        • 17. Re: Restoring bitmap (image) dimensions and PPI
                                          Thydell Level 1

                                          Mario Arizmendi wrote:

                                           

                                          Ok, Suppsosing you are on a Mac, see bellow the code, copy and paste exactly as it is in whatever TexEditor, and save it naming it UnScale.js (remove manually whatever other extension like .txt or .rtf..ect).

                                           

                                          Then place that file into your script directory and access it form the Illustrator CS3 application File/Scripts/OtherScripts... you must selec first the photo before aplly the script.

                                           

                                          so here is the code

                                           

                                          //    UnScale.js
                                          //    http://www.pictrix.jp/   Umezawa
                                          //

                                           

                                          if ( documents.length > 0 ){

                                           

                                              SelObj = activeDocument.selection;

                                           

                                              for ( i = 0; i < SelObj.length; i++ ){

                                           

                                                  gp( SelObj[ i ] );
                                              }
                                          }

                                           


                                          function gp( xObj )
                                          {
                                              if( xObj.typename == "GroupItem" ){

                                           

                                                  var gnObj = xObj.groupItems;

                                           

                                                  if ( gnObj.length > 0 ){

                                           

                                                      for ( var g = 0; g < gnObj.length; g++ ) gp( gnObj[ g ] );
                                                  }

                                           

                                                  gObj = xObj.placedItems;

                                           

                                                  for ( j = 0; j < gObj.length; j++ ){

                                           

                                                      type = check( gObj[ j ] );
                                                      if ( type != 0 ) reset( gObj[ j ], type );           
                                                  }

                                           

                                                  gObj = xObj.rasterItems;

                                           

                                                  for ( j = 0; j < gObj.length; j++ ){

                                           

                                                      type = check( gObj[ j ] );
                                                      if ( type != 0 ) reset( gObj[ j ], type );           
                                                  }

                                           

                                              }
                                              else{

                                           

                                                  type = check( xObj );
                                                  if ( type != 0 ) reset( xObj, type );
                                              }
                                          }

                                           


                                          function check( pi )
                                          {
                                              type = 0;

                                           

                                              if ( pi.typename == "PlacedItem" ){
                                                  if ( pi.file.name.indexOf('.eps') != -1 ) {
                                                      type = 1;
                                                  }
                                                  else type = 2;
                                              }

                                           

                                              if ( pi.typename == "RasterItem" ) type = 3;

                                           

                                              return ( type );
                                          }

                                           


                                          function reset( pi,  type )
                                          {
                                              pos = pi.position;
                                              mx = pi.matrix;

                                           

                                              mx.mValueA =  ( type == 2 )? -1.0 : 1.0;
                                              mx.mValueB = 0.0;
                                              mx.mValueC = 0.0;
                                              mx.mValueD = 1.0;

                                           

                                              pi.matrix = mx;

                                           

                                              pi.left    = pos[ 0 ];
                                              pi.top    = pos[ 1 ];

                                           

                                              if ( type == 2 ) pi.rotate( 180.0 );
                                          }

                                          Thanks!