This photo frame makes me look fat.
September 26, 2007 9:17 PM   RSS feed for this thread Subscribe

Understanding how to make photos look good on my cheap-ass "widescreen" digital photo frame.

I bought a cheap digital photo frame; for $100 I'm not expecting much, but photos look nice and bright enough on it. Except for one problem. It's "widescreen" and it streches my photos horizontally.

As far as I can tell the pixel count ratio is the same as my photos - bits of the photos aren't being cropped off. I believe the resolution is 640 x 480.

The screen appears to be 6" wide, and 3.5" high, instead of the 4" you might expect.

Images that don't conform to a "normal" photo ratio aren't "stretched" to fit the screen - instead, you get black bars at the sides or top, as appropriate. Everything is just squashed to fit into 6x3.5" instead of 6x4.

What's the best way to process my photos so they don't look so weird on this thing? I figure I need to process my photos so they are 640 pixels wide and 480 high, but so the original photo is squashed somehow, so that when it appears in the digital photo frame, it's stretched back to it's original shape. How do I calculate how much to crop and where to stretch my images?
posted by Jimbob to computers & internet (14 comments total)
Pick pictures on which you can zoom in. This cuts off the top and bottom of your image, but if you have photos where this can be sacrificed, you'll be able to make full use of the screen without letterboxing.
posted by Blazecock Pileon at 9:20 PM on September 26, 2007


(I should say that I have kinda worked out the ratios - but is there any software available to convert photos to this allegedly "widescreen" format automatically, so I don't have to mess around stretching and cropping in The Gimp? )
posted by Jimbob at 9:21 PM on September 26, 2007


You can definitely get batch conversion software; I used to run a website for my school band and it saved me hours of time.

IrfanView is what you want. Google it. Great program.
posted by DMan at 9:25 PM on September 26, 2007


Irfanview can do a batch crop operation, but unfortunately all of the photos will be cropped from the same starting position, which may not be what you want for some of the photos.
posted by demiurge at 9:26 PM on September 26, 2007


Well it would a start just cropping from the same starting position; I've worked out what I need to do to get the photos looking decent:

1. Load my 8 megapixel image in the Gimp
2. Crop about 12% off the top and the bottom - make the height about 1900 instead of 2448 pixels.
3. Then stretch this image to conform to 640 x 480 pixels.

I'll see if Irfanview can do this all in one go.
posted by Jimbob at 9:32 PM on September 26, 2007


I don't know why you'd want to script cropping, unless every photo is identical. The cropping you'd do to one picture wouldn't necessarily work on another picture.
posted by Blazecock Pileon at 9:32 PM on September 26, 2007


You can do that in batch in Irfanview, but it will take two passes, one for cropping and one for rescaling.
posted by demiurge at 9:35 PM on September 26, 2007


I don't know why you'd want to script cropping, unless every photo is identical.

Step by step...
posted by Jimbob at 9:43 PM on September 26, 2007


ImageMagick can do it too, and will probably integrate nicely with your favorite scripting language.
posted by sebastienbailard at 10:41 PM on September 26, 2007


After further fiddling, I think I've done it using Python and the Python Image Library.

It even attemps to automatically find the best place to crop the image by searching for the part of the image with the highest coefficient of variation in pixel values (the aim being, bits of sky at the top of the frame, or bits of grass at the bottom, will tend to have little variation in tone, and so can know they can be discarded).

The code, in the unlikely even someone else faces this problem:


from PIL import Image
import os
import sys
from math import sqrt
def process_dir(dir):

for f in os.listdir(dir):
file = dir + os.sep + f
if os.path.isdir(file):
process_dir(file)
else:
dofile(dir,f)

return

def dofile(dir,f):
im = Image.open(dir + os.sep + f)

thewidth = im.size[0]
theheight = im.size[1]

cv=[]
pix = im.load()
for line in range(0,theheight):
pixellist = []
for pixel in range(0,thewidth):
avg = (pix[pixel,line][0] + pix[pixel,line][1] + pix[pixel,line][2]) / 3
pixellist.append(avg)
lineavg = 0
for pixel in pixellist:
lineavg = lineavg + pixel
lineavg = lineavg / thewidth
linecv = 0
for pixel in pixellist:
linecv = linecv + (pixel-lineavg)**2
linecv = sqrt(linecv)
cv.append(linecv)

max = 0
maxtest = 0
for line in range(len(cv)):
if cv[line] > maxtest:
max = line
maxtest = cv[line]



ratio = 1900 / 2448
hratio = 0.112
sratio = .388

maxbottom = max + int(sratio * theheight)
maxtop = max - int(sratio * theheight)

if maxtop <> maxtop = 1
maxbottom = maxtop + (sratio * 2 * theheight)

if maxbottom > (theheight - 1):
maxbottom = theheight-1
maxtop = maxbottom - (sratio * 2 * theheight)

cd = im.crop((1,int(maxtop),thewidth-1,int(maxbottom)))

rd = cd.resize((640,480))

print dir + os.sep + "small" + f
#rd.save(dir + os.sep + "small" + f,quality=95, optimize=1)
rd.save(dir + os.sep + "small" + f)

thedir = 'K:\photoframe'

process_dir(thedir)


posted by Jimbob at 11:53 PM on September 26, 2007 [3 favorites]


Actually, I should probably tune the algorithm so that instead of including the region with the highest variation in tone, it excludes the region with the lowest. The results differ. Oh well.
posted by Jimbob at 11:57 PM on September 26, 2007


Keep in mind that the pixels on your photo frame might not actually be square. This happened to me with a ~$100 frame that my parents bought for me and my SO.

I cropped the photos to the exact pixel dimensions that they listed on their website, but the photos still looked squashed. I had to experiment with non-uniformly scaling them in photoshop first to get them to look right on the screen. Thus, the photos looked fine in the frame, but looked squashed on my monitor!

If you have access to some kind of basic paint program, try making an image of checkered squares or something, and load that onto the frame. If the squares aren't square anymore, you've got more than just a cropping issue.
posted by GeekAnimator at 6:18 AM on September 27, 2007


This is, indeed the exact problem I've discovered, GeekAnimator. I've now figured out the exact ratio to "squash" my images by, and they look a lot better.
posted by Jimbob at 11:21 AM on September 27, 2007


I see you've already come up with an automated solution, but for anyone who wants to do this by hand later on:

Using the rectangular selection tool in GIMP, select the "Fixed aspect ration" option from the pull down menu in the tool options. Adjust the width and height options based on the physical size of your display (in this case, 60 and 35 [as whole numbers]).

Open your image(s) and select the best part, for quality you should try to make your selection as large as possible but obviously the best part might not be full width.

Use the crop tool and click once on your image. In the dialog that pops up, use the "From selection" button, then crop (using the crop button).

Use GIMP (or the batch options in IrfanView) and resample all of your cropped images to the pixel size of your display (in this case 640x480).

Be sure not to overwrite your originals when you save.
posted by anaelith at 10:36 AM on September 28, 2007


« Older Here we go again: partial lyri...   |   Where can adults and kids hang... Newer »

You are not logged in, either login or create an account to post comments



Related Questions
How to sell photos online? May 25, 2008
a wireless digital photo frame with proper viewing... March 3, 2008
Windows photo reviewer? June 26, 2007
best digital "video" frame April 4, 2007
LCD Screen to Digital Photo Frame November 3, 2005