1 2 Previous Next 15 Replies Latest reply on Apr 17, 2014 8:12 PM by mardikennedy

    Demo file: Image downsizing during data entry

    Stephen Huston

      Attached is a file which demonstrates how to use Container Functions introduced in FMP12's calculation engine to automatically downsize images at the time they inserted into a record. This is a common need to reduce file bloating from image storage.

       

      It demonstrates Script Triggers, Named Layout Objects, and Container Functions, along with several scripts. The demo file can also be used to save the downsized images back out to the desktop for use in other software, including websites and presentations.

       

      The file includes a 4-page PDF detailing the setup of the simple interface, the calculations, and the trigger script. The PDF can be accessed via the "About this file" button on the main screen. The file also contains a sample image which can be Exported via a button, then reinserted to test the downsizing at various resolutions.

       

      I hope this will encourage any developers who have not yet worked with the FMP12 Container Functions. The file is fully unlocked and can be used freely.

       

      Enjoy,

      Stephen Huston

      Data ex Machina

        • 1. Re: Demo file: Image downsizing during data entry
          mardikennedy

          Hi Stephen,

           

          Thank you so much for this!

           

          In pre-v12 days I'd created a set of scripts to export bloated images, import them to iPhoto, resize them, export them out, reimport them, yada yada, but this is a great improvement on that palaver.  And, by sheer chance, I have to visit a site tomorrow to do emergency work on an .fp5 file that's reached its 2 Gb limit so this will get immediate use.

           

          My plan is to convert a backup of the .fp5 file to .fp7 (v11, machine 2) and then convert it to .fp12.  Import all of its pics into a copy of your tool.  Resize and then export the jpgs to a folder on the desktop.  Copy this folder back to machine 1 and import the folder of pics into a temp .fp5 file. (Much easier to import a folder of pics into an empty file and then handle the matching, .fp5 to .fp5.  Oops, when I have access to .fp5, I'll have to find out if this option existed back then.)  Then, import from the Temp .fp5 file, into another backup of the original .fp5 file, which has had all the images excised.  Hopefully then just swap the files over, the new file being much lighter.

           

          I haven't yet been able to test if the resized pics exported out of your tool will insert back into an .fp5 file, but I think it should be fine, even tho' the jpg definitions have evolved over the years.

           

          How many years since I last saw an actual .fp5 file?  Maybe 7 years, and about 12 years since I last saw that site's data.  It'll probably have some surprises.

           

          All the best,

          Mardi Kennedy

          • 2. Re: Demo file: Image downsizing during data entry
            Stephen Huston

            My experience has been that FMP12 file formats preserve the same image format in the exported file as the image had when entered in the file, so I would expect the original images, once resized to work just as well when re-entered into the older file. Consider updating that old FP5 file to at least FP7 if not FMP12; it's getting hard to find a computer to run the older formats!

            • 3. Re: Demo file: Image downsizing during data entry
              mardikennedy

              Fortunately I was able to test the night before visiting that site and confirmed that - sadly - the converted images were not going to be backwardly compatible.  That jogged some recollections that actually the jpg encoding had changed significantly over the eons etc etc.

               

              As for 'surprises on site' - of course there were!  Only to be expected with a client using 2002 versions of software.  Fortunately I came across a 2009 post from Jimmy Jones which explained the critical feature perfectly, ie back in v6 days, once the file reached 2 Gb, it began to 'eat itself', making it unrecoverable. (http://filemaker.463488.n4.nabble.com/Ye-olde-2GB-Filemaker-5-6-file-size-limit-td486786.html)

               

              The priority was then to find a recoverable backup and I must say, Time Machine, in spite of its 'don't allow it to back up an open database' flaws, was a godsend.

               

              The eventual conclusion was that I left them with a v11-based runtime (non-optimised images) and a v12-based runtime (optimised images).  The OS on the five year old computer doesn't run a v12 runtime so it's now up to their computer guy to make the call on whether that computer can get an upgraded OS or not.  They were planning to replace the hardware in a few months so maybe the schedule will get rejigged.

               

              If they end up using the v11 runtime for a few months, it'll still be relatively quick and easy to to rebuild a v12 version.  The optimised images are also saved into a separate file so redoing that is not necessary.  At a pinch, the images optimised via v12 probably could be matched to the v11 file but it was late in the day and that was not on the priority list.

               

              The plan is to end up back with a copy of FMP but no point in getting anything less than v13.

               

              Client ended up relatively happy and critical business data sleeps more soundly now.

              • 4. Re: Demo file: Image downsizing during data entry
                Stephen Huston

                I have coverted old v5 files which hit their 2Gig limit, and the v7 or v12 converted files work after conversion!

                 

                Good to know if they're willing to upgrade.

                • 5. Re: Demo file: Image downsizing during data entry
                  bigtom

                  Image size control is huge for Filemaker solutions especially on Go and WebDirect.

                   

                  The other thing that is greatly helpful is being able to convert JPEG compression. There is only one plugin that claims to be compatible with FMP13 that can handle this. The plugin needs other third party software installed and that seems messy,  for the moment the only option for automated control maybe.

                   

                  Changing a JPEG from High quality to Medium can cut image sizes by 75+%. However the image looks about the same.

                   

                  I do feel this should be a native function without the need for a plugin, other software, export and reimport. Submitted a feature request.

                  • 6. Re: Demo file: Image downsizing during data entry
                    Malcolm

                    Changing a JPEG from High quality to Medium can cut image sizes by 75+%. However the image looks about the same.

                     

                    I do feel this should be a native function without the need for a plugin, other software, export and reimport. Submitted a feature request.

                     

                    Are you thinking of something like GetThumbnail() which was introduced in v12?

                     

                    Malcolm

                    • 7. Re: Demo file: Image downsizing during data entry
                      bigtom

                      I use GetThumbnail a lot. I will give you an example of file sizes that I deal with often.

                       

                      Images are provided as JPG 1920x1920 averaging 1MB in size and are set with high quality compression. I use GetThumbnail to store an 800x800 image externally and a 140x140 image on the layout.

                       

                      Looking at one image specifically the 800x800 size in high quality is 542KB which is much better than the original image. However, after setting the 800x800 image to medium quality compression it is reduced to 83KB which is much better.

                       

                      The 140x140 images can be at low quality since they are visually a true thumbnail. That drops to around 4KB each. They are 12KB on medium quality If we didnt do any compression changes the small 4KB files would be around 50-60KB.

                       

                      Combining the change in size with the change in compression is huge. I can scoll through find results in list view by the hundreds on an iPad over wifi with essentialy no waiting for records to load with the images. When I first started with the 50-60KB images it was clunky and not fluid. Lots of spinning wheels. The end users feel the image quality is the same as before so the user experience was not impacted on the quality side.

                       

                      Usng GetThumbnail alone just does not cut it when you are concerned about image file size.

                       

                      This is referred to as resampling the image.

                      • 8. Re: Demo file: Image downsizing during data entry
                        mardikennedy

                        <Changing a JPEG from High quality to Medium can cut image sizes by 75+%. However the image looks about the same.   I do feel this should be a native function without the need for a plugin, other software, export and reimport. Submitted a feature request.>

                         

                        It's a fantastic idea and I've reiterated that feature request.  With GetThumbnail alone, the results vary - sometimes very acceptable, sometimes a horribly noticeable deterioration in image quality.

                        • 9. Re: Demo file: Image downsizing during data entry
                          bigtom

                          On OSX I manage this with an apple shell script using a native OSX function, but it still requires export and re-import. Not cross platform.

                          • 10. Re: Demo file: Image downsizing during data entry
                            mardikennedy

                            I've tended to do it (very intermittently) via iPhoto and a series of scripts so the same export/ re-import thing.  Ikky.  And then one stumbles against the imperfect realities - file formats that don't import into iPhoto because they've been deprecated.  I've just had an abrupt learning curve re .pcts, which evolved (apparently) into pdfs.

                            • 11. Re: Demo file: Image downsizing during data entry
                              BruceHerbach

                              Stephen,

                               

                              Thanks for posting this. 

                               

                              Bruce

                              • 12. Re: Demo file: Image downsizing during data entry
                                Stephen Huston

                                Thanks for noticing!

                                 

                                I had noticed lots of people saying they wished there was a way to do this in FMP, so I built this as a demo to show at a local FMPUG meeting, then posted it here, cleverly timing it just days before 13 was released. Nobody seemed to notice or comment until months later when I started linking back to this thread to answer more of those "wish we could do this in FMPro" postings.

                                 

                                Timing is everything.

                                • 13. Re: Demo file: Image downsizing during data entry
                                  jmproulx

                                  Thank you very much. This would certainly be helpful. I will keep you informed.

                                   

                                  Regards

                                  • 14. Re: Demo file: Image downsizing during data entry
                                    bigtom

                                    Mardi,

                                     

                                    If you would like a sample of the OSX script I have been using I would be happy to pass it along to you. It is pretty fast and does not require iPhoto. It also lets you fine tune the file size via compression with a percentage 1-100 or with the preset low, normal, high and best settings.

                                     

                                    This is nice as we have a 200k image file size limit and this could be run in a loop of sorts to set the compression so every image is right under 200k for the given size. Keeping the image quality at the maximum possible. I handle the resizes in FM because it is just easier and faster.

                                    1 2 Previous Next