2400×1600 wallpaper creator

I have dual 1600×1200 monitors at work, rotated into portrait orientation.  That’s a lot of desktop space, and I love it, however searching for 2400×1600 wallpaper on the Internet has proven fruitless.

There are lots of 2560×1600 monitors out there, and unsurprisingly lots of 2560×1600 desktop wallpapers.

Since I’m using dual monitors, there’s a screen gap between the two monitors, where the two monitors touch, and it happens to be pretty close to 160 pixels wide, if pixels existed there. 

So it seemed reasonable to me to find a way to transform those slightly too large images into images that accomodate the physical space between my monitors as well as the different screen resolutions.

Here’s the Java I wrote to turn 2560×1600 into 2400×1600.  This does more than a simple crop – it cuts the center out of the image so the split occurs where the physical monitors separate the logical desktop space.

package wallpaper;  

import java.awt.Graphics2D; 
import java.awt.image.BufferedImage; 
import java.io.File; 
import java.io.IOException;  

import javax.imageio.ImageIO;  

public class FixWallpaper {  

    public static void main(String[] args) throws IOException { 
        String file = args[0];  

        File original = new File(file); 
        BufferedImage image = ImageIO.read(original);  

        int width = 2400; 
        int height = 1600;  

        BufferedImage left = image.getSubimage(0, 0, 1200, 1600); 
        BufferedImage right = image.getSubimage(1359, 0, 1200, 1600);  

        BufferedImage completeImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); 
        Graphics2D g2d = completeImage.createGraphics();  

        g2d.drawImage(left, 0, 0, null); 
        g2d.drawImage(right, 1200, 0, null);  

        String fName = file.replaceAll(".w+$", ".png"); 
        ImageIO.write(completeImage, "PNG", new File(fName)); 

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s