Jump to content

GetThumbnail Increasing Jpg File Size


This topic is 2577 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I've been doing some work with the GetThumbnail function in FileMaker recently and I've found that GetThumbnail often creates files larger than the original, even though their pixel dimensions and dpi are lower.

 

For Example, My original file has the following spec:

  • 300dpi
  • 1000 x 1000 pixels
  • 76,490 bytes

Using GetThumbnail ( Image; 750; 750 ) gives me an image that is

  • 72dpi
  • 750 x 750 pixels
  • 85,579 bytes

So, a file that is a little over half the pixel area and less than a third of the dpi is over 10% larger than the original file.

 

That's not very good, is it?

 

Anyone care to suggest an explanation for this? Could it be because FileMaker is decompressing the image to process it and then re-compressing it really badly?

Link to comment
Share on other sites

This topic is 2577 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Similar Content

    • By folks
      I wonder if the storage for the images remains at the size of the original image taken by the iPad camera
      in spite of the replacement of that image by a much smaller thumbnail.  
       
      From the isolated tests below ( with attached example db )
      it looks like some of the storage in FMGo14 is recovered but not all, double what it should be.
      Also the overhead per container record appears to grow in a non linear manner on both FM OS X and FMGo14.
      Adding photos directly in FM on OS X appears to recover much of the storage that was not recovered in FMGo14.
      Unfortunately, only when another photo is added.  In my solutions all photos are added in FMGo14 so storage
      size grows quite rapidly  :  (
       
      The thumbnails are typically smaller than 1.1MB while the storage consumed for each image within
      the database appears to be average to 3.67 MB
       
      If this theory holds water how to I get the extra storage back as this is causing some real problems
      with sync times.
       
      calculation for container field
       
      // If the content of the container is an image shrink without distortion so max dimension is 1920
      // if it is not an image then return self. This would apply to audio, files and music
      // if image has a largest dimension that is less than 1920 then just use image do not attempt to enlarge image.
       
      If ( PatternCount  ( GetContainerAttribute ( Media;"filename" ) ; ".jpg" )  or
          PatternCount  ( GetContainerAttribute ( Media;"filename" ) ; ".png" )  or
          PatternCount  ( GetContainerAttribute ( Media;"filename" ) ; ".bmp" ) or
          PatternCount  ( GetContainerAttribute ( Media;"filename" ) ; ".gif" )    or
          PatternCount  ( GetContainerAttribute ( Media;"filename" ) ; ".tif" )
            ;
                  GetThumbnail (
                                          Self ;
                                          If ( GetWidth ( Self ) <  1920 ; GetWidth ( Self ) ; 1920 ) ;
                                          If ( GetHeight ( Self ) <  1920 ; GetHeight ( Self ) ; 1920 )
                                        ) ;
                    Self
          )
       
      Isolated Tests
       
      Created ContainerPhotoTest filemaker db with a single table and single field Media with
      GetThumbnail calculated result
       
      Move to iPhone 5s FMGo14 take photo
       
      ContainerPhotoTest  197 k with no photo
      ContainerPhotoTest  1.7MB with single photo
       
      Export Photo to desktop from Container
      Photo Size 467 KB
       
      But the database storage size has increased by 1.699 MB
       
      Add 8.6MB .jpg from the desktop in a second record
       
      ContainerPhotoTest  1.3 MB in size
      Drag photo to desktop from container
      Photo Size 623 KB
       
      ( 197 k + 467 k + 623 k ) = 1287 k 
      1,300 k - 1287 k = 13 k extra space used.
       
      What is happening here.
      So it looks like it works fine on OS X but perhaps not on iOS
       
      Try again with iPad Air 2 iOS
        • ContainerPhotoTest  1.3 MB in size
        • Take photo from FMGo14 Container
        • Take similar photo on iPad camera app
        • Photo Size 2.6 MB
        • ContainerPhotoTest 2.1MB in size
        • photo 800 k size increase
        • Photo size 467 k
        • Close and reopen FMGo14
        • ContainerPhotoTest 2.1MB in size
       
      So it seems that in iOS some space is recovered on the photo re-size but not all.
       
      Final Test on OS X
        • Create new record and.
        • ContainerPhotoTest 2.1MB in size
        • drop similar photo 2.2 MB into container from desktop
        • ContainerPhotoTest still 2.1MB in size, no increase in size...
        • Quit and re open database
        • ContainerPhotoTest still 2.1MB in size
        • drag new photo to desktop 467k
       
      ( 197 k + 467 k + 623 k + 467 k ) = 1754 k
      2,100 k - 1754 k =  345 k extra space used
       
      So it looks like something different is happening on OS X and FMGo
      I need to gather data including photos on FMGo and in practice as noted
      in the initial description of the production solution where no photos are added in OS X file size grows
      quite quickly.  
      ContainerPhotoTest.fmp12
    • By beckham
      Hi
      Can anyone please advise on my following issue.
      I have a FM12 file with Container Fields that contain small jpegs, I want to have a text field that shows the title of the image inserted BUT without the .jpg at the end?
       
      To explain, If i drag an image named "picture1" and place it in a <<container_name>>
      the result is <<picture1.jpg>> how do i prevent the .jpg displaying? I just want <<picture1>>
       
      Many thanks
    • By Lisas4
      Hi, I imported an Image from my server into webviewer via this.:
       
      "data:text/html,
      <html>
      <head><img src='" & "http://www.LisaPrice.info/fahrtenbuch/images/" & Buggy Fahrtenbuch::fileversion & "/eingabelocked2.jpg" & "' style='width:100%; height:100%;' /></head>
      <body style='border: 0; margin: 0'>
      </body>
      </html>"
       
       
      The Result is an image without any borders. Works perfect.
       
      When I import the image as an html, I keep getting a wireframe, and it seems this wireframe is generated by webviewer. Can anybody help me.
       
      My html file behind the Url: "http://www.LisaPrice.info/fahrtenbuch/images/" & Buggy Fahrtenbuch::fileversion & "/eingabelocked2.htm"
      is
      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <html xmlns="http://www.w3.org/1999/xhtml">

      <head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8" cellspacing="0" cellpadding="0" border="0"/>
      <title>Untitled 1</title>
          <style type="text/css">
          <!--
          body {
           margin-top: 0px;
           margin-right: 0px;
           margin-bottom: 0px;
           margin-left: 0px;
           cellspacing: 0px;
           cellpadding:0px;
           border:0px
          }
          -->
          </style>

      </head>

      <body>

      <img src="welcome2.jpg" width="332" height="216" cellspacing="0" cellpadding="0" border="0"
      />

      </body>

      </html>
       
      my
      content in the settings of the webviewer
      is:

      SuperContainer_noBorder ("http://www.LisaPrice.info/fahrtenbuch/images/" & Buggy Fahrtenbuch::fileversion & "/eingabelocked295.htm")
       
      And my function "SuperContainer_noBorder"
      is:
       
      "data:text/html,<html>¶
      <head>
      <style>

      html, body {
      height: 100%;
      width: 100%;
      overflow:hidden;
      }

      body
      {
      margin  : 0px 0px 0px 0px;
      border :0px;
      }

      table
      {
      border-collapse: collapse;
      width : 100%;
      height : 100%;
      overflow:hidden;
      }

      td {" &
      "text-align : left;" &
      "vertical-align : top;" &
      "font-family : "Arial";
      font-size : 75%;
      font-smooth : always;
      }
      </style>
      </head>
      <body>¶
      <table><tr><td>¶"
      &  
      "
      <iframe src=" & link &" frameborder="0" width="100%" height="100%"
       frameborder='0' scrolling='no' marginheight='0' marginwidth='0'>
      <p>Your browser does not support iframes.</p>
      </iframe>
      "
       &
      "</td></tr></table>¶
      </body>¶
      </html>"
       
      I believe somwhere in the function, the wireframe is generated or not eliminated, but I canot find where.
      Can anybody help me please?
       
      On the attached file, the two images on the right are imported as jpg vie the first code in webviewer. Everything works fine, no frame .
      The left blue window, just blue is a jpg imported as html vie the other codes and steps. And the frame is clearly visible.
       
      Regards
       
      Lisa

    • By Charlie Cheney
      Hi, I have a container field that I've pasted a FileMaker 11 chart into. I now want to upload that as a .jpg file to my web host using a few other fields as variables to name the file and point it to the proper directory. When I attempt to do this it uploads a file to the proper directory with the proper name but the file is 0 kb in size.

      What have I done wrong? I can export the field as a jpg using FileMaker's "Export Field Contents" step. Am I missing some sort of conversion step to actually convert it into a .jpg file? Thanks for any help you can provide. -Charlie

      Screen Shot attached...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.