Last active
December 14, 2015 08:49
-
-
Save shamrin/5060209 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy | |
# source data | |
a = numpy.ones(4000000, dtype=numpy.uint8).reshape((2000,2000)) | |
# make gray RGB image | |
g = numpy.empty((2000,2000,3)) | |
g[...] = a[..., numpy.newaxis] | |
# make image width divisable by 4 | |
width = g.shape[1] | |
pad = -width % 4 | |
r = numpy.lib.pad(g, ((0,0), (0,pad), (0,0)), 'constant') # SLOW! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment