Fat Cat Software

How to create a fake digital camera for Image Capture

I've been fooling around with some Image Capture APIs lately, but the only convenient camera device I have to work with is my iPhone, which doesn't really have any way to put specific images onto it if I want to test things out like different formats, movies, etc. After digging around with the Image Capture SDK a bit, though, I've found a simple way to make a fake "camera" that Image Capture will recognize, but doesn't require plugging in a physical device.The trick is to create a disk image that, when mounted, Image Capture believes to be a digital memory card, and treats as a digital camera, so it shows up in iPhoto, Image Capture.app, and so forth. There appear to be a bunch of different ways to do this, but here's the method I used that worked for me:Open Disk Utility and click the "New Image" button in the toolbar. In the configuration sheet, choose "MS-DOS (FAT)" for the Volume Format, and "Single Partition - Master Boot Record Partition Map" for the Partitions setting. You can enter whatever name and volume size you like, then click "Create".Once the image is created and mounted, open it up in the Finder. Create a new folder at the root level of the mounted disk image and name it "CAMERA". Then, go ahead and copy whatever pictures or other items you want to test with inside the CAMERA folder. This appears to be one particular camera's way of storing photos on its memory card - there are a whole bunch of others ("DCIM", "Photos", "Videos", etc.) that would work equally well.Click the eject button in the Finder, then double click the image file to mount the image again. If everything is set up correctly, the act of mounting the image should cause Image Capture to fire up whatever application you have set to handle your digital cameras (e.g. iPhoto), and the images you put in the CAMERA folder should appear in the list of photos for the device.Not only does this save having to plug and unplug a device whenever you're doing testing with Image Capture, but it's also really nice for test suites, since you can just include the disk image as data for your tests, and then mount the image to simulate plugging in a camera.