Filed under: iPhone
Delving into the iPhone's DCIM folder
Today, Dave Caolo discovered what happens when your iPhone camera rolls past picture number 99999 (or so). As he and other Apple users have found, a picture count that goes too high can lead to unforseen errors. Human sacrifice. Dogs and cats living together. Mass hysteria. Or a camera roll that doesn't acknowledge new photos.
Snapped images are stored on your iPhone in your home folder. As user "mobile," that home folder is /var/mobile and the folder that stores your iTunes library, your voice memos, and your photos is /var/mobile/Media. Inside that media folder is a subfolder named DCIM.
Read on for more details.Standing for digital camera images, the DCIM folder follows the Japan Electronics and Information Technology Industries Association (JEITA) naming specification for digital still cameras.
Inside /var/mobile/Media/DCIM, you typically find an image subfolders. ###APPLE (starting with 100APPLE, and going up from there) folders store pictures snapped by the iPhone camera (IMG_0001.JPG, IMG_0002.JPG, etc). Until the 3.0 firmware, the 999APPLE folder has stored shots of the iPhone screen. With 3.0 and later, those shots appear to be directed into the other APPLE folders and saved with PNG extensions. Thumbnails and other helper files appear in a sub-sub-folder called .MISC.
TUAW Tip: Press and hold the Sleep/Wake button and tap the Home key to take screenshots. The screen flashes white to let you know that the shot has been added to your DCIM folder.
There is another subfolder in the top DCIM folder called .MISC. Inside that folder, the iPhone camera application stores a couple of preview images and a property list. (See the screen shot at the top of this post.) This property list contains a counter for the last file shot. So, with the following Info.plist contents, the next photo to be snapped and stored into the 100APPLE folder will be IMG_0736.JPG.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>LastFileGroupNumber-100</key>
<integer>736</integer>
</dict>
</plist>
Each time you pass 1000 photos, a new entry is added to this property list and a new subfolder created in DCIM. After 999 groups, and I'm looking at you Dave, you run into trouble.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>LastFileGroupNumber-100</key>
<integer>999</integer>
<key>LastFileGroupNumber-101</key>
<integer>1</integer>
</dict>
</plist>
So how can you solve Dave's dilemma? Although you can use Ecamm's PhoneView to copy that Info.plist file out from the .MISC folder and edit it directly. that's probably more effort and risk than you might want to deal with. Dave's posted solution seems to do the job pretty well. And after testing other methods this morning, I'm going to endorse his solution. Editing property list files is a pretty big hammer for what can be fixed with a tiny nail.
So why did I follow up? If this post is meant to do anything, it simply explains what is going on behind the scenes. It shows you what is going on in the DCIM folder and why that folder can run into problems when your snapped photo count gets too high.
This is clearly a problem that's begging for an Apple-side firmware fix. Hopefully they'll address the problem in the next firmware update. If you have developer credentials (they are free for online membership), you can file a radar at bugreport.apple.com. Duplicate bug reports count as "votes." The more votes a bug report gets, the more likely Apple is to fix that bug. They just need to fix the rollover code to accommodate people taking thousands of pictures.


![TUAW [Cafepress]](http://www.blogsmithmedia.com/www.tuaw.com/media/tuaw-cafepress-promo.png)


Reader Comments (Page 1 of 1)
Joshua Meadows said 3:49PM on 8-26-2009
Wasn't there a similar sort of issue with text messages reaching a certain limit and causing problems? Apple fixed that one too; you'd think they'd have the foresight to speculate on this causing a problem as well.
Reply
Steven said 3:50PM on 8-26-2009
Or in this case, tens of thousands.
Reply
kinto said 1:03AM on 8-27-2009
i concur.
it's a great camera... when it works.
NutMac said 4:20PM on 8-26-2009
This is a common problem with DCIM format. Creators of DCIM assumed folks would download images to a computer before the storage is filled up with 99,999 images. On 2 MP iPhones, a typical photo is 500 KB or larger (screenshots may take much less), so one would need over 47 GB of storage to exceed the limit. So I don't see many folks running into this issue.
The whole situation could be remedied if it was easier to import and sync photos (as albums) back to iPhone. Current workflow for most Mac users involves (1) connecting the iPhone, (2) run iPhoto to import, (3) organize photos to one or more albums, (4) run iTunes, (5) select the albums you wish to sync back, and (6) sync.
Reply
NutMac said 4:24PM on 8-26-2009
Oh oops, I didn't read the post correctly. iPhone does not rollback to 000APPLE. My bad. Nevermind.
tony d said 4:49PM on 8-26-2009
OK, at the risk of confusing this issue I've got a question. So when we sync and upload photos to iPhoto and choose to delete the photos on the iPhone (when iPhoto asks) that the camera app doesn't reset itself? Or does this only happen when you leave the photos on the phone? I'm asking because my Nikon does reset itself, so this just sounds like a weird bug. Otherwise if the pictures are still on the phone it would be behaving normally, no?
Reply
Robert said 5:30PM on 8-26-2009
Is there a way to get at this via the finder or does PhoneView communicate with the phone over USB?
Reply
kinto said 12:37AM on 8-27-2009
phoneview works via usb
Will Maitner said 6:41PM on 8-26-2009
Why is there no way to create photo folders on the phone to address this issue. I hate that you can't move pics around inside camera roll. Stupid oversight on Apple's part.
Reply
John.B said 8:29PM on 8-26-2009
Because Apple (and pretty much every other camera mfgr today) leverages the DCIM standards on the camera side (for compatibility's sake). And FTA, that was never intended to do anything but temporarily hold image files until they could be transferred to a computer. http://en.wikipedia.org/wiki/DCIM
Will Maitner said 10:41PM on 8-26-2009
And yet you can create folders in iPhoto and transfer them back to the phone. They need to change the picture app to allow you to do this on the phone. Maybe even add some minor editing abilities, iPhoto lite maybe?
Reply
kinto said 12:51AM on 8-27-2009
thanks for calling more attention to this erica. it's SUPER annoying and because i take A LOT of pix i've had to deal with this issue around 5 times since i got my 3GS like 2 months ago. i've sent bug reports to apple and posted in various forums so hopefully they fix this soon because i'm to the point that half the time i don't even trust that my iphone camera will actually work.
(and fortunately phoneview was part of the last macheist bundle... i never figured i'd even use it until the camera roll problem arose...)
Reply
kinto said 12:57AM on 8-27-2009
oop sorry! and thanks to dave too =)
NetMage said 9:48AM on 8-27-2009
You can use iPhoneBrowser on Windows.
Reply