Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running on Mac OSX #7

Open
ryangrush opened this issue Mar 8, 2013 · 8 comments
Open

Running on Mac OSX #7

ryangrush opened this issue Mar 8, 2013 · 8 comments

Comments

@ryangrush
Copy link

I would like to get this working on my mac but it looks to have trouble on a non-Ubuntu machine. Forgive my ignorance but is there a good recipe to get this working. Maybe install the dependencies via Homebrew or MacPorts?

@dhilowitz
Copy link

Here's what I did:

sudo port install pngcrush
sudo port install opencv +python26
sudo port install py26-wxpython py26-numpy py26-matplotlib
sudo port install py26-scipy py26-ipython
sudo port select --set ipython ipython26
sudo port install py26-pil

Hope this helps!

--David

@lilith
Copy link

lilith commented Mar 18, 2013

This should be the rough equivalent with Homebrew (I'm on x64 Mountain Lion, so YMMV).

Note: gfortran is needed to build all of scipy, and freetype is needed to install matplotlib

brew install python
brew install gfortran pkg-config freetype
pip install numpy ipython scipy pil
pip install matplotlib
brew install --python wxmac --devel
brew install opencv
brew install pngcrush

The OpenCV Python module will not work until you edit your PYTHONPATH like so:
export PYTHONPATH="/usr/local/lib/python2.7/site-packages:$PYTHONPATH"

@lilith
Copy link

lilith commented Mar 18, 2013

Here's a good article on getting the basics installed: http://www.lowindata.com/2013/installing-scientific-python-on-mac-os-x/

@tjramage
Copy link

Hi guys,

I'm running OS X 10.8.5 - trying to get this working also. The example screenshots seem to work fine - I can run the python script and it generates a packed PNG sprite and the relevant JS timeline. However, as soon as I point it to my own folder with some test PNGs, I keep getting this error:

ValueError: could not broadcast input array from shape (562,980,4) into shape (562,980,3)

Can anyone help or at least point me in the right direction? Thanks!

@vanyossi
Copy link

@tjramage I had the same problem. To me it triggers when one of the images has an alpha channel, or palette information. I had to strip all that before using the images. also images must be the same exact size wxh

With image imagemagick I did
mogrify input.png -strip -define png:format=png24 PNG24:input.png

@tjramage
Copy link

GENIUS! @vanyossi - that's fantastic, works like a charm now! Thanks :)

@umaar
Copy link

umaar commented Dec 11, 2013

@tjramage did you solve the black screen issue?

@beefcheeks
Copy link

beefcheeks commented Oct 25, 2016

Hey everyone,

It looks like it's been awhile since this issue has been updated, and I had some trouble getting the anim_encoder to work on my MacOS Sierra machine. I did figure out the steps, but it took me awhile. Thought it might be helpful to have these steps available for other folks.

EDIT: fixed the steps below to include more detail. I've also updated the instructions to use my fork instead of merging commits yourself.

brew install python
# Add brew path to bash_profile if not already present
echo "export PATH=/usr/local/bin:$PATH" >> ~/.bash_profile
source ~/.bash_profile
# virtualenv steps below recommended but not required
pip install virtualenv virtualenvwrapper
echo "source /usr/local/bin/virtualenvwrapper.sh" >> ~/.bash_profile
source ~/.bash_profile
mkvirtualenv anim_encoder
# Install dependencies
pip install numpy
brew install gcc
pip install scipy
# Install PIL
pip install http://effbot.org/media/downloads/Imaging-1.1.7.tar.gz
brew tap homebrew/science && brew install —HEAD opencv3
brew install libpng libjpeg pygtk pngcrush
# Commands directly below required for virtualenv users only (parts of the paths below may be different for you)
cp /usr/local/Cellar/opencv3/HEAD-2038434_4/lib/python2.7/site-packages/cv2.so ~/.virtualenvs/anim_encoder/lib/python2.7/site-packages/.
workon anim_encoder
# Clone this repo and enter the directory
git clone https://github.com/baronomasia/anim_encoder
cd anim_encoder

EDIT: To switch between virtualenv python environments using the wrapper, use workon <env name>
EDIT: Removed merging instructions, use my fork instead.
With this fork, you can designate a specific area of the screen to capture by editing the screencapture line in capture.py below:

        os.system("screencapture -x -R0,0,800,450 capture/screenshot_" + str(int(round(time.time()*1000))) + ".png")

where R0,0 is the horizontal and vertical offset, and 800,450 is the area captured.

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

No branches or pull requests

7 participants