I'm attempting to use IM to perform a correction on an image where the green channel of a 1920x1080 RGB image is offset half a pixel in both the positive X and Y directions. My intention is to move the green channel back into alignment with the blue and red channels.
My current approach is to double the size of the image so that the correction becomes a integer number of pixels, separate each channel into a file, use page to shift the green channel with a transparent background, combine the images, and then use a point filter to scale back to the original size.
Code: Select all
convert checker.bmp -resize 200% checker2.bmp
convert -page -1-1 checker2.bmp -channel G -separate -background none -flatten checker_shifted_green.bmp
convert checker2.bmp -channel R -separate checker_red.bmp
convert checker2.bmp -channel B -separate checker_blue.bmp
convert checker_red.bmp checker_shifted_green.bmp checker_blue.bmp -set colorspace RGB -combine -set colorspace sRGB checker_combined.bmp
convert checker_combined.bmp -filter Point -resize %50 checker_combined_smaller.bmp
Edit: I'm using version ImageMagick 7.0.2-10