Blog  |  Support  |  Forums
 

Exporting photos from Bento

I received permission to post a tutorial written by Giacomo Vernoni (a recent Bento user who has converted to Tap Forms) from http://www.vecchicomputer.com

This tutorial is very technical, so if you're comfortable with Terminal and downloading plugins for Firefox, then you should be ok with this tutorial. Giacomo has written a script which will convert the Bento images into an image file that you can bring into Tap Forms. The script is linked to below that you can download.

Also, since it's a very technical tutorial, if you choose to follow it, I cannot be held responsible for any loss of data that you may incur. Pay close attention to Step 1 which describes how to make a backup of your database in Bento since you'll want to work on your backup copy, NOT on your original copy.

Thanks!

Brendan

Tutorial - How to export Bento images and import them into Tap Forms

One of the limits of Bento is that it can't export the images embedded in its media fields. Even FileMaker can't import Bento media fields. This tutorial shows you how to do it, and how to import all your records - including images - in Tap Forms.

If you have a dozen records, stop reading and do it manually: it will be faster. But if you have hundreds of records and every record has one or more image, following this half hour tutorial will save you days of tedious work.

Requirements
Bento for Mac
Mozilla Firefox [http://www.mozilla.org/en-US/firefox/new/]
Bare Bones Software TextWrangler [http://www.barebones.com/products/textwrangler/]

The only commercial application that you need is Bento for Mac. So, let's get started!

Before you start
This tutorial assumes that all or most of your images are in the same format (for example jpeg or png). If you took pictures with your iPhone or iPad, they should be JPEGs. If you imported pictures on the Mac version, you should know what you imported :-)

Step 1: Backup your Bento database
Open Bento for Mac, and if you use Bento for iPhone or iPad, sync your data so that you have the most recent data on your Mac. From the File menu choose "Back Up Bento Data..." and save it wherever you like so you work on a copy of the database without risk of screwing up the db.

Step 2: Export a .csv file with image information
You can export to a .csv file in Bento, but image data (the image itself and a reference to its file name) will be missing, so we have to do this manually.

Download the latest version of Mozilla Firefox, then from the Tools menu select "Add-ons". Search for "SQLite Manager" and install it; you must restart Firefox to use it.
Now the Tools menu has a new item, "SQLite Manager": select it to launch the Firefox extension.

From the Database menu in the FireFox window select "Connect Database" - or click the corresponding icon on the toolbar. Select "All Files" from the Format pull-down menu, and then navigate to the Bento backup file you saved a few minutes ago.
You'll see that the file is a package, a folder that contains other folders; navigate to
Bento Backup [date].bentodb › Contents › Resources and choose the obvious file named "Database" :-)

There are many tables in the database, you must now find the table you want to export. A table represents a Bento Library. If the first name you gave to your Bento Library was "My Movies" then the table will mostly be named "gn_lib_my_movies". Click it.

Now we have to get rid of a lot of Bento data that we don't need or we can't use. For example, Bento saves how much you zoomed a picture and the coordinates of the picture in the media field.
Right click on all the following fields and select "Drop column" (you have to confirm twice, ignore the warning because you are working on a copy of the database):

gn_gnRecordOrder
gn_gnDateCreated (optional if this information is useful to you)
gn_idGnField
gnent
gnpk
gnopt
gn_table
gn_DateModified (optional)
gnguid
gn_[name of the image field]GnFieldpanOffset
gn_[name of the image field]GnFieldzoomFactor

What remains is all your personal data, including a reference to the image file.

Now click on the "Export" button: you will reach the "Export Wizard" section. check the "First row contains column names" checkbox and leave the rest unchanged. Click OK and save the csv file.

If you want to take a peek at your data, click the "Browse & Search" tab. You will see that the content of your image fields is something like "bento://asset/22C0C417-6ED5-4E56-A60E-0A5623CA1FED". This is a reference to a folder in the "Assets" folder of the Bento package. That folder contains one (and only one) image that can have different names.

Step 3: edit the csv file
This is quick. Download TextWrangler from the Mac App Store or from the link above.

Open the csv file with TextWrangler, and from the Search menu select "Find". A window will show up. Check "Grep" on the lower part and copy and paste this string in the "Find" text box (including the quotes):

"bento://asset/([A-F0-9-]*)"

then copy and paste this string in the "Replace" text box (including the quotes):

"\1\.jpg" (if most of the images are in JPEG format)

or

"\1\.png" (if most of the images are in PNG format)

Now hit "Replace All".

After that, our example

"bento://asset/22C0C417-6ED5-4E56-A60E-0A5623CA1FED"

should have turned into

"22C0C417-6ED5-4E56-A60E-0A5623CA1FED.jpg"

Save the csv file.

Step 4: launch the script
Go to the Finder and navigate to your .bentodb backup file. Right click on it and choose "Show Package Contents". Navigate to Contents › Resources.

Download this script:

https://www.tapforms.com/code/bntfolderstofiles.zip

Unzip it then copy it into the Resources folder.

If you want to check that it doesn't erase your hard disk or sends spam to all your contacts, open it with TextWrangler :-)

Take a look at the Assets folder: the images of all your Bento Libraries are stored there, one in each folder.

Open Applications › Utilities › Terminal, then type "cd" without the quotes, add a space, and then drag the Resources folder in the terminal window. You should see something like:

cd /Users/john/Documents/Bento\ Backup\ -\ 2013-08-05.bentodb/Contents/Resources

Hit return.

Now type

./bntfolderstofiles

and hit return.

You should see a list running on the screen; the name on the left is the original name, the one on the right is the new name that matches the one in the csv file.

Step 5 (optional): JPEGs and PNGs
If most of your images are in JPEG format, go to the Finder and look at the "new" Assets folder. Now all the images are there. Search ".png" in the search field, so you can check if there are some PNG images.

Copy the name, and in TextWrangler search for it (uncheck "grep"). Manually change the extension from "jpg" to "png.

Do the opposite if most of your images are PNGs and you find a few JPEGs.

If you don't find any match, most probably the image belongs to another Bento Library. More on this in the next step.

Step 6: import the form in Tap Forms
Let's go back to our csv file in TextWrangler. The first row should contain the field names, separated by commas.

You should rename every field with a better name, e.g. from "gn_titleGnField" to Movie Title, and then add the field tag after the name: <text>, <number>, <note>, <photo>, <check_mark>, <rating> are the most common.

As an example, your first row should look like:

Movie Title<text>,Year<number>,My rating<rating>,Poster<photo>,DVD<check_mark>,Blu-Ray<check_mark>

Save the csv file, and use it to import your Bento Library into Tap Forms.

Now you need to import the images: the procedure differs for the iPhone/iPad and the Mac version.

To import your images in the mobile version, open Tap Forms on your device, start the FTP server, and copy all your images to the Photos folder. I recommend using Cyberduck, which you can download from http://cyberduck.ch. Use anonymous login and make sure you enter 8080 into the port number field and just the IP address into the Server address. Tap Forms will display the IP address and port number for you on the Files screen once you've started the built-in FTP server.

To import your images in Tap Forms for Mac:

copy all your images into this folder if you're NOT using iCloud sync:

~/Library/Containers/com.tapforms.mac/Data/Documents/Photos

or copy all your images into this folder if you have iCloud Sync enabled in Tap Forms:

~/Library/Mobile Documents/FXLPHZS84D~com~clickspace~tapforms/Documents/Photos

Remember that the "~" symbol is a shortcut for your home folder (e.g. /Users/john).

If you don't see the Library folder in your user home, go to the Finder and select the menu item "Go › Go to Folder..." and paste the above path.

Please note that the files you copy into the Tap Forms folder are the images of all your Libraries, not just the Library (or table: the csv file) you just imported.

This implies that if you import another Bento Library, you can skip step 4.

Done!
If you browse through your records in Tap Forms, now you should see all your images.

Bento is a trademark of FileMaker, Inc

28 Responses to “Exporting photos from Bento”

  1. Andy Forrest says:

    This all worked fine for me until the last point (to import images into Tap for Mac) where it says ‘copy all your images…’.

    In the Bento Assets folder I have thousands of thumbnails – most of which I don’t want (the originals plus various different zooms from ALL my libraries). How do I get just the pictures I currently use in a particular library in Bento?

  2. Kristin Moehring says:

    The .jpg and .png files came over to the Assests folder from the individual folders but the .gif and .tiff files did not. Is there a way to also rename and move these over to the assets folder?

    • domellen says:

      I also had some gif and tif files. I just edited the script line 75

      if (substr($fileName, 0, 1) “.” and ($ext == “jpg” | $ext == “png”))

      to add the relevant extensions. In your case:

      if (substr($fileName, 0, 1) “.” and ($ext == “jpg” | $ext == “png” | $ext == “tiff” | $ext == “gif”))

      You can add any other extensions you need and then run the script again.

      A tip: Once all the files were in the same folder and all the subfolders deleted I also batch converted all my images to small, optimized jpgs before sending them to iCloud, reducing the transfer time and the place they take up. Total size went from 165 MB in the exported Bento assets folder to 19 MB now.

      • Kristin Moehring says:

        Thanks domellen. How did you “batch” convert the images?

        • domellen says:

          I suppose there are many ways to do this.

          I used Picturesque from Acqualia (costs $5) which I purchased long ago and use regularly for other things, and ImageOptim which is free.

          Once all the images renamed with the script and placed in one single folder, I just selected the images and dropped them in Picturesque, batch saved them in jpeg format at about 40% quality and resized them to fit 500 px * 500 px. It’s very easy to understand how it works. I fixed my images in batches of about 50, but I think you can do more.

          You can either save them to the same folder or to a different one. The main thing is to be able to get rid of the first version of the images and keep only the new ones.

          Once Picturesque was done, and the folder contained only my new small images, I selected them all and dropped them all at once on ImageOptim to save a few more kB.

          That’s it.

          Disclaimer: I am not affiliated in any way with Acqualia. Just a satisfied customer.

  3. domellen says:

    This tutorial was a great timesaver. Everything worked fine. I got all my Bento stuff into Tap Forms on Mac and the images to iCloud as described above. When I was satisfied I made a backup and then transfered the sqlite database from the backup to my iPads and iPhone using iTunes. I activated iCloud sync on the devices and the images all appeared everywhere. Many thanks to Giacomo Vernoni.

    P.S. I had 4 librairies in Bento (that’s 4 forms in Tap Forms) with more than 5000 records total, and about 700 images.

  4. Kristin Moehring says:

    Once you have the csv image reference field matching the photo names how do you get Tap Form to know that this is a reference to an external image file and show the image. What type of field on the import do you have to select?

  5. Michael says:

    I tried this 4 separate times and no matter what I try I can’t get Tap Forms to see the pictures I’ve transferred. I followed the tutorial EXACTLY, the field for the pictures transfers just fine, but none of the pictures show up. They’re all in the folder

    ~/Library/Containers/com.tapforms.mac/Data/Documents/Photos/

    because I’m not using iCloud, and the script named them correctly, but there are still no pictures. Can someone please help? I’d really hate to have to rescan 500+ pictures.

    • Brendan says:

      For the benefit of others seeing this blog message, the issue I discovered was the file names on disk had a .jpeg file extension but the file name in the CSV import file had a .jpg extension. They have to match or Tap Forms won’t be able to find the file. As soon as I renamed the files to match the CSV file, the photos showed up in the records.

      Thanks!

      Brendan

  6. Brendan says:

    You need to make sure that you have Photo selected (or you use the tag in your CSV file header row). Did you do that before the import?

  7. J.C. says:

    this was very helpful to me. i was using bento 1.0v2 with leopard. it doesn’t work with mavericks. neither does 2 or 4 (i tried). fortunately i made periodic backups. i was able to use this information to view and export my data to .csv, not just for tap forms, but because it can be imported into other software. thank you for posting this, and for making a better alternative than idatabase.

  8. T.M. says:

    Brendan,

    I’m using Bento, v.1 on my MacBook Pro, v. 10.8.5 and would like to upgrade to Mavericks now that most of the bugs have been fixed.

    I understand Bento will continue to work on Mavericks, but sooner or later, I’ll need to switch to another product.

    Can I export some 5,000 files, data, JPEG’s and PDF’s intact?

    If so, can it be done simply (the above procedures would make me nuts)?

    Many thanks and congrats on creating a product that people use and like!

  9. Brendan says:

    Hi T.M.

    You’ll need to upgrade to Bento 4.1.2 in order to accomplish a successful import of all your data into Tap Forms.

    You can download the update from here:

    http://help.filemaker.com/app/answers/detail/a_id/11182

    I’m pretty sure you’ll get a 30 day trial from that download link.

    Thanks,

    Brendan

  10. Ron says:

    didn’t work. I have two libraries where the images weren’t pasted into the record, but rather the path to the image. Is there something that can be done with those?

  11. Brendan says:

    Hi Ron,

    What is the field type you used for those URLs? Tap Forms does not import photos that are just URLs. The image must be visible in your template and must be a Media type in order for it to be imported into Tap Forms.

    Thanks,

    Brendan

  12. Ron says:

    Bento had to options to add images to a record, the field created is the same for both options. The first option was to select the image and paste it into the records, the second was to select the image and paste the path into the record. The path was on the same hard drive not URLs. I followed your instructions to step three. Textwrangler couldn’t find any records to change. On another note, In step two I found all of the fields except for gn_idGnField. Not sure if that is related to my problem in step 3?

  13. Ron says:

    Now that’s better. I am working on the demo so I assume that there is a limit on the number of records that will be imported with the template. If that is the case and all of the records get imported, think we have a purchase to make here.

    Sorry for the confusion. In Bento, when you drag and drop an image into a media field, there are the two options, a simple drag and drop will put a copy of the image into the media field and that image will be part of the record. if, when you are dragging the image, you hold down the options key, and then drop, what is happening is that you are linking the image on your hard drive to that record. You want to use the second option if you are using the same image for multiple records. That way the overall size of the library is not bloated.

    • Brendan says:

      Hi Ron,

      Oh, I see. I didn’t know about that option-drag thing.

      So when you export your template and you’ve linked to files instead of copied them in, doesn’t Bento make a copy of the photo image file and store it inside the template? Or does it still link to the file externally?

      There is a 15 record limit of the demo version. The full version will import every record.

      Thanks!

      Brendan

  14. Ron says:

    it only stores the link. If you move the image to a different folder. The image won’t be displayed any longer, so you have to be careful

    • Brendan says:

      It’d be nice if during the template export function that it would “collect” all the assets and put them in the template for you. So if you were to share that template with someone else then they would not get the images?

Leave a reply

You must be logged in to post a comment.

 
Apple, the Apple logo, iPad, iPhone, and iPod touch are trademarks of Apple Inc., registered in the U.S. and other countries. App Store is a service mark of Apple Inc.