Resize -> Crop -> Image Mask -> Merge Layers
-
- Posts: 14
- Joined: 2012-10-15T20:41:33-07:00
- Authentication code: 67789
Resize -> Crop -> Image Mask -> Merge Layers
Hi
I'm trying to use imagemagick for auto creating missing disc images from a movie poster for mediaportal (open source home theatre pc software). I'm hoping some one can help me with the commands I need to use.
Start with poster.jpg which is a rectangular image and can be any size.
Step 1a - Centre crop into a square
Step 1b - Resize to 1000 x 1000
Step 2 - Apply a transparency mask
Step 3 - Overlay a semi transparent image on top
Save final image as png with transparency
Link to poster.jpg/transperncy masks etc on photobucket
Link to .zip file with all images
Any help will be appreciated. I'm trying to do this myself but I'm struggling, hopefully this is a relatively simple task for most people and someone can chime in with the steps I need to do
Thanks!!! <3
I'm trying to use imagemagick for auto creating missing disc images from a movie poster for mediaportal (open source home theatre pc software). I'm hoping some one can help me with the commands I need to use.
Start with poster.jpg which is a rectangular image and can be any size.
Step 1a - Centre crop into a square
Step 1b - Resize to 1000 x 1000
Step 2 - Apply a transparency mask
Step 3 - Overlay a semi transparent image on top
Save final image as png with transparency
Link to poster.jpg/transperncy masks etc on photobucket
Link to .zip file with all images
Any help will be appreciated. I'm trying to do this myself but I'm struggling, hopefully this is a relatively simple task for most people and someone can chime in with the steps I need to do
Thanks!!! <3
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Resize -> Crop -> Image Mask -> Merge Layers
try this (unix commands)
convert poster.jpg -gravity center -crop 1000x1000+0+0 +repage \
dvdoverlay.png -compose over -composite \
transparency_mask.png -alpha off -compose copy_opacity -composite result.png
if on windows replace line continuation \ with ^
see
http://www.imagemagick.org/Usage/crop/
http://www.imagemagick.org/Usage/compose/
convert poster.jpg -gravity center -crop 1000x1000+0+0 +repage \
dvdoverlay.png -compose over -composite \
transparency_mask.png -alpha off -compose copy_opacity -composite result.png
if on windows replace line continuation \ with ^
see
http://www.imagemagick.org/Usage/crop/
http://www.imagemagick.org/Usage/compose/
-
- Posts: 14
- Joined: 2012-10-15T20:41:33-07:00
- Authentication code: 67789
Re: Resize -> Crop -> Image Mask -> Merge Layers
THANKS!
That is 95% there
I actually want to apply the mask before the overlay, I might be able to figure this out myself (hopefully)
EDIT:
convert poster.jpg -gravity center -crop 1000x1000+0+0 +repage ^ transparency_mask.png -alpha off -compose copy_opacity -composite dvdoverlay.png -compose over -composite ^ result.png
It works, THANK YOU x 1000 ! <3 <3 you saved me many hours of work
That is 95% there
I actually want to apply the mask before the overlay, I might be able to figure this out myself (hopefully)
EDIT:
convert poster.jpg -gravity center -crop 1000x1000+0+0 +repage ^ transparency_mask.png -alpha off -compose copy_opacity -composite dvdoverlay.png -compose over -composite ^ result.png
It works, THANK YOU x 1000 ! <3 <3 you saved me many hours of work
Last edited by kiwijunglist on 2012-10-15T22:01:42-07:00, edited 1 time in total.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Resize -> Crop -> Image Mask -> Merge Layers
kiwijunglist wrote:THANKS!
That is 95% there
I actually want to apply the mask before the overlay
Why if this gets the result you want?
-
- Posts: 14
- Joined: 2012-10-15T20:41:33-07:00
- Authentication code: 67789
Re: Resize -> Crop -> Image Mask -> Merge Layers
thanks, i switched the order of the commands (as above edited post) and i got the result i wanted
(There was some shadowing outside the dvdoverlay image that was cut off by the mask, if you applied the mask first)
(There was some shadowing outside the dvdoverlay image that was cut off by the mask, if you applied the mask first)
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Resize -> Crop -> Image Mask -> Merge Layers
kiwijunglist wrote:thanks, i switched the order of the commands (as above edited post) and i got the result i wanted
(There was some shadowing outside the dvdoverlay image that was cut off by the mask, if you applied the mask first)
OK. Glad you solved it.
-
- Posts: 14
- Joined: 2012-10-15T20:41:33-07:00
- Authentication code: 67789
Re: Resize -> Crop -> Image Mask -> Merge Layers
There is a small problem with the resize / crop in the first part of the command
convert poster.jpg -gravity center -crop 1000x1000+0+0 +repage result.jpg
What seems to be happening is it is croping a 1000x1000 centre part of the image, but what I really want is
Resize the width to 1000 pixels while maintaining the aspect ratio, and then center crop to 1000x1000 discarding part of the top + bottom of the image
see below
I'll try figure it out using those links you gave me
convert poster.jpg -gravity center -crop 1000x1000+0+0 +repage result.jpg
What seems to be happening is it is croping a 1000x1000 centre part of the image, but what I really want is
Resize the width to 1000 pixels while maintaining the aspect ratio, and then center crop to 1000x1000 discarding part of the top + bottom of the image
see below
I'll try figure it out using those links you gave me
-
- Posts: 14
- Joined: 2012-10-15T20:41:33-07:00
- Authentication code: 67789
Re: Resize -> Crop -> Image Mask -> Merge Layers
Unfortunately I wasn't able to figure out the code to do what I wanted...
however I figured out a cheat
Since all the movie posters have an aspect ratio of 0.667 If I resize to 1500x1500 then the width will be exactly 1000 pixels
convert poster.jpg -resize 1500x1500 ^ -gravity center -crop 1000x1000+0+0 +repage result.jpg
however I figured out a cheat
Since all the movie posters have an aspect ratio of 0.667 If I resize to 1500x1500 then the width will be exactly 1000 pixels
convert poster.jpg -resize 1500x1500 ^ -gravity center -crop 1000x1000+0+0 +repage result.jpg
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Resize -> Crop -> Image Mask -> Merge Layers
kiwijunglist wrote:Unfortunately I wasn't able to figure out the code to do what I wanted...
however I figured out a cheat
Since all the movie posters have an aspect ratio of 0.667 If I resize to 1500x1500 then the width will be exactly 1000 pixels
convert poster.jpg -resize 1500x1500 ^ -gravity center -crop 1000x1000+0+0 +repage result.jpg
convert poster.jpg -resize 1500x1500 ^ -gravity center -crop 1000x1000+0+0 +repage result.jpg
is exactly the correct command
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Resize -> Crop -> Image Mask -> Merge Layers
You want to not only crop the image but resize it too.
See thumbnails. Cut thumbnail to fit...
http://www.imagemagick.org/Usage/thumbnails/#cut
The trick here is to use a special flag for the resize to resize the smaller dimension rather than the larger.
(fit around the given size rather inside the given size).
See also resize, Fill Area Flag ('^' flag)
http://www.imagemagick.org/Usage/resize/#fill
NOTE there is NO space between the numbers and the flag! and under windows you need to double up that flag!
See thumbnails. Cut thumbnail to fit...
http://www.imagemagick.org/Usage/thumbnails/#cut
The trick here is to use a special flag for the resize to resize the smaller dimension rather than the larger.
(fit around the given size rather inside the given size).
See also resize, Fill Area Flag ('^' flag)
http://www.imagemagick.org/Usage/resize/#fill
NOTE there is NO space between the numbers and the flag! and under windows you need to double up that flag!
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Resize -> Crop -> Image Mask -> Merge Layers
Anthony is quite correct. I missed the space before the ^. Sorry about that. Also I was not aware of your being on Windows. So if that is so, there are syntax differences as Anthony points out. For more details seeNOTE there is NO space between the numbers and the flag! and under windows you need to double up that flag!
http://www.imagemagick.org/Usage/windows/