WITHDRAWN:
I think this is just my misunderstanding about flattening with each image having transparency and thus needing to set the background from its default white to transparent. If the mike image was not smaller than 800x600, the -size 800x600 xc:none would not be needed. The frame [1] has a virtual offset, but its size is smaller than 800x600.
________________________________
IM 6.6.9.9 Q16 Mac OSX Tiger
Perhaps I misunderstand, but seems that this should work (according to http://www.imagemagick.org/Usage/layers/#flatten) giving a transparent background since mike.psd[1] has a transparent background, but it comes out white.
Source image:
http://www.fmwconcepts.com/misc_tests/f ... s/mike.psd
convert -size 800x600 xc:none mike.psd[1] -flatten PNG32:mike_tmp1.png
However, adding -background none, which seems redundant with xc:none makes it work.
convert -size 800x600 xc:none -background none mike.psd[1] -flatten PNG32:mike_tmp2.png
WITHDRAWN: possible bug -flatten IM 6.6.9.9 Q16
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Flatten Handing in IM
The action is correct. xc:none does not set background color which is what -flatten uses to define the base canvas.
if xc: color is opaque then of course the background color will not be visible.
However. Rather than add -size 800x600 xc:{color} you can do the following to set canvas sizeg
It has the exact same result, and uses one less 'composition overlay, and image creation, as it only uses IM's internal canvas generator image. the -repage WxH does not modify virtual offset as you have not specified an offset ,just sets the virtual canvas size.
FUTURE: a new type of flatten that ONLY uses the first canvas as destination (background is not used). This will not expand that first image, not even filling that image out to its virtual canvas, so all later overlays will become clipped to the bounds of that first image. This would make multi-image mathematical composes (and especially minus_src as you subtract from first image) easier as you do not have to worry about the background canvas.
Name suggestions? Something that is at least better than "-layers flatten_no_background"!
How about "-layers combine" or "-layers overlay"
if xc: color is opaque then of course the background color will not be visible.
However. Rather than add -size 800x600 xc:{color} you can do the following to set canvas size
Code: Select all
convert mike.psd[1] -repage 800x600 -background {color} -flatten PNG32:mike_tmp.pn
It has the exact same result, and uses one less 'composition overlay, and image creation, as it only uses IM's internal canvas generator image. the -repage WxH does not modify virtual offset as you have not specified an offset ,just sets the virtual canvas size.
FUTURE: a new type of flatten that ONLY uses the first canvas as destination (background is not used). This will not expand that first image, not even filling that image out to its virtual canvas, so all later overlays will become clipped to the bounds of that first image. This would make multi-image mathematical composes (and especially minus_src as you subtract from first image) easier as you do not have to worry about the background canvas.
Name suggestions? Something that is at least better than "-layers flatten_no_background"!
How about "-layers combine" or "-layers overlay"
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: WITHDRAWN: possible bug -flatten IM 6.6.9.9 Q16
-layers combine sounds good and simple.Name suggestions? Something that is at least better than "-layers flatten_no_background"!
How about "-layers combine" or "-layers overlay"
-layers compact might be another possibility and perhaps a better name?
Fred
P.S.
I withdrew the bug report as I realized just what you had said. And indeed
convert mike.psd[1] -repage 800x600 -background {color} -flatten PNG32:mike_tmp.png
works well also. I was afraid that it would reset the virtual canvas offsets in mike.psd[1] so had not tried that. But it does work and is indeed a simpler solution. Thanks. Learned something new today.
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: WITHDRAWN: possible bug -flatten IM 6.6.9.9 Q16
I have added it to my ToDo (minor fixes), but it should be a simple addition.
Hmmm applying that operator to just two images would actually be equivalent to -composite but using canvas offsets rather than geometry/gravity.
Very busy with real world problems at the moment (repairs to rental properity).
In IMv7 I will be also pushing for
Full separation of gravity and justification (in labels that means you can center left aligned text
Replace the use of -page/-repage as canvas/offset control. Restore -page to purely postscript/PDF/text: control. I like to replace it with an option like -canvas Any thoughts welcome.
Hmmm applying that operator to just two images would actually be equivalent to -composite but using canvas offsets rather than geometry/gravity.
Very busy with real world problems at the moment (repairs to rental properity).
In IMv7 I will be also pushing for
Full separation of gravity and justification (in labels that means you can center left aligned text
Replace the use of -page/-repage as canvas/offset control. Restore -page to purely postscript/PDF/text: control. I like to replace it with an option like -canvas Any thoughts welcome.
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: WITHDRAWN: possible bug -flatten IM 6.6.9.9 Q16
Whatever you call it and whatever you decide about -page vs -canvas, I would still like to see it be gravity sensitive at least for this method. In otherwords, at least one method that is like a multi-image composite.Name suggestions? Something that is at least better than "-layers flatten_no_background"!
How about "-layers combine" or "-layers overlay"
P.S. I don't know enough about -page usage in two different ways. But if you feel it is important to separate, then use -canvas.