Skip to content

add recolor to make Pop Art#108

Open
beartung wants to merge 6 commits intoemcconville:masterfrom
beartung:master
Open

add recolor to make Pop Art#108
beartung wants to merge 6 commits intoemcconville:masterfrom
beartung:master

Conversation

@beartung
Copy link
Copy Markdown
Contributor

@beartung beartung commented May 3, 2013

I want to make a pop art photo with wand, but not found any function to manipulate pixels.

The example is here: https://github.com/beartung/pop_art_wand

looks like this:

test_1886982_dec

@beartung
Copy link
Copy Markdown
Contributor Author

beartung commented May 3, 2013

@dahlia is imagemagick thread safe? If so, I can make a parrel version to do this to faster.

@beartung beartung mentioned this pull request May 3, 2013
@dahlia
Copy link
Copy Markdown
Collaborator

dahlia commented May 3, 2013

Thanks for your efforts. The most things are fine, but…

  • Why is color_func optional? (It even does nothing when color_func is None.)
  • **kwargs seem unnecessary. You can bind fixed arguments to color_func using functools.partial().
  • It would be better if color_func returns a Color instead of a string.
  • Check to make sure color_func is callable. Raise TypeError otherwise.

@dahlia is imagemagick thread safe? If so, I can make a parrel version to do this to faster.

On Mac at least it’s not thread safe.

wand/image.py Outdated
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we don’t need to check not color_func. ;-)

@dahlia
Copy link
Copy Markdown
Collaborator

dahlia commented May 3, 2013

Adjustments are find! Could you write some docstring for this method?

@beartung
Copy link
Copy Markdown
Contributor Author

beartung commented May 3, 2013

😰

@dahlia
Copy link
Copy Markdown
Collaborator

dahlia commented May 3, 2013

It takes very long time for me… how can we improve its performance?

@beartung
Copy link
Copy Markdown
Contributor Author

beartung commented May 4, 2013

en... better but not enough, I am working on a c version 😟

@beartung
Copy link
Copy Markdown
Contributor Author

beartung commented May 7, 2013

@dahlia I have test the c version, only about 2 seconds to dispose of 2102x2102 jpg

using this code:

view = NewWandView(wand);
if (view == (WandView *) NULL) ThrowWandException(wand);
status = UpdateWandViewIterator(view, recolor, (void *)NULL);
if (status == MagickFalse) ThrowWandException(wand);
view = DestroyWandView(view);

full code https://github.com/beartung/pop_art_wand/blob/master/pop_art.c

I will try this method in python later...

@dahlia
Copy link
Copy Markdown
Collaborator

dahlia commented Jun 23, 2013

We will go to CFFI from ctypes, and then this part could be written in C.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants