# Screen-saver generator



## NogDog (May 1, 2009)

I whipped up a PHP script for creating a grayscale 600x800 pixel JPEG image from any JPEG image file. (It may fail with really large images, so consider yourself warned.)

http://charles-reace.com/kindle_ss.php http://charles-reace.com/kindle_screensaver.php

It will resize and crop the image to be 600 x 800 pixels. In order to achieve that 3x4 aspect ratio, it lops off equal amounts from both sides if it's wider than that ratio, or else from top and bottom. Therefore if the important part of the image is not centered, you might not like the result. But hey, it's a quick and dirty method if you don't want to mess around with PhotoShop, The GIMP, or other image editing programs. 

Enjoy.

PS: The image you upload is not stored on the server, so you need not worry about any photos being re-used, sold, used as blackmail material, etc.


----------



## 911jason (Aug 17, 2009)

How cool is that Nog, I'm sure many users will find this very helpful! =)


----------



## Betsy the Quilter (Oct 27, 2008)

This is very cool.  I've been playing with it, large files (2.3 MB, for one I tried) aren't recognized.  But the smaller ones do well.  I'm heading out but I'm eager to come back and play with it.

Betsy


----------



## scott_audio (Oct 19, 2009)

Very cool indeed, eliminates the need to learn a graphics program and its fast


----------



## NogDog (May 1, 2009)

I think there may be a bug in my resizing and/or cropping algorithm, as some images are coming up with blank areas on the bottom and/or right. I'll have to do some reviewing and testing tonight -- probably a stupid math error. I did find a somewhat better algorithm form converting the colors to gray scale, or at least it seems to give a bit more contrast.


----------



## Betsy the Quilter (Oct 27, 2008)

The only image I tried that came out like that (so far) was less than 600x800.  I'll let you know if I find any more.  Can you do one that does the same for DX images? (Not meaning to be greedy--this is great!)

Betsy


----------



## NogDog (May 1, 2009)

Betsy the Quilter said:


> The only image I tried that came out like that (so far) was less than 600x800. I'll let you know if I find any more.


Yeah, that's pretty much what I think I was seeing, which makes me wonder if the inverse is true on larger images causing it to crop too much.



> Can you do one that does the same for DX images? (Not meaning to be greedy--this is great!)
> 
> Betsy


Should be fairly simple for the DX version: I'll just add a radio button pair on the form to select the desired size, then change the base width/height values based on that selection.


----------



## NogDog (May 1, 2009)

I think I got the scaling/cropping issue fixed, so now it's off to DX support....


----------



## Jaasy (Feb 28, 2009)

Very nice


----------



## NogDog (May 1, 2009)

DX option added.


----------



## NogDog (May 1, 2009)

I changed the link to http://charles-reace.com/kindle_screensaver.php, but the original link will automatically redirect to the new one. Also added some navigation links and a couple adverts (you never know). I'll be leaving it alone now unless anyone finds any bugs that need extermination.


----------



## Pea (Nov 12, 2009)

You are fabulous! Thanks so very much


----------



## mlewis78 (Apr 19, 2009)

I haven't managed to get an image yet.  Is there a maximum file size or dimensions of the file for this to work?  I was trying it with the K2 size screensaver.  

Thanks for putting this up, Nog Dog.


----------



## NogDog (May 1, 2009)

It should probably reject any file over 2MB. There could also be a potential with memory maxing out for large images in terms of pixel width/height, due to the way the PHP image functions work. I tried a 1000x800 image file that was about 1.5MB in size and it worked OK, though it probably took about 45 seconds or so before the download pop-up appeared.

I'll have to check the host settings tomorrow to see what my max memory size is, and I may then need to add some validation on the uploaded image's dimensions to prevent out-of-memory errors, which can be difficult to trap in a user-friendly manner.


----------



## NogDog (May 1, 2009)

Added some validation to reject any uploaded image with more than 3,000,000 pixels (e.g. a 2000 X 1500 pixel image) in order to avoid using too much memory on the server. Also tweaked the user interface a bit including some more useful error messages.


----------



## mlewis78 (Apr 19, 2009)

Thanks.  Now I know that my images were too big, since it tells me so.


----------



## NogDog (May 1, 2009)

Ran your avatar image through it, and it turned out pretty good.


----------



## BTackitt (Dec 15, 2008)

giving this thread a bump so our new members can find it easily and make their own Screensavers if they wish.
although I and others will still happily help if asked.


----------



## Moosh (Dec 22, 2009)

Thanks to this and the screensaver hack I now have my Chihuahua, Moose, as my screensaver! Love it.


----------



## Sunnie (Apr 3, 2010)

bumpage because this is so great.

I find with really large files, I go into Photoshop Elements and change them to gray scale, and maybe auto-sharpen too, and that usually gets their size down.  

Thanks for this!


----------

