Posted 2007/04/29 09:51:36.
A lightweight cross platform replacement for Photo Studio.
In the last few months I've pretty much moved away from using Windows altogether, having developed a real liking for all things Mac and Unix. However the one thing I really miss about Windows is good old Photo Studio - sure it was clunky, buggy, and had a user interface very much stuck in the last century, but it did exactly what I wanted it to, in (more or less) exactly the way I wanted it to do it. That is, the job of getting pictures from my digital camera into a form where I could upload them to the web. I've tried several other applications on the Mac but none quite work in the way I want them to, so eventually I decided it was time to bring Photo Studio to OS X. Or at least write a new app that does something roughly similar. So there's two things I want to achieve:
First of all it has to be simple. I just don't have the hundreds of man hours to pour into a piece of software that I had back in the days when I was writing Photo Studio. Moreover I also felt Photo Studio had a UI that was in places far too over complicated - most of the time even I only used about 5% of it.
Secondly, I want something cross platform. I want something that runs on the Mac now, but should my dalliance with OS X not turn out to be a permanent thing, I want something I can also run on Windows.
So in the occasional bits of spare time I've had here and there over the past few months I've been working on a simple cross platform replaccement for Photo Studio, written using wxWidgets. It's not quite ready to release anything, but I can at least unveil the first screenshot. It isn't particularly earth-shattering, but I feel quietly proud of it nonetheless.
Currently it lets you view a directory of images as thumbnails, and as you step through it shows the currently focused image in full on the right hand side of the main window. In addition it'll display comments as you go, and let you edit them. Finally, although it's probably not apparent from the screenshot, it lets you do lossless rotation of your images.
The latter bit is the feature I'm most pleased with right now - while rotation for the main image is handled by the excellent libjpeg there's always the thorny issue of what do with the embedded thumbnail images in the EXIF data (which your digital camera writes in for fast previewing on the camera).
Given that Cheese also uses the embedded thumbnail to quickly browse a directory of images, it would quickly get frustrating if the main image had been rotated but the thumbnail had not. Unfortunately the format of the EXIF data in which the thumbnail is contained is not all that straightforward - effectively a TIFF file with a spaghetti of references from one place to another. If in the process of rotating the embedded thumbnail the image data changes size (which given the way JPEGs work is often the case) then you'd potentially end up overwriting other bits of the EXIF data, which could make all your precious camera settings (and whatever other meta data is in there) unreadable.
In Photo Studio I had spent ages writing some fairly complex code to allow restructuring of the EXIF data, to let you change the size of components (such as thumbnails) therein. It was never quite perfect though - each manufacturer would typically write their own block of camera specific data as part of the EXIF header, and the format of this varied. Again, because of the use of references, trying to move this data around without fully understanding it would generally lead to corrupt files. Whilst I was able to get sample images for most of the major manufacturers, there was always the chance that some minor manufactuer might do things differently, or even that a major manufacturer might change their format. The EXIF standard recommends that EXIF data be effectively treated as read-only for this reason.
So in Cheese I set out to have the embedded thumbnail file rotated, but kept at the same point in the EXIF data and with the same size. The solution to this is a bit hacky, but I think it is probably the safest possible approach.
First, Cheese decodes the thumbnail to a bitmap and rotates it lossily - generally speaking preserving the quality of a thumbnail doesn't matter that much, as it is only there for previewing, and could always be regenerated from the main image if necessary.
Next - and here's the cunning bit - it takes advantage of the JPEG quality setting and some intelligent trial and error. Libjpeg lets you specify a quality for the JPEGs you are saving, on a scale of 0 to 100. Zero is the poorest quality (and therefore smallest file), and correspondingly 100 gives the best quality (but the largest file size). There isn't, however, a function to tell you what the file size is going to be based on the quality setting, or indeed a function which lets you set the quality based on an intended file size. So I wrote it - it's our old friend the binary search. It basically saves the JPEG file in memory several times until it determines the quality setting which gives us the output file size closest to the original. Whilst this might sound a bit inefficient, thumbnails are by definition small files (typically 160x120) so saving them is a relatively inexpensive operation. Plus the laws of binary search mean that generally speaking we shouldn't have to make more than log to the base 2 of 100 attempts - which comes at out 7.
The above technique isn't likely to get an exact match - so what we actually aim for is the highest quality that will deliver a file smaller than the target size. Then the final bit of trickery is to use the JPEG comment field to pad the file out to exactly the size we want - given that the comment is part of the JPEG standard, any compliant reader should be able to skip over it harmlessly.
All that remains now to cover the basic functionality is generation of HTML pages, so with any luck version 1.0 ought to be ready for release within a few weeks.
As someone who is restricted in programming to something like 10 PRINT "HELLO"
20 GOTO 10
(well, almost!!!) this is all way over my head, but it is fascinating when you think just how much work, knowledge and thought goes into programs which we all use without a second thought. I think Photo Studio is a great program, it has certainly saved me a lot of time in picture processing for my "family and friends" online photo journal, and I am looking forward to seeing more of Cheese, John!
Posted by Bryan at 2007/04/30 00:04:03.
Good man! I'll go and download a copy now...
Posted by tom at 2007/07/17 13:54:18.
I chanced upon your site after some Googling on EXIF. I'm a Linux user and am glad you're now on the Unix side of things. Thanks very much for taking the time to explain the challenges you are presented with and your approach to coming up with solutions. It was an interesting read.
Posted by Paul at 2007/07/28 05:28:52.
Posted by AnferTuto at 2007/08/03 16:18:44.
not exactly what I'm looking for (rather need a php based one for playing with it) - however, thanks a million for taking time and explaining about the Exif/Thumbs issue. cheers !
Posted by lorenzo at 2007/08/28 00:31:24.
That's a rather neat solution, well done!
Posted by steve at 2007/11/27 11:04:03.
Do comments still work?
Posted by John at 2008/07/22 17:58:06.
good site dude
Posted by Mzvwibzn at 2008/08/01 01:13:15.
Cool site, http://www.google.ca/notebook/public/03726963131370744363/BDQVnSwoQp6KN1Lcj lesbian pics
Posted by Onexbvsd at 2008/08/02 12:05:08.
Posted by uUPonHGimCZjMS at 2008/08/03 12:17:08.
Candidates Promise National-Service Initiatives washingtonpost.com/wp-dyn/content/article/2008/09/11/AR2008091103788.html
Posted by mona at 2008/09/12 15:38:10.
Has Obama Underestimated McCain? voices.washingtonpost.com/the-trail/2008/09/11/misunderestimating_mccain.html
Posted by lola at 2008/09/12 20:29:59.
great site thanks http://allfullsoftgoogle.com see u
Posted by bobby at 2008/09/24 01:25:41.
Posted by name at 2008/11/20 00:36:05.
Posted by name at 2008/11/20 11:03:07.
Posted by name at 2008/11/20 13:24:01.
Posted by name at 2008/11/20 20:01:05.
Posted by name at 2008/11/20 23:41:17.
Posted by name at 2008/11/21 01:28:38.
Hello, thx for all,
Posted by Unwulxxj at 2008/12/26 23:51:33.
My site is great,
Posted by Srcoudvv at 2008/12/27 04:05:12.
My site is great, http://www.kaboodle.com/tube8 tube8 sign up, avywgm,
Posted by Kmcssecs at 2009/01/02 19:29:47.
Posted by Uctmnysn at 2009/01/03 16:15:36.
Hello, thx for all,
Posted by name at 2009/01/03 16:34:58.
Posted by name at 2009/01/03 20:08:24.
Posted by name at 2009/01/05 13:32:43.
Posted by micronion at 2009/01/12 00:35:49.
Posted by selioneer at 2009/01/12 06:20:46.
Posted by xZAVsXFSn at 2009/02/04 07:26:45.
I want to say - thank you for this!
Posted by mark at 2009/04/11 13:26:28.
Very interesting site, Hope it will always be alive!
Posted by mark at 2009/04/11 16:40:07.
It is the coolest site,keep so!
Posted by mark at 2009/04/11 19:16:42.
Posted by fabrika at 2009/09/14 17:09:29.
Posted by kinozalvip at 2009/09/28 09:00:58.
Posted by Taaxnstz at 2009/11/06 03:48:03.
Posted by Ncwdfyzd at 2009/11/06 13:58:19.
Posted by Vlnjtmvl at 2009/11/06 19:05:15.
Posted by Xrnuzeyt at 2009/11/07 04:57:31.
Posted by GSkioLxkLmfCaIa at 2009/11/18 10:45:26.
Posted by * * * * * * * Kayden Kross at 2010/12/17 22:30:46.
buy sky women's fashion http://designersclothings.eu/buy/Dsquared/T-shirts fashion of the 20s 149963
Posted by SeteDopeOptog at 2011/06/22 06:53:49.
Posted by soundtracks at 2011/08/04 06:51:24.
Posted by soundtracks at 2011/08/04 06:51:26.
Posted by soundtracks at 2011/08/04 06:51:28.
Posted by soundtracks at 2011/08/04 06:51:30.
Posted by soundtracks at 2011/08/04 06:51:32.
Магазин обуви: обувь женская батильоны Liska (Лиска), женская обувь пакерсон Liska (Лиска), женская обувь fabiani Liska (Лиска), донецк женская обувь Liska (Лиска), женская обувь на реализацию Liska (Лиска).
Posted by lerafuxsi at 2012/01/18 10:12:50.
to remove EXIF Data By Nasim Mansurov Now that I elepainxd you what EXIF Data is and showed you how you can view EXIF on JPEG files, I will now show you how to remove EXIF Data
Posted by Monie at 2012/09/03 21:30:52.