Original Image
convert image.jpg -scale 310x496\! scaled.png
convert scaled.png +clone -flip -crop 310x150 -compose Dst -composite out/shadow.png
convert -size 310x150 -alpha set gradient:rgba\(255,0,255,0.6\)-rgba\(255,255,0,0.50\) out/grad.png
convert out/shadow.png out/grad.png -compose Dst_Out -composite out/shadow_gradiented.png
convert shadow_gradiented.png out/shadowed.png -append out/final.png
I am getting following output
But I want my output to be like following.
What am i doing wrong? Suggest me.
Additional:
Is there any way I can make all in one command.
Not certain what you are trying to achieve, but this might get you started:
convert wolf.jpg -scale 310x496\! \
\( +clone -flip -crop x150+0+0\! -alpha set -channel A -fx "0.6" \) -append result.png
If you want the alpha tailing off, try a formula that is a function of j (the distance from the top of the reflection) and h (the total height of the reflection).
convert wolf.jpg -scale 310x496\! \
\( +clone -flip -crop x150+0+0\! -alpha set -channel A -fx "0.8-(0.6*j)/h" \) -append result.png
If you want the code to be a bit more generic, and less dependent on actual sizes, you could change the height of the reflection to, say 1/4, of the height of the original (note the change from convert to magick)
magick wolf.jpg -scale 310x496\! \
\( +clone -flip -crop "x%[fx:h/4]+0+0\!" -alpha set -channel A -fx "0.8-(0.6*j)/h" \) -append result.png
Related
I want to combine 1.png and 2.png
When I combine the two files, I want to change the height of 2.png to the height of 1.png
I used the append command, but I didn't get the result I wanted.
Below is the command I used.
convert +append 1.png 2.png result.png
Please teach me the way!! Thanks !
image
In Imagemagick 6, you would need to get the height of image 1 first in a separate command. For example on a Unix-based system:
ht=`convert image1.png -format "%h" info:`
convert image1.png \( image2.png -resize x${ht} \) +append result.png
In Imagemagick 7, you can do it all in one command line:
magick image1.png -set option:ht "%ht" \( image2.png -resize "x%[ht]" +append result.png
Example:
Input
ht=`convert monet2.jpg -format "%h" info:`
convert monet2.jpg \( zelda1.jpg -resize x${ht} \) +append result.png
Result:
convert -append img1.png img2.png result.png
I'm using Perl 5.16 with ImageMagick 6.8 (probably old by now, but it works :). I'm trying to extract all 4 edge regions from one image and composite them into another image, side-by-side, oriented vertically.
I can extract edges and rotate them, but I can't get the offset in the target image right. The edges end up on top of each other. I tried x=>$marg, translate=>"$marg,0", geometry with an offset: no dice. Variables: $marg = the edge width, $im = source, $im2 = target, $ext = extracted region
# left edge
$ext=sprintf("%dx%d+%d+%d",$marg,$h,0,0);
$res=$im2->Composite(image=>$im,compose=>Over,extract=>$ext);
# top edge
$ext=sprintf("%dx%d+%d+%d",$w,$marg,0,0);
$geo=sprintf("%dx%d+%d+%d",$marg,$h,0,0);
$res=$im2->Composite(image=>$im,compose=>Over,extract=>$ext,rotate=>90,translate=>"$marg,0");
I haven't used the PerlMagick bindings for years, but I imagine you would want to create each of your 4 edge strips and then use +append to lay them out horizontally, side-by-side. Here's a crude example, just in Terminal:
magick -size 20x50 xc:red xc:lime xc:blue +append result.png
More specifically addressing your question, and starting with this image:
that would look like this:
#!/bin/bash
magick ~/sample/images/blocks-RGB.png -resize 100x100 +repage -write MPR:orig +delete \
\( MPR:orig -gravity northwest -crop 30x+0+0 \) \
\( MPR:orig -gravity northwest -crop x30+0+0 -rotate 90 \) \
\( MPR:orig -gravity southwest -crop x30+0+0 -rotate 90 \) \
\( MPR:orig -gravity northeast -crop 30x+0+0 \) \
+append result.png
Hopefully you can see the parallels with PerlMagick. The first line creates a copy of the image to work with, the second line crops the left edge, the third line crops the top edge, the fourth line crops the bottom edge, the fifth line crops the right edge and the last line appends the four cropped pieces side-by-side.
Is there any way to resize an image (jpg/ jpeg)on a range of predefined sizes and export at once on Gimp? (same image-different sizes batch scale and batch export).
Thank you!
From the Gimp GUI, there is a script/plug-in for this, see ofn-export-sizes here(*).
If you want to do that in batch, it is a lot easier/faster to use ImageMagick, which is designed to be used from a shell script:
magick convert input.jpg -resize 500x output-500px.jpg
(here 500x means resize to 500px wide and keep aspect ratio, you can otherwise set
height, width or both). You can even apply a bit of sharpening to compensate for the blur:
magick convert input.jpg -resize 500x -sharpen 0x1.0 output-500px.jpg
For more info, there is a rather active stream of ImageMagick questions here on SO.
(*) Note that in Gimp, a script usable in batch doesn't need to be a plugin, this is required only if you want to use the script from the GUI.
You can do that in Imagemagick command line. For Imagemagick 6 on Unix:
convert image.jpg -write mpr:img +delete \
\( mpr:img -resize W1xH1 +write result1.jpg \) \
\( mpr:img -resize W2xH2 +write result2.jpg \) \
\( mpr:img -resize W3xH3 +write result3.jpg \) \
...
null:
If on Windows
convert image.jpg -write mpr:img +delete ^
( mpr:img -resize W1xH1 +write result1.jpg ) ^
( mpr:img -resize W2xH2 +write result2.jpg ) ^
( mpr:img -resize W3xH3 +write result3.jpg ) ^
...
null:
If on Imagemagick 7, change convert to magick
I got this working code for tiling an image in ImageMagick:
convert D:\tile.jpg -resize 300x300 -write mpr:tiler +delete ^
-size 900x900 tile:mpr:tiler -sharpen 0x2 D:\tiles.jpg
But now i found out that i need to add watermark in the same process. I got this working code for that:
tiles.jpg Wartermark.png -gravity southeast -geometry +0+0 -composite D:\tile-watermark.jpg
But how do i process those two in one line?
I recently started working with Imagemagick and I had a problem that needs to be solved.
I have such a thumbnail.
And there is such a mask.
I need to get this image on the output.
I looked through this link http://www.imagemagick.org/Usage/thumbnails/ I tried everything there, but I did not get success ((
I hope you will help me.
This should give you a result very much like your example...
convert mask.png image.png -gravity north -composite \
mask.png -compose copyopacity -composite result.png
You can adjust the positioning of the overlay by including something like "-geometry -10+0" before the first composite.
To use this command in Windows you'll need to change that continued line backslash "\" to a caret "^".
In Imagemagick, you should extract the alpha channel of your mask and put that into the alpha channel of your other image. So try
(unix syntax)
convert KlQZ6.png \( 7k9a9.png -alpha extract \) -alpha off -compose copy_opacity -composite result.png
(windows syntax)
convert KlQZ6.png ( 7k9a9.png -alpha extract ) -alpha off -compose copy_opacity -composite result.png