Rotate PNG by ImageMagick - rotation

I want to rotate PNG file by convert command.
like this.
convert -background 'rgba(0,0,0,0.5)' -rotate 45 1.png r1.png
But result PNG file is wrong like following.
https://docs.google.com/spreadsheet/ccc?key=0AqzGWe_mT6dwdEIwa04xRldwVGtOX1VGbVJhRnZwX0E
The gray space is correct.
I don't know why black space exists.
What am I wrong?
thank you.
convert -version
Version: ImageMagick 6.5.4-7 2012-05-07 Q16 OpenMP http://www.imagemagick.org
Copyright: Copyright (C) 1999-2009 ImageMagick Studio LLC

The image to modify comes straight after convert.
Try:
convert 1.png -background "rgba(0,0,0,0.5)" -rotate 45 r1.png

This worked for me
$ convert 1.png -distort SRT -ANGLE_IN_DEGREES -gravity center r1.png

Related

Pngs are blank when using convert

The following is giving me a blank image of the expected size:
magick convert a.png b.png -compose difference -composite out.png
However, I can produce the correct output as a jpg:
magick convert a.png b.png -compose difference -composite out.jpg
I then tried to convert this to a png and it works fine:
magick convert out.jpg out.png
Why is the first command giving me a blank image and how might I fix the problem?
Libpng version 1.6.37.
Version: ImageMagick 7.0.11-8 Q16 x86_64 2021-04-17 https://imagemagick.org
Copyright: (C) 1999-2021 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC HDRI Modules OpenMP(4.5)
Delegates (built-in): bzlib freetype gslib heic jng jp2 jpeg lcms lqr ltdl lzma openexr png ps tiff webp xml zlib
UPDATE:
Bmp is also blank:
magick convert a.png b.png -compose difference -composite out.bmp
And this also works for jpg but not png:
composite -compose difference a.png b.png out.png
And this is what I see when running verbose:
a.png PNG 500x700 500x700+0+0 8-bit sRGB 125771B 0.030u 0:00.016
b.png PNG 500x700 500x700+0+0 8-bit sRGB 90207B 0.020u 0:00.012
a.png=>b.png PNG 500x700 500x700+0+0 8-bit sRGB 90207B 0.450u 0:00.084
This is working and is giving my the required output:
composite -verbose -compose minus a.png b.png out.png

video from images, but only imagemagick created pixelized

I am trying to make video from images. First i create images with imagemagick (simple version):
convert -background transparent -size 1280x720 -gravity center
caption:'text' 0.png
then ffmpeg(simple version):
ffmpeg -framerate 0.5 -i 0.png debug.mp4
and this is what happens: http://prntscr.com/qy5i08 do you see the difference? Image and video resolution is the same 1280x720
I used another png image not created with imagemagick and there is no difference. Why is that?
The issue was -background transparent
When using background black than the quality is normal.

How I can remove background color from image using GraphicsMagick?

How I can remove background color from image using GraphicsMagick? I need to delete rgb(255,255,255) and rgb(254,254,254) colors from image and replace them to transparency.
Thank you.
you should tinker with fuzz -parameter to match #fefefe
gm convert in.png -fuzz 3% -transparent "#ffffff" out.png
Should comment but cannot.
gm convert -geometry 50x50! -background white -extent 0x0 +matte in.png out.jpg or
gm convert -background color -extent 0x0 +matte src.png dst.png

Combining images in ImageMagick with drop shadow

I am cropping and blurring a 960x960px image to 960x416 using GraphicsMagick:
gm convert -resize 960x416^ -gravity center -crop 960x416+0+0 +repage in.jpg bg.png
gm mogrify -gaussian 25x10 bg.png
After that, I create a 200x200px thumbnail of same initial image:
gm convert -resize 200x200 in.jpg top.png
On the last step, I combine both images, where the thumbnail will be placed on the top left position of the background image:
gm composite top.png bg.png -geometry 960x416+50+16 out.jpg
This works like a charm. But what I now need is a automatically generated dropshadow for the image top.png when it will be composited on the top of the bg.png in the last step. Is this possible?

Imagemagick gradient from left and right

I want to use Imagemagick to add a transparent gradient from the left and right to be composed with an image.
I can generate the image with:
convert -size 100x100 gradient: -function Polynomial -4,4,0 -distort SRT 90 gradient.png
And it looks like:
I can also compose that image on top of the image I want with:
composite original.jpg -compose Multiply gradient.png final_image.jpg
All of this works fine. My question is, how do I change the color of that gradient?
Thanks!
Simply add comma-separated colors after gradient: option:
convert -size 100x100 gradient:white,blue -function Polynomial -4,4,0 -distort SRT 90 gradient.png
Note, that -function converts channels too, so colors in gradient wont be original.
Found a way around this by doing
convert input.jpg -alpha set -virtual-pixel transparent -background red -channel A -blur 0x34 -level 75%,100% +channel -flatten final.jpg
which works in my case, giving me:

Resources