Page 1 of 1
cutting the height images by percent size
Posted: 2016-01-04T08:49:00-07:00
by jmishal
ok ,, cutting the height images by percent size
assume i have multiples images size like
1600x1200 1200x1600 640x640 960x960 2448x3264 640x614 640x640 2448x3264 2896x2896 2448x3264 750x1334 900x1600 750x1334.. etc
all those images have logo in the right bottom near to corner (( see the below example pic have asterisk as logo ))
so I need to cutting 'height' only from button by percent size like (10%) to remove the logo
or any best way to identify the logo and replace it either another logo nor black bar.
I already make bash script to identify the image size with if statement
thanks
Re: cutting the height images by percent size
Posted: 2016-01-04T10:30:53-07:00
by fmw42
See IM function -crop. It allows percents on the image size.
http://www.imagemagick.org/Usage/crop/#crop_percent.
Always best to provide your IM version and platform when asking questions. See
viewtopic.php?f=1&t=9620
You can also just use -draw to paint over that area with some fixed color. See
http://www.imagemagick.org/Usage/draw/#primitives
Or you could crop out a section of the image somewhere else and composite it over the star or logo. See
http://www.imagemagick.org/Usage/compose/#compose and
http://www.imagemagick.org/Usage/layers/#convert.
Or you could get some inpainting software to fill in that area with similar texture. On Windows, see
http://im.snibgo.com/fillholespri.htm and
http://im.snibgo.com/fillholes.htm or use an online inpaint tool such as at
http://www.webinpaint.com/
Re: cutting the height images by percent size
Posted: 2016-01-04T12:52:10-07:00
by jmishal
still not got the answer of my question ,,
I try deference ways to run -crop with convert but still doesn't work ..
Code: Select all
convert 1455.jpg -crop 1200x95%+0+0 out.png
above code almost near what i need but the output is something like ((zoom in)) the image not cutting from down
the expect the output like that
btw: I've always read the instruction & see the examples ... before post question either here or any other place & i also googled but not found my answer... but in the mean time I wonder why they're support sites (like here) isn't to provide support and provide help to clients?
be-note that not every one can understood the coding or how things work from the first time.
thanks
Re: cutting the height images by percent size
Posted: 2016-01-04T14:04:19-07:00
by snibgo
"%" means both width and height are percentages. You could use:
Code: Select all
convert in.jpg -crop 100x95%+0+0 +repage out.png
Re: cutting the height images by percent size
Posted: 2016-01-04T14:53:35-07:00
by jmishal
snibgo wrote:"%" means both width and height are percentages. You could use:
Code: Select all
convert in.jpg -crop 100x95%+0+0 +repage out.png
Works like a charm, thanks!
Code: Select all
for i in *.jpg; do
convert $i -crop 0x95%+0+0 +repage fix_$i
done
Re: cutting the height images by percent size
Posted: 2016-01-04T17:09:21-07:00
by fmw42
For geometry reference, see
http://www.imagemagick.org/script/comma ... p#geometry.
-crop also works with -gravity. see
http://www.imagemagick.org/script/comma ... hp#gravity
So you might also consider this to fill over the bottom right with a solid color:
Code: Select all
convert water.png \
\( -clone 0 -gravity southeast -crop 15%x20%+0+0 +repage \
-fill DarkOliveGreen -colorize 100% \) \
-gravity southeast -compose over -composite water_new.png
or something like to composite a section from the bottom left over the bottom right:
Code: Select all
convert water.png \
\( -clone 0 -gravity southwest -crop 15%x20%+0+0 +repage \) \
-gravity southeast -compose over -composite water_new2.png
or something like this to just fill in the star in the bottom right with texture from the bottom left:
Code: Select all
convert water.png \
\( -clone 0 -gravity southwest -crop 15%x20%+0+0 +repage \) \
\( -clone 0 -gravity southeast -crop 15%x20%+0+0 +repage \
-fuzz 30% -transparent yellow -transparent red \
-channel rgba -fill white -opaque none -fill black +opaque white \) \
\( -clone 1 -clone 2 -alpha off -compose copy_opacity -composite \) \
-delete 1,2 -gravity southeast -compose over -composite water_new3.png
Inpainting would be similar to the last, but automatically find the best textures to match.