resize, crop and watermark
resize, crop and watermark
Hi,
I'm new to ImageMagick and little confused how to do the following to a batch of images in a folder.
1. the images in the folder are various widths and heights (eg. 900x1759, 1280x400, etc)
2. re-size the images to 200px at the shortest dimension (either width or height)
3. crop the images in the center of the re-sized images (eg. 900x1759 => re-size to 200x391 => crop centered 200x200)
4. small transparent "text" watermark in the bottom left hand corner (eg. www)
Thank you for your help!
I'm new to ImageMagick and little confused how to do the following to a batch of images in a folder.
1. the images in the folder are various widths and heights (eg. 900x1759, 1280x400, etc)
2. re-size the images to 200px at the shortest dimension (either width or height)
3. crop the images in the center of the re-sized images (eg. 900x1759 => re-size to 200x391 => crop centered 200x200)
4. small transparent "text" watermark in the bottom left hand corner (eg. www)
Thank you for your help!
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: resize, crop and watermark
2. I think "-resize 200x200^" is what you want. See http://www.imagemagick.org/script/comma ... p#geometry
3. "-gravity center -crop 200x200+0+0"
4. Lots of ways, including:
-gravity SouthWest -fill rgba(100%,0,0,0.75) -annotate 0 "www.something"
3. "-gravity center -crop 200x200+0+0"
4. Lots of ways, including:
-gravity SouthWest -fill rgba(100%,0,0,0.75) -annotate 0 "www.something"
snibgo's IM pages: im.snibgo.com
Re: resize, crop and watermark
I tried -resize 200x200 but it does not seem to pick the shortest side - I end up with something like 156x200.
convert 1fc214004c9481e4c8073e85323bfd4b.png -resize 200x200 -gravity center -crop 200x200+0+0 200x200.png
I tried the following:
convert 1fc214004c9481e4c8073e85323bfd4b.png -trim -resize 200x200 -gravity center -extent 200x200 200x200.png
but the resulting image is not proportional.
Thank you.
convert 1fc214004c9481e4c8073e85323bfd4b.png -resize 200x200 -gravity center -crop 200x200+0+0 200x200.png
I tried the following:
convert 1fc214004c9481e4c8073e85323bfd4b.png -trim -resize 200x200 -gravity center -extent 200x200 200x200.png
but the resulting image is not proportional.
Thank you.
Re: resize, crop and watermark
Thanks! I missed the caret ^ ... Is it possible to make two different but proportional thumbnails out of this resized and crop image at the same time?
eg. 900x1759 => 200x200 (resized, cropped) => 100x100 thumbnail => 50x50 thumbnail
Thank you.
eg. 900x1759 => 200x200 (resized, cropped) => 100x100 thumbnail => 50x50 thumbnail
Thank you.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: resize, crop and watermark
Yes. "-write" will write all of the images in the current list. You could for example:
Code: Select all
convert in.png
( +clone -resize 200x200^ -crop 200x200+0+0 -write out1.png +delete )
( +clone -resize 100x100^ -crop 100x100+0+0 -write out2.png +delete )
etc...
NULL:
snibgo's IM pages: im.snibgo.com
Re: resize, crop and watermark
I added the -gravity center command and it works! However, I'm getting duplicates;
[ ] +delete-0 05-Mar-2014 12:34 12K ????
[ ] +delete-1 05-Mar-2014 12:34 12K ????
[IMG] 1fc214004c9481e4c8073e85323bfd4b.png 20-Feb-2012 19:41 492K
[IMG] out1-0.png 05-Mar-2014 12:34 54K
[IMG] out1-1.png 05-Mar-2014 12:34 54K
[IMG] out2-0.png 05-Mar-2014 12:34 12K
[IMG] out2-1.png
convert 1fc214004c9481e4c8073e85323bfd4b.png +clone -resize 200x200^ -gravity center -crop 200x200+0+0 -write out1.png +delete +clone -resize 100x100^ -gravity center -crop 100x100+0+0 -write out2.png +delete
Thank you.
[ ] +delete-0 05-Mar-2014 12:34 12K ????
[ ] +delete-1 05-Mar-2014 12:34 12K ????
[IMG] 1fc214004c9481e4c8073e85323bfd4b.png 20-Feb-2012 19:41 492K
[IMG] out1-0.png 05-Mar-2014 12:34 54K
[IMG] out1-1.png 05-Mar-2014 12:34 54K
[IMG] out2-0.png 05-Mar-2014 12:34 12K
[IMG] out2-1.png
convert 1fc214004c9481e4c8073e85323bfd4b.png +clone -resize 200x200^ -gravity center -crop 200x200+0+0 -write out1.png +delete +clone -resize 100x100^ -gravity center -crop 100x100+0+0 -write out2.png +delete
Thank you.
Re: resize, crop and watermark
I removed the () because I was getting this error;
convert 1fc214004c9481e4c8073e85323bfd4b.png (+clone -resize 200x200^ -gravity center -crop 200x200+0+0 -write out1.png +delete) (+clone -resize 100x100^ -gravity center -crop 100x100+0+0 -write out2.png +delete) NULL:
-bash: syntax error near unexpected token `('
Thank you.
convert 1fc214004c9481e4c8073e85323bfd4b.png (+clone -resize 200x200^ -gravity center -crop 200x200+0+0 -write out1.png +delete) (+clone -resize 100x100^ -gravity center -crop 100x100+0+0 -write out2.png +delete) NULL:
-bash: syntax error near unexpected token `('
Thank you.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: resize, crop and watermark
Parentheses must have spaces before and after on each one.
Code: Select all
convert 1fc214004c9481e4c8073e85323bfd4b.png ( +clone -resize 200x200^ -gravity center -crop 200x200+0+0 -write out1.png +delete ) ( +clone -resize 100x100^ -gravity center -crop 100x100+0+0 -write out2.png +delete ) NULL:
Re: resize, crop and watermark
I tried both, even copied and pasted in the Code: Select all ... still error -bash: syntax error near unexpected token `('
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: resize, crop and watermark
I don't do Unix but I think you need to escape the parentheses: \( and \)
snibgo's IM pages: im.snibgo.com
Re: resize, crop and watermark
good one! I'm no unix guru but escape the parentheses worked!
Thank you!
Thank you!
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: resize, crop and watermark
It is always a good idea to identify your IM version and platform when asking a question on this forum. That skips wasted time about syntax differences between Unix and Windows.
Please review viewtopic.php?f=1&t=9620 which is the very first post (and permanently first post) at the top of the Users forum.
Please review viewtopic.php?f=1&t=9620 which is the very first post (and permanently first post) at the top of the Users forum.