Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Click here to return to the 'Optimize images for Desktop Background display' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Optimize images for Desktop Background display
Authored by: philostein on Oct 28, '10 05:04:51AM
Thanks tedw, your code is a lot better written than mine, I picked up a few things.

I want to emphasise that the result of tedw's script is substantially different from the original, in that my script keeps the original images' visible dimensions and pads them to the screen ratio. tedw's version scales images to the screen size, which can cause blockiness when scaling small images.

I say for small and large images in one folder, use my script, and for a folder of images larger than the screen, use tedw's (and save some memory). Or perhaps someone would like to combine the two scripts?

[ Reply to This | # ]
Optimize images for Desktop Background display
Authored by: tedw on Oct 28, '10 09:32:04AM
well, modifying the script is straight-forward. If you don't want scaling at all, comment out or delete the

scale _image by factor _scalingFactor

line. Of course, this will mean that images which are larger than the screen size will not be scaled down and may not display correctly. If you're only worried about blockiness, then you can add in a check to keep from scaling up images that are too small. You could do that by adding the following lines after the if statement block in the process_images handler (right before the tell application "Image Events" line):

-- _scaling up by a large factor produces blockiness, so set scaling to 1 and pad instead
if _scalingFactor ≥ 2 then set _scalingFactor to 1
The 2 is a guess (assuming that images which will be scaled up by a factor of 2 might get blocky). 3 or 4 might work as well; I really haven't experimented to see how much scaling Core Image can handle before blockiness sets in.

[ Reply to This | # ]