Re: Mask two images with python

2018-12-23 Thread Umar Yusuf
On Wednesday, 19 December 2018 06:36:01 UTC+1, Umar Yusuf  wrote:
> Hello there,
> How do I supper impose an image design on a transparent png image?
> 
> I have tried to use OpenCV's "cv2.bitwise_and" function to no success. I 
> posted the detail question here: 
> https://stackoverflow.com/questions/53791510/python-opencv-mask-and-glow
> 
> Thank you for your time.



Sorry for my bad explanation... I just don't know how to put this in image 
processing terms.

Anyway, I decided to give pillow module a look and its paste() method came 
close to what I wanted. So, have re-explain and posted it as new question here: 
https://stackoverflow.com/questions/53903607/overlay-pattern-image-on-exact-portion-of-png-image-with-python


Thank you


-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Mask two images with python

2018-12-21 Thread ant
Umar Yusuf wrote:
...
> Hello Oscar,
> Thank you for your time.. Here is attached is an example set of the images: 
> https://drive.google.com/file/d/1hyiWswx4GCZQDepXZjktq2zgM_LBbxXt/view?usp=sharing
>  basically, it is "design + mask and glow = result"

  that didn't work for me at all...

  are the images .png or some other format that
allows transparency?

  is it critical that it be done via Python or do you
just want it done at all?  :)

  gimp and other tools (Graphics Magic) will allow 
this to be done interactively or via the command 
line.

  if it has to be done in python i'm only familiar
with pyglet and could do it easily enough that way
(sorry i'm a newbie about other ways in python :) ).

make a sprite in a certain location in a window with
the background image and then make another sprite with
the next layer on top of that one, one at a time, each
with it's own batch id.

then when it appears how you like it you can grab a
screen shot via:


The following example shows how to grab a screenshot of your application window:

pyglet.image.get_buffer_manager().get_color_buffer().save('screenshot.png')

Note that images can only be saved in the PNG format unless the Pillow library 
is installed.
=

  if you want an example of multiple layers i have
my work in progress that does exactly this sort of 
thing (except i never save an image yet - that could
be easily added as above).  you're welcome to take
the code and use it however you like:


  https://salsa.debian.org/ant-guest/gfpoken-in-python


  ant
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Mask two images with python

2018-12-21 Thread Oscar Benjamin
On Fri, 21 Dec 2018 at 09:32, Umar Yusuf  wrote:
>
> On Wednesday, 19 December 2018 19:22:51 UTC+1, Oscar Benjamin  wrote:
> > On Wed, 19 Dec 2018 at 05:42, Umar Yusuf  wrote:
> > >
> > > Hello there,
> > > How do I supper impose an image design on a transparent png image?
> > >
> > > I have tried to use OpenCV's "cv2.bitwise_and" function to no success. I 
> > > posted the detail question here: 
> > > https://stackoverflow.com/questions/53791510/python-opencv-mask-and-glow
> >
> > I don't understand what you're trying to do. Can you show example
> > input and desired output with example numbers? E.g.:
> >
> > mask = [
> > [0, 0, 0, 0],
> > [0, 1, 1, 0],
> > ...
> > ]
> >
> > image = [
> > [12, 32, 45, 56],
> > ...
> >
> > expected_output = ?
>
> Hello Oscar,
> Thank you for your time.. Here is attached is an example set of the images: 
> https://drive.google.com/file/d/1hyiWswx4GCZQDepXZjktq2zgM_LBbxXt/view?usp=sharing
>  basically, it is "design + mask and glow = result"

The reason your question hasn't been answered yet either here or on
StackOverflow is because you need to to take more time to explain it
better. I have suggested above a way to explain it better. If you can
show a clear example of what the input and output pixels are supposed
to be then I'm sure that someone would be able to say how to do it.

>From your description I don't understand unambiguously what you're
trying to do though.

--
Oscar
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Mask two images with python

2018-12-21 Thread Umar Yusuf
On Wednesday, 19 December 2018 19:22:51 UTC+1, Oscar Benjamin  wrote:
> On Wed, 19 Dec 2018 at 05:42, Umar Yusuf  wrote:
> >
> > Hello there,
> > How do I supper impose an image design on a transparent png image?
> >
> > I have tried to use OpenCV's "cv2.bitwise_and" function to no success. I 
> > posted the detail question here: 
> > https://stackoverflow.com/questions/53791510/python-opencv-mask-and-glow
> 
> I don't understand what you're trying to do. Can you show example
> input and desired output with example numbers? E.g.:
> 
> mask = [
> [0, 0, 0, 0],
> [0, 1, 1, 0],
> ...
> ]
> 
> image = [
> [12, 32, 45, 56],
> ...
> 
> expected_output = ?
> 
> --
> Oscar


Hello Oscar,
Thank you for your time.. Here is attached is an example set of the images: 
https://drive.google.com/file/d/1hyiWswx4GCZQDepXZjktq2zgM_LBbxXt/view?usp=sharing
 basically, it is "design + mask and glow = result"




-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Mask two images with python

2018-12-19 Thread Oscar Benjamin
On Wed, 19 Dec 2018 at 05:42, Umar Yusuf  wrote:
>
> Hello there,
> How do I supper impose an image design on a transparent png image?
>
> I have tried to use OpenCV's "cv2.bitwise_and" function to no success. I 
> posted the detail question here: 
> https://stackoverflow.com/questions/53791510/python-opencv-mask-and-glow

I don't understand what you're trying to do. Can you show example
input and desired output with example numbers? E.g.:

mask = [
[0, 0, 0, 0],
[0, 1, 1, 0],
...
]

image = [
[12, 32, 45, 56],
...

expected_output = ?

--
Oscar
-- 
https://mail.python.org/mailman/listinfo/python-list