diff --git a/2020/sketch_2020_11_10reduce_images/data/moonwalk.jpg b/2020/sketch_2020_11_10reduce_images/data/moonwalk.jpg new file mode 100644 index 00000000..793781a3 Binary files /dev/null and b/2020/sketch_2020_11_10reduce_images/data/moonwalk.jpg differ diff --git a/2020/sketch_2020_11_10reduce_images/sketch_2020_11_10reduce_images.gif b/2020/sketch_2020_11_10reduce_images/sketch_2020_11_10reduce_images.gif new file mode 100644 index 00000000..dbbd8086 Binary files /dev/null and b/2020/sketch_2020_11_10reduce_images/sketch_2020_11_10reduce_images.gif differ diff --git a/2020/sketch_2020_11_10reduce_images/sketch_2020_11_10reduce_images.pyde b/2020/sketch_2020_11_10reduce_images/sketch_2020_11_10reduce_images.pyde new file mode 100644 index 00000000..03f2685c --- /dev/null +++ b/2020/sketch_2020_11_10reduce_images/sketch_2020_11_10reduce_images.pyde @@ -0,0 +1,24 @@ + +def setup(): + size(640, 360) + # The image file must be in the data folder of + # the current sketch to load successfully. + global img + img = loadImage("moonwalk.jpg") # Load the image into the programr + +def draw(): + background(255, 0, 0) + image(img, 0, 0) + + +def reduce_image(img, factor): + rimg = createGraphics(int(img.width * factor), int(img.height * factor)) + rimg.beginDraw() + rimg.image(img, 0, 0, img.width * factor, img.height * factor) + rimg.endDraw() + return rimg + +def keyPressed(): + global img + if key == 'r': + img = reduce_image(img, .9) diff --git a/README.md b/README.md index ce2a8c23..97e856e6 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,12 @@ Here are listed some of the tools I have been using: --- +![sketch_2020_11_10reduce_images](2020/sketch_2020_11_10reduce_images/sketch_2020_11_10reduce_images.gif) + +[sketch_2020_11_10reduce_images](https://github.com/villares/sketch-a-day/tree/master/2020/sketch_2020_11_10reduce_images) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)] + +--- + ![sketch_2020_11_09arcs_for_pyp5js](2020/sketch_2020_11_09arcs_for_pyp5js/sketch_2020_11_09arcs_for_pyp5js.jpg) [sketch_2020_11_09arcs_for_pyp5js](https://github.com/villares/sketch-a-day/tree/master/2020/sketch_2020_11_09arcs_for_pyp5js) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)] @@ -38,7 +44,7 @@ Here are listed some of the tools I have been using: --- -![sketch_2020_11_07](2020/sketch_2020_11_07/sketch_2020_11_07.gif) +![sketch_2020_11_07a](2020/sketch_2020_11_07a/sketch_2020_11_07a.gif) [sketch_2020_11_07](https://github.com/villares/sketch-a-day/tree/master/2020/sketch_2020_11_07) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)]