Advise please: Join -> Overlay -> Flatten -> Split again ?
Advise please: Join -> Overlay -> Flatten -> Split again ?
Hello ImageMagick gurus... I need some help please...
I have 4 jpeg images in a base layer as follows:
- 100x100 pixels: top_left.jpg
- 100x100 pixels: top_right.jpg
- 100x100 pixels: bottom_left.jpg
- 100x100 pixels: bottom_right.jpg
I have 2 transparent png's in 2 layers above:
- 200x200 pixels: overlay1.png
- 200x200 pixels: overlay2.png
I want to overlay the 2 transparent png images across the top of the 4 joined jpeg images and save the result as 4 jpegs again. Preferably using a single command with quality options too.
I'm faffing around like a crisp packet in the wind trying to do this. Please help.
I'm using the command line tools on a mac by the way.
Thanks for any help or pointers.
I have 4 jpeg images in a base layer as follows:
- 100x100 pixels: top_left.jpg
- 100x100 pixels: top_right.jpg
- 100x100 pixels: bottom_left.jpg
- 100x100 pixels: bottom_right.jpg
I have 2 transparent png's in 2 layers above:
- 200x200 pixels: overlay1.png
- 200x200 pixels: overlay2.png
I want to overlay the 2 transparent png images across the top of the 4 joined jpeg images and save the result as 4 jpegs again. Preferably using a single command with quality options too.
I'm faffing around like a crisp packet in the wind trying to do this. Please help.
I'm using the command line tools on a mac by the way.
Thanks for any help or pointers.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Advise please: Join -> Overlay -> Flatten -> Split again ?
I don't understand "and save the result as 4 jpegs again". 4 different jpegs? Just different qualities, or showing different things?
Anyhow, it might be something like this, untested, Windows syntax:
For Unix, use \ instead of ^.
Anyhow, it might be something like this, untested, Windows syntax:
Code: Select all
convert ^
( top-left.jpg top-right.jpg +append ) ^
( bottom-left.jpg bottom-right.jpg +append ) ^
-append ^
overlay1.png -composite ^
overlay2.png -composite ^
-quality 50 +write out1.jpg ^
-quality 60 +write out2.jpg ^
-quality 70 +write out3.jpg ^
-quality 80 +write out4.jpg ^
null:
snibgo's IM pages: im.snibgo.com
Re: Advise please: Join -> Overlay -> Flatten -> Split again ?
Sorry for the lack of clarity in my question snibgo - actually, output files will need to overwrite the original 4 jpegs.
Thanks very much for giving me the example code - it's taking me a while to get my head around the CLI syntax. I need to go and play with this.
Kind Regards,
Jez
Thanks very much for giving me the example code - it's taking me a while to get my head around the CLI syntax. I need to go and play with this.
Kind Regards,
Jez
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Advise please: Join -> Overlay -> Flatten -> Split again ?
If you want to divide the output into 4 equal tiles, "-crop 2x2@" will do that. But I don't see why you want to append images, then chop them up again.
snibgo's IM pages: im.snibgo.com
Re: Advise please: Join -> Overlay -> Flatten -> Split again ?
Again, sorry Snibgo for not doing a great job of explaining my problem. Hopefully this will help...snibgo wrote:If you want to divide the output into 4 equal tiles, "-crop 2x2@" will do that. But I don't see why you want to append images, then chop them up again.
https://www.dropbox.com/s/xxx8ol7yziwrh ... e.png?dl=0
Starting with the four corner png's, I want to overlay 2 bigger png's and save to 4 new corner jpegs.
I'll need to down-sample the overlays too if this is possible in one go?
Is all this possible in one go?
Many thanks.
Re: Advise please: Join -> Overlay -> Flatten -> Split again ?
Trying to post an image here to explain my task. Preview not showing, but hopefully posting will show it.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Advise please: Join -> Overlay -> Flatten -> Split again ?
For the lines ...
... you could have ...
where A, B, C and D are whatever you need. See http://www.imagemagick.org/script/comma ... php#resize
You could also add shadows, but get the basics working first.
Code: Select all
overlay1.png -composite ^
overlay2.png -composite ^
Code: Select all
( overlay1.png -resize AxB ) -composite ^
( overlay2.png -resize CxD ) -composite ^
You could also add shadows, but get the basics working first.
snibgo's IM pages: im.snibgo.com
Re: Advise please: Join -> Overlay -> Flatten -> Split again ?
hi snibgo, the following gives me 4 new jpegs which contain the same pixels as overlay2.png
convert \
\( top-left.png top-right.png +append \) \
\( bottom-left.png bottom-right.png +append \) \
-append \
overlay1.png -composite \
overlay2.png -composite \
-quality 50 +write out1.jpg \
-quality 60 +write out2.jpg \
-quality 70 +write out3.jpg \
-quality 80 +write out4.jpg \
null:
Do I need another append somewhere?
I hope this image explains my intention, and yes, I can do drop shadows once I've got the basics...
Many Thanks,
Jez
convert \
\( top-left.png top-right.png +append \) \
\( bottom-left.png bottom-right.png +append \) \
-append \
overlay1.png -composite \
overlay2.png -composite \
-quality 50 +write out1.jpg \
-quality 60 +write out2.jpg \
-quality 70 +write out3.jpg \
-quality 80 +write out4.jpg \
null:
Do I need another append somewhere?
I hope this image explains my intention, and yes, I can do drop shadows once I've got the basics...
Many Thanks,
Jez
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Advise please: Join -> Overlay -> Flatten -> Split again ?
As I said upthread, "-crop 2x2@" will divide the image into 4 equal tiles.
This should make out_00.jpg, out_01.jpg etc.
(But don't use JPEGs unless you really have to.)
Code: Select all
convert \
\( top-left.png top-right.png +append \) \
\( bottom-left.png bottom-right.png +append \) \
-append \
overlay1.png -composite \
overlay2.png -composite \
-crop 2x2@ ^
-quality 50 +write out_%02.jpg \
null:
(But don't use JPEGs unless you really have to.)
snibgo's IM pages: im.snibgo.com
Re: Advise please: Join -> Overlay -> Flatten -> Split again ?
Very nice - getting real close now! Thanks snibgo!
Is it possible to specify each of the output filenames separately?
Is is possible to scale one of the overlay images as part of this same command?
Is it possible to specify each of the output filenames separately?
Is is possible to scale one of the overlay images as part of this same command?
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Advise please: Join -> Overlay -> Flatten -> Split again ?
For scaling, like I said upthread. See my post starting "For the lines ..."
For specifying four different output names, yes, it can be done in IM, but it's a bit messy (using clone, write, delete). I would rename in the script.
For specifying four different output names, yes, it can be done in IM, but it's a bit messy (using clone, write, delete). I would rename in the script.
snibgo's IM pages: im.snibgo.com
Re: Advise please: Join -> Overlay -> Flatten -> Split again ?
Perfect. Many thanks for your help snibgo - the script and advise above has really helped me.