Under windows with IM 6.5 or 6.9, I am applying an SRT rotation over a PNG image, and would like to set the background color.
I can successfully rotate the image and set the virtual pixels color, but my rotated image in the center remains in a "transparent square".
To be clearer, the initial transparency of the image is retained.
I would like the background color to be applied 1). to the virtual pixels, but also 2). in the whole canvas background.
I have tried the two following approaches, without success :
Approach 1 : Setting the background color the simplest way.
It would seem to be the way to go...
Code: Select all
convert InputTransparentFile.png ^
-alpha remove ^
-alpha off ^
-background #F39393 ^
-virtual-pixel background ^
-background #F39393 ^
+distort SRT '45' ^
+repage ^
OutputPicture-withLightRedBackground.png
It seems very over-complicated to me...
Code: Select all
convert ^
InputTransparentFile.png ^
-alpha set ^
-virtual-pixel none ^
+distort SRT '45' ^
-background #F39393 ^
+write TempResult-RotatedImage.png ^
-write mpr:RotatedImage +delete ^
^
mpr:RotatedImage -set colorspace RGB ^
-alpha extract ^
+write TempResult-ExtractedImageAlpha.png ^
-write mpr:ExtractedImageAlpha +delete ^
^
mpr:RotatedImage mpr:ExtractedImageAlpha -alpha Off -compose CopyOpacity -composite ^
+write TempResult-RotatedImgWithAlpha.png ^
-write mpr:RotatedImgWithAlpha +delete ^
^
mpr:RotatedImgWithAlpha -alpha Off -background #F39393 -flatten ^
OutputPicture-withLightRedBackground.png