Sunday, 7 October 2007

Convert4Frame

Although I was probably the last person I know to move from film to digital photography I have now fully embraced the new format. In fact I haven't really used my film camera at all since I bought my first digital camera.

The one downside to a digital camera is that I print far fewer photos than before and so the photos I take tend to sit neglected on my computer. To try and solve this problem and to allow me to appreciate the photos I have been taking I went and bought a digital photo frame. Not knowing how much I would use it I opted for the cheapest one Amazon had to offer at the time and ended up with a 7" frame from ATMT (model number 7TFTDPF). For the price I paid it is an excellent frame and has been great for showing off the photos I take.

The only problem with the frame is converting the photos to fit the screen size. The frame is widescreen and requires the photos to be both cropped and resized before it will show them correctly and make full use of the visible area of the frame. Now you can do the resizing and cropping in any image editor but it becomes tedious if you want to convert a number of photos at once.

So given that I'm a software engineer I set about solving the problem by developing a small program to do the tedious work for me! The result was the aptly titled Convert4Frame application. In essence this application allows you to easily define the part of a photo you wish to display in the frame and then resizes and crops the original for you. To use the application simply it direct from this page.

Currently it is designed to work with the 7" frames from ATMT, but it should correctly resize your photos for any digital frame with a native resolution of 480x342 (or any multiple of). Let me know in the comments if it works with your frame, or if you have a frame which requires different resizing/cropping let me know the details and I'll add support for it.

Update (06/02/2010): I've moved the code into a publicly accessiable SVN repository, see here for details.

Update (30/12/2007): I've made a number of small changes which should deal with the few cases in which the image wasn't correctly filling the display area (basically the image is now scaled down to the frame size).
24 October 2007 at 16:56 , Barry said...

This is one of those rare occasions where you log on to Google and find an answer to a question I haven't actually asked yet ...

I've just won one of these ATMT picture frames in a charity auction, and now that I've seen their price on Amazon I'm feeling more than a little guilty about what I paid.

Anyway, all I actually wanted to know was why on earth this infuriating little device doesn't assume square pixels - unless you put it into 4:3 mode, in which case it doesn't use the entire screen - given that it's intended primarily for displaying images from digital cameras, which generally do have square pixels.

I'm not expecting you to have an answer by the way, I just wanted to show a little empathy and express a little gratitude ... :)

BN

(An English Tea Drinker)

25 October 2007 at 09:31 , Mark said...

Yeah I share your frustration with the default being non-square pixels. I really don't have any idea why it works the way it does. I'm assuming it has something to do with the fact that it is a widescreen display.

I'm seeing more and more widescreen images that assume non-square pixels. I've blogged about some Windows Media Video files using non-square pixels but if I remember correctly anamorphic DVDs also use non-square pixels.

I think it has to do with being able to get better quality images without increasing the amount of storage needed for each image, but that is mostly a guess!

Anyway I hope my little application is useful but if you have any problems or suggestions for improvements let me know.

28 October 2007 at 00:18 , Barry said...

Yes, you're right about DVD and wide screen digital video in general using anamorphic pixels (though now that I think about it, I think HD uses square pixels). I always assumed it was just a trick to get the new aspect ratio whilst keeping the old resolution and data throughput. (I'm also a developer and I've done a lot of work with DirectShow and Windows Media over the last few years, so this kind of thing has been driving me mad for longer than I care to remember.) As for the ATMT picture frame, I'd understand if it actually played videos for me, but the only way I can get a natural looking image straight from source is to use still capture from a wide-screen camcorder or screen capture from a wide-screen TV - but I'm repeating myself here ...

Actually, the thing that really amazes me is how most people don't actually seem to notice this kind of thing. Ever since I got digital cable I've been driven mad by all the channels that are still sent out in 4x3, but I'm the only one in my family who ever bothers to switch the TV out of 16x9 to watch. It's the same kind of frustration I first experienced when watching my kids and their friends sharing earpieces from their Walkmans ... sorry, iPods. "It's supposed to be in stereo, don't they understand?"

18 December 2007 at 15:56 , Jonathan F said...

Thanks Mark.

I've had this frame for a while but rarely update the pictures because I have to spend time with GIMP resizing and cropping.
This tool is exactly what I kept saying I should write but never do!

19 December 2007 at 09:18 , Mark said...

Glad you found it useful. If you have any problems or suggestions let me know and I'll try and fix things.

19 December 2007 at 21:21 , Jonathan F said...

It's very good, but I've noticed a couple of things about the frame in general.
It seems that to get a 16:9 image you need to shrink the width so that the ratio is 4:3
The problem is that then you lose information off the top and bottom (more off the top than bottom!). Shrinking the image to 473*355 seems to lose little off the top without showing much of a black bar at the bottom.
Your scaling shows a little bit of a black bar, and doesn't lose any off the top but is not quite square (I started with a black square and measured the result).

Ideally, I'd like to work out how to take and image, define an area to display (aspect 16:9), and have it fill the entire screen with none lost. The file should also be as small as possible so that the frame doesn't have to upscale or downscale and I can get more on a card.
In order to show my desired area, the file itself may need to contain extra parts which I did not select and didn't intend to be shown (or the file could be padded). Those parts would be offscreen.

What did your research find about the peculiar display characteristics?

21 December 2007 at 16:12 , Mark said...

Jonathan,

I agree the frame is very strange when you try and resize photos to fully fill the frame.

I arrived at the numbers I use based partly on some suggestions on the web and partly by trial and error.

I scale the image to 0.764 of the original width and then crop to maintain an aspect ration of 342/480 (originally this was 350/480).

Sometimes this results in images completely filling the frame and on other occasions I get black bars at the top and bottom of the image. So, I'm assuming that somewhere in the code that maps from the preview image back to the original which I scale/crop there is a small mistake in the maths which is causing some photos to be scaled/cropped slightly wrongly which is causing a problem.

I'm going to try experimenting over the holiday to see if I can track down the problem and then hopefully fix it and post a new version. I'll keep you up-to-date with how I got on,

Mark

21 December 2007 at 16:45 , Jonathan F said...

Notably, scaling a 16:9 image to 4:3 provides the exactly correct aspect ration, but it's then the vertical resolution which seems to affect the black bars. Two images with different resolutions but the same ratio display differently. I don't think it's your program, I think it's the frame's downsampling.

I read somewhere that 450*346 was a good resolution to scale a 16:9 crop to, and it's pretty good but not perfect.

The thing perhaps you could change would be to decide on an ideal resolution and scale/crop to that. It obviously isn't ideal to send a 1437*1024 image to the frame even if it is the right ratio, as there aren't that many pixels, and who wants to leave the downsampling to the frame! It's clearly not the best, and it would waste memory card space.

I'll be interested to see what you find out.

21 December 2007 at 16:51 , Mark said...

I agree, I think the photos should be scaled down to the same size as the frame, both to save space and to stop the card from scaling the image (possibly incorrectly).

In fact it's such a good idea that it was how I thought the programme worked until I just checked!

I guess I definitely have a bug to fix now,

Mark

30 December 2007 at 19:18 , Mark said...

Just to let you all know I've released a new version of Convert4Frame which should fix some of the outstanding issues. You can get the new version through the link in the original post.

For those who are interested, the changes mainly involve the suggestions Jonathan F made, i.e. the image is now scaled down to 480x342 so that the frame doesn't have to scale the image and we got more photos on a memory card.

From the testing I've done this seems to have totally fixed things as I now can't produce an image which doesn't fully fill the frame. Hopefully it will will work for everyone else but if there are any problems or you have any suggestions for improvements then please leave me a comment.

Mark

Post a Comment