

GetAvgRGB() calculates the average RGB-value of the entire image, and therefore must access every pixel of the image that it's called on. When an ImageInfo object is initialized, it calls getAvgRGB() on the image that was used to initialize it. The program saves this this information in a list of ImageInfo objects called littleImgs, a light-weight class I defined for holding an image's name, dimensions, and average RGB-value. This is accomplished by first calculating the average RGB-value of every image in the "emoji/" directory. Also, the final image will be ten times the size, and comprised of miniature images that are forty pixels wide.
Would make a photo-mosaic of the image at the path "emoji/1f42a.png" using the images in the directory "emoji/", and save it as "camel.png" in the current directory. " $ python remoji.py -s emoji/1f42a.png emoji/ camel.png 10 40" This option takes a starting image, a directory name followed by "/", a name to output the image to, a scale, and a depth (tile resolution in pixels) to create a single photo-mosaic image from the image library specified by. "$ ffmpeg -r 30 -i mov/anim%04d.png -vb 20000k -c:v libx264 -pix_fmt yuv420p movie.mp4" Make a single photo-mosaic image: MakeAnim # Make the final animation, combine s1 followed by s2 for the final outputĪfter this command finishes, use this ffmpeg command to compress the output frames into a video: (0, 0, 0) (255, 0, 255) 15 # These 150 frames use the input video "mp4s/stripes.MP4, start with a color-limited gradient of emojis between (0,0,0) (255,0,255) with 15 steps inbetween the two colors, and through the 150 frames, gradually change the available color gradient to (0,0,0) (0,255,255). Sequence s2 (spec) emoji/ 0 # Make Sequence class of "spectrum" type, use directory "emoji/" for whole sequence Gifs win/ # For the next 150 frames of the input video, use the image directory "win/" instead of emojiġ50 1 80 5 # Again use speed of 1 frame / input video frame, but this time start at an icon width of ~80px, and gradually shrink to an icon width of ~5px through the 150 frames Use the directory of images "emoji/" for the icon set to use for the photo-mosaic video over these frames.ġ50 1 120 # These 150 frames move at a speed of 1 frame / input video frame, and the icon width throughout this segment is ~120px Gifs emoji/ # Use input video mp4s/gifs.MP4 for next 150 frames. Sequence s1 (mos) 0 # Make Sequence class of "mosaic" type named "s1." starts at frame 0 from input video segment (which is 0-10s as declared in the command line args) This command uses the supplied input video from second 0, to second 10, and the instructions file ins/test.txt, which should read something like this (all tabs, no spaces): Use this command to make a photo-mosaic video, where the output frames are saved as mov/anim0001.png, mov/anim0002.png, etc. " $ python remoji.py -v -p mov/ ins/test.txt 0 10"
#Making photo mosaic code
Also, the code itself is generally pretty well commented, and I would encourage anyone interested in the programming side of this project to check out my actual Python source files in this repository Usage: Making a photo-mosaic video: This project is a work in progress so this read-me may not be entirely up-to-date all the time, but hopefully this should help people to start to understand how this code works. This read-me will cover the current command line options, how they work, and measures that were taken to make them run faster.
#Making photo mosaic mp4
It utilizes PIL's Image module, the ImageDraw module, the multiprocessing module, ImageMagick, and ffmpeg for procedural image/frame modification, pixel-by-pixel RGB-value analysis, RGB-value averaging, color compression, RGB-value distance analysis, image segment replacement, 1D and 2D gradient creation, image synthesis parallelization, and HD mp4 video compression. It is a Python-based command line photo-mosaic mp4 re-animator and image synthesizer with several features and options for image modification and performance optimization.

I made this tool for making videos like this.
