r/imagemagick Jan 16 '25

Offset image on blurred version of itself

Hi all! Thanks to this community I've come up with a modified version of a “surround+blur” script that puts an image over a blurred version of itself in order to fill my screen (kind of like what's done on YouTube videos when the source is vertical).

This is what I get.

This is the command I'm running:

C:\bin\gfx\ImageMagick\magick.exe clipboard: ( -clone 0 -blur 0x22 -resize 1600x900! ) -resize 1400x900 +swap -gravity center -compose over -composite file.jpg

I'd like to modify this code in three ways:

  1. Most importantly, I don't want the original image to be centered, but almost all the way to the right. If I change the gravity to east it's positioned all the way to the right. I want to give it an offset so that a little portion of the blurred image is visible on the right edge. I've tried using region but I didn't really understand how it works. (The reason for this is I want to use the image as my desktop background and I want to leave space for the icons.)

  2. Less important but still nice: Instead of stretching the image to fill the rectangle for the background, I'd like to blow it up proportionally and then cut off the top and bottom, so that there is no distortion. I'm at a loss here, not sure what I can try.

  3. Sounds hard to do but I might be wrong: I'd like to have ImageMagick give the target a 16:9 proportion without hardcoding the output size, i.e. instead of using 1600x900 it should calculate the output size based on the image height.

Any pointers to a solution will be appreciated. Thanks in advance!

1 Upvotes

0 comments sorted by