collage-like image
collage-like image
what i want to do is have IM generate a single image from a number of different source images into a fixed size (400x100) image result. sometimes sources will have transparency, sometimes not. they don't need to fit seamlessly like a puzzle. there will be some overlapping. I'll effect the images later once i get past this initial hurdle.
i've not had any luck using the examples in the documentation as a base. either the end size changes seemingly on a whim, or the positioning/size coordinates don't seem to react properly, or an images transparency throws the entire thing into black and i can't tell what i'm doing beyond that.
the seeming random transparency won't be that big of a deal as they're all png files and i plan on eventually using this in php with randomization of the source images. therefore, php can detect the png and change the options as needed.
so basically: 4 images (some transparent), placed on a fixed-size canvas, with the ability to filter a couple of the individual images. and oh btw: i'm perfectly fine with being directed in the right direction as opposed to a paste of working options.
i've not had any luck using the examples in the documentation as a base. either the end size changes seemingly on a whim, or the positioning/size coordinates don't seem to react properly, or an images transparency throws the entire thing into black and i can't tell what i'm doing beyond that.
the seeming random transparency won't be that big of a deal as they're all png files and i plan on eventually using this in php with randomization of the source images. therefore, php can detect the png and change the options as needed.
so basically: 4 images (some transparent), placed on a fixed-size canvas, with the ability to filter a couple of the individual images. and oh btw: i'm perfectly fine with being directed in the right direction as opposed to a paste of working options.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: collage-like image
post your images and your command line or a description of how you want them merged into one image. do you need the images to be labeled in any way? what other features do you need? there are a number of ways to combine your images into one large image!
Re: collage-like image
thanks for the reply (=
as far as how i want them merged, it's not complex... all i really want is layers working with positioning and then i will tweak it from there.
again, a working cmd line or 2 would be great, but a suggestion to the most flexible command (with a short example) would prob be better.
well . . . hm... most of the images are generally not the kind of thing that a 'general audience' forum would necessarily be the place for. here's 2 work-safe images (using them multiple times in an example won't be bumfuggling) but digging around is the viewers own fault, not mine.fmw42 wrote:post your images and your command line or a description of how you want them merged into one image.
Code: Select all
http://babble.cheggit.net/other/newsig/greetz_che.jpg
http://babble.cheggit.net/other/newsig/misc_smiley-sphere.png (transparency)
nope. just includedfmw42 wrote:do you need the images to be labeled in any way?
i plan on using a couple of effects, but i'd like to try and fig them out myself . . .fmw42 wrote:what other features do you need?
that's kinda what i gathered based on the docs. problem was that i couldn't seem to get them to work as desired. the biggest thing based on the example that used -page was the final size would change for seemingly no reason.fmw42 wrote:there are a number of ways to combine your images into one large image!
again, a working cmd line or 2 would be great, but a suggestion to the most flexible command (with a short example) would prob be better.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: collage-like image
http://babble.cheggit.net/other/newsig/greetz_che.jpg
http://babble.cheggit.net/other/newsig/ ... sphere.png (transparency)
as far as how i want them merged, it's not complex... all i really want is layers working with positioning and then i will tweak it from there.
I need more clear information about exactly what you want to do. How do you want them positioned. Can you make a sketch or explain in more detail.
Here is a simple append:
convert greetz.jpg smiley.png +append greetz_smiley_append.png
greetz.jpg
smiley.png
greetz_smiley_append.png
So I need more information about how this might not be what you want or what you want different?
By the way, might your problem be a simple case of your IM version being too old? Current version is 6.4.3-6.
identify -version
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: collage-like image
After finding the directory listing is not closed.. I am not surprised!well . . . hm... most of the images are generally not the kind of thing that a 'general audience' forum would necessarily be the place for.
Look at IM examples, Layering Imagesas far as how i want them merged, it's not complex... all i really want is layers working with positioning and then i will tweak it from there.
http://www.imagemagick.org/Usage/layers/
Which goes into the many methods of overlaying multiple images with user defined or programmed placements.
Especially the later advanced examples.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: collage-like image
Here are some php examples; the first one is doing more than you want but you should get the idea:
http://www.rubblewebs.co.uk/imagemagick ... mbined.jpg
Some more examples here: http://www.rubblewebs.co.uk./imagemagick/mosaic.php
http://www.rubblewebs.co.uk/imagemagick ... mbined.jpg
Some more examples here: http://www.rubblewebs.co.uk./imagemagick/mosaic.php
Re: collage-like image
bonzo, thanks for the link. one for the IM bookmark folder.
for example: the one that uses pages... lets just say i want to reduce the size of one of the images by 50%. the syntax for pages is . . . so based on that and a couple of other uses of -page and -geometry that i saw elsewhere, the proper setup is
but . . .
what's the ! token for? whats the % token for? is that % scaling? the definition of the -page command doesn't explicitly say. if it is % scaling should it be built as (as the syntax guide shows) or ? neither actually worked. (and as i'm looking at the preview for this message, i see a space in the syntax that i cant tell is there on the docs for -page. even so, the space in the syntax line doesn't jive with example use in the text of the item.)
anyway, where's are the definition for those tokens in the documentation? a "conventions" page in the documentation would have done the trick here. an app such as this could benefit from a manual in the style of php or mysql for example, with separated examples.
thank you, but your example is neither layered nor overlapping which i explained in the original post. once i see the positioning portion of the statements (basically how it works) i'll be able to tweak it from there. and yeah, i just installed IM a couple weeks ago.fmw42 wrote: So I need more information about how this might not be what you want or what you want different?
By the way, might your problem be a simple case of your IM version being too old? Current version is 6.4.3-6.
identify -version
yeah that was the page that did more damage than good to my learning process. there's several options on that page and they're not clearly defined enuf for me to extend the example into what i'm trying to accomplish.anthony wrote:Look at IM examples, Layering Images
http://www.imagemagick.org/Usage/layers/
Which goes into the many methods of overlaying multiple images with user defined or programmed placements.
Especially the later advanced examples.
for example: the one that uses pages... lets just say i want to reduce the size of one of the images by 50%. the syntax for pages is
Code: Select all
-page widthxheight{+-}x{+-} y{%}{!}{}{}
Code: Select all
-page 20x20 +10+5
what's the ! token for? whats the % token for? is that % scaling? the definition of the -page command doesn't explicitly say. if it is % scaling should it be built as
Code: Select all
+10+5%50
Code: Select all
+10+5 50%
anyway, where's are the definition for those tokens in the documentation? a "conventions" page in the documentation would have done the trick here. an app such as this could benefit from a manual in the style of php or mysql for example, with separated examples.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: collage-like image
fmw42 wrote:
So I need more information about how this might not be what you want or what you want different?
By the way, might your problem be a simple case of your IM version being too old? Current version is 6.4.3-6.
identify -version
thank you, but your example is neither layered nor overlapping which i explained in the original post. once i see the positioning portion of the statements (basically how it works) i'll be able to tweak it from there. and yeah, i just installed IM a couple weeks ago.
You never said anything about how much overlap or if that was necessary nor did you explain what you mean by layering? The image I produced has an alpha channel (layer). That was what I thought you meant. You provided 2 images whose total size will fit within 200x100 pixels. So it easily fits within 400x100. So there was no need to "overlap" whatever that means to you, nor "layer" whatever that means to you.
You need to be more explicit about what you need to happen. Please show a diagram of what you want or an example from somewhere else (as I asked before). Build it in Photoshop or some drawing program. If you cannot explain what you need, I don't think anyone will be able to help other than reference you to pages as Anthony did. If something on his pages is not clear, then ask a specific question. Just saying "overlapping and layered" does not mean much to anyone in terms of helping you get exactly what you need.
As far as ! and %, see -resize
! forces the resulting resize to be the exact size specified. % allows resizing by percent rather than pixels.
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: collage-like image
I would be glad to here what is unclear. IM examples are often written slowly piece by piece, and sometimes I don't get to see the forest for the trees. I get to close to the document. As such any external input or suggestions is always welcome.chiposaur wrote:yeah that was the page that did more damage than good to my learning process. there's several options on that page and they're not clearly defined enuf for me to extend the example into what i'm trying to accomplish.anthony wrote:Look at IM examples, Layering Images
http://www.imagemagick.org/Usage/layers/
Which goes into the many methods of overlaying multiple images with user defined or programmed placements.
Especially the later advanced examples.
-page is a bit is a strange option, that started as a method of specifying a canvas size for text:, ps: and pdf: documents. From this it evolved into a control for the the size and offset of the image on a larger 'virtual canavas'. That is it does not effect the image, only the layering settings for that image. The arguments should not contain spaces at all.for example: the one that uses pages... lets just say i want to reduce the size of one of the images by 50%. the syntax for pages is. . . so based on that and a couple of other uses of -page and -geometry that i saw elsewhere, the proper setup isCode: Select all
-page widthxheight{+-}x{+-} y{%}{!}{}{}
Code: Select all
-page 20x20 +10+5
As such the 20x20 sets the images virtual canvas size, which for layered images is usually ignored in any case (except for the final 'flatten' of the layers). It is not a image size control.
I have no idea what the '!' flag does for -page, though it does effect -repage. It may have been something that was used a long time in the past but has since been neglected.but . . .
what's the ! token for?
Again I have not see it used! but if a '%' flag is present it would only effect size, and not offset.whats the % token for? is that % scaling? the definition of the -page command doesn't explicitly say. if it is % scaling should it be built as(as the syntax guide shows) orCode: Select all
+10+5%50
? neither actually worked.Code: Select all
+10+5 50%
the Space should not be present. Though if the argument is in quotes it will probably just be ignored. I can not guarantee that however.(and as i'm looking at the preview for this message, i see a space in the syntax that i cant tell is there on the docs for -page. even so, the space in the syntax line doesn't jive with example use in the text of the item.)
I'll attempt to remove the space from the command-line-option reference document.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: collage-like image
as far as overlap i meant like this http://www.imagemagick.org/script/composite.php, where one source 'overlaps' another.fmw42 wrote:You never said anything about how much overlap or if that was necessary nor did you explain what you mean by layering? The image I produced has an alpha channel (layer). That was what I thought you meant. You provided 2 images whose total size will fit within 200x100 pixels. So it easily fits within 400x100. So there was no need to "overlap" whatever that means to you, nor "layer" whatever that means to you.
as far as layering, my original question had noth to do with layers. in the context tho, layering and overlapping are synonymous.
while simple overlapping is likely simple, the wrench in the works is the 24bit png transparency and the applying effects/filters to the various layers. some items have transparency (like the above smiley face) and some don't (like the other one) and i need to account for that. as far as positioning goes, i just need to see the syntax for positioning. i have a bunch of these images i need to build and the positioning will all be different.
thanks. ! = force to size? how does % fit into that? looking at -page again, there's no mention of how to use % or ! tho the lead to -resize explains that they are suffixes and not separate parameters as the brackets+spaces seem to depict in the parameter definition on -page.As far as ! and %, see -resize
! forces the resulting resize to be the exact size specified. % allows resizing by percent rather than pixels.
repeating definitions in the different entries of a reference IMO is essential even tho it may be redundant. granted my experience with im is small, and i zoomed at top speed to an old and underdocumented obscure feature, but it's a convention that i think will help. a section at the top of each definition devoted to the break down of symbology used in the syntax (yes i realize that's a shit-ton of tedium to revamp all the docs to something new) will aid self-sufficiency and likely save some support requests.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: collage-like image
Best I can suggest is study the
convert background foreground [mask] ... -geometry (or -gravity) ... -compose ... -composite examples at
http://www.imagemagick.org/Usage/compose/
There are various compose settings. Mostly -compose over will handle with or without transparency, but if no transparency, then one image will cover the other with the background not showing within the bounds of the foreground image. You can also use a grayscale mask to control the degree of transparency.
If you just want to blend two images, you can use:
composite ... -blend
see http://www.imagemagick.org/Usage/compose/#blend
-geometry allows you to specify where to place the overlaid image on the background image at any precise position and can resize as well
-gravity just places the foreground over the background at certain standard positions (center, sides, corners)
See:
http://www.imagemagick.org/Usage/resize/#geometry
http://www.imagemagick.org/script/comma ... p#geometry
http://www.imagemagick.org/script/comma ... hp#gravity
convert background foreground [mask] ... -geometry (or -gravity) ... -compose ... -composite examples at
http://www.imagemagick.org/Usage/compose/
There are various compose settings. Mostly -compose over will handle with or without transparency, but if no transparency, then one image will cover the other with the background not showing within the bounds of the foreground image. You can also use a grayscale mask to control the degree of transparency.
If you just want to blend two images, you can use:
composite ... -blend
see http://www.imagemagick.org/Usage/compose/#blend
-geometry allows you to specify where to place the overlaid image on the background image at any precise position and can resize as well
-gravity just places the foreground over the background at certain standard positions (center, sides, corners)
See:
http://www.imagemagick.org/Usage/resize/#geometry
http://www.imagemagick.org/script/comma ... p#geometry
http://www.imagemagick.org/script/comma ... hp#gravity
Re: collage-like image
that actually looks like the ticket . . . i'll use those examples and see what falls out
thanks for your help!
thanks for your help!