Starting with a jpg. I want to fade the last 20 pixels on all four edges to white, so when the image is presented on a white background web page you do not see the edge of the image. Need final output to also be jpg if possible.
Here's a link to a dropbox folder with an example image.
https://www.dropbox.com/sh/4mibp578dd4s ... V9Nia?dl=0
How to fade or feather the outer 20pixels to pure white
Re: How to fade or feather the outer 20pixels to pure white
You could check out Anthony's examples
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: How to fade or feather the outer 20pixels to pure white
snibgo's IM pages: im.snibgo.com
Re: How to fade or feather the outer 20pixels to pure white
Not sure what happened to the dropbox link but here's the full address.
https://www.dropbox.com/sh/4mibp578dd4s ... V9Nia?dl=0
https://www.dropbox.com/sh/4mibp578dd4s ... V9Nia?dl=0
- GeeMack
- Posts: 718
- Joined: 2015-12-01T22:09:46-07:00
- Authentication code: 1151
- Location: Central Illinois, USA
Re: How to fade or feather the outer 20pixels to pure white
If you want a 20 pixel fade to white on all the edges of your image, you can create a 20 pixel high strip that fades from white to none, then composite that over all four edges of the original. A command like this (with IM 6.9.6 on Windows) will take any size input image...tbayle wrote:Starting with a jpg. I want to fade the last 20 pixels on all four edges to white, so when the image is presented on a white background web page you do not see the edge of the image. Need final output to also be jpg if possible.
Code: Select all
convert input.jpg gradient:white-none[1x20!] -background none -virtual-pixel edge ^
( -clone 0 -crop x20+0+0 ) ( -clone 0 -crop 20x+0+0 -rotate 90 ) ^
( -clone 1-3 +append -distort affine "0,0 %[w],0" )^
( -clone 0,4 -composite -rotate 90 -clone 4 -composite -rotate 90 ^
-clone 4 -composite -rotate 90 -clone 4 -composite -rotate 90 ) ^
-delete 0--2 -quality 100 output.jpg
If you have a lot of images to process you can use a command like that in a "for" loop.
Re: How to fade or feather the outer 20pixels to pure white
I copied your code and created a batch file, but received errors when I ran it.
1. must specify image size 'white-none' @ error/gradient.c/ReadGRADIENTImage/116.
2. invalid argument for option Affine: 'require at least 1 CPs' @ error/distort.c/GenerateCoefficients/466.
3. no such image '-clone' @ error/convert.c/ConvertImageCommand/940.
Also tried doubling up on the % being I'm running it from a batch file but still failed. Running 6.7.2 on windows.
1. must specify image size 'white-none' @ error/gradient.c/ReadGRADIENTImage/116.
2. invalid argument for option Affine: 'require at least 1 CPs' @ error/distort.c/GenerateCoefficients/466.
3. no such image '-clone' @ error/convert.c/ConvertImageCommand/940.
Also tried doubling up on the % being I'm running it from a batch file but still failed. Running 6.7.2 on windows.
Code: Select all
convert input.jpg gradient:white-none[1x20!] -background none -virtual-pixel edge ^
( -clone 0 -crop x20+0+0 ) ( -clone 0 -crop 20x+0+0 -rotate 90 ) ^
( -clone 1-3 +append -distort affine "0,0 %[w],0" )^
( -clone 0,4 -composite -rotate 90 -clone 4 -composite -rotate 90 ^
-clone 4 -composite -rotate 90 -clone 4 -composite -rotate 90 ) ^
-delete 0--2 -quality 100 output.jpg