warrenweckesser / numpngw Goto Github PK
View Code? Open in Web Editor NEWFunctions that create PNG and animated PNG files from numpy arrays.
License: BSD 2-Clause "Simplified" License
Functions that create PNG and animated PNG files from numpy arrays.
License: BSD 2-Clause "Simplified" License
With python 3.4 and numpy 1.9.1, the file example1.png
that is created by example1.py
has "speckles" in the colored gradient bands. The speckles are not constant along the columns. Very strange.
python setup.py sdist bdist_wheel --universal
twine upload dist/*
Is it possible to install this package using pip?
The APNG is a fairly simple extension of the PNG format, so it shouldn't take much work to create a function that writes a sequence of numpy arrays to an APNG file.
I pretty much copied one of the examples:
numpngw.write_apng(NAME+'.png', frames, delay=50, use_palette=False)
but have no idea what delay=50
is.
I noticed that on one video of Federer and Nishikori rallying at the US Open, when I use this to put together a series of frames with numerically ascending names, it inserts random frames here and there. It works fine with a series of frames of a burning candle and another one of a figure skater spinning.
ValueError: The arrays have a total of 44851 colors. With bit depth 8, no more than 256 colors are allowed when using a palette.
I have no idea what this means. My code:
import cv2
import numpy
import numpngw
frames = []
count = 0
while True:
if count < 10:
frame = cv2.imread("frame000"+str(count)+".png")
frames.append(frame)
elif count >=10:
frame = cv2.imread("frame00"+str(count)+".png")
if frame is None:
break
else:
frames.append(frame)
count += 1
numpngw.write_apng('candle.png', frames, delay=50, use_palette=True)
It could be useful for write_png
to return information about the PNG file that it created. In particular, it might be useful to know the palette that was created when the option use_palette=True
is given.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.