Stretching saturation makes the original image melt and burning

A cat image manipulated with the Processing programming code.

Image manipulation example with the image from 'Gray Cat Looking Up'.
https://www.pexels.com/photo/adorable-animal-cat-cat-s-eyes-208878/

 

A cat image manipulated with the Processing programming code.

Image manipulation example with the image from 'Fat Cat with Greens in Sunbeam'.
http://www.photos-public-domain.com/2010/08/28/fat-cat-with-greens-in-sunbeam/

 

Description of this image manipulation work.

An image manipulation type creative coding work made with the 'Processing'.

It stretches saturation and makes the image melting and burning.
It's more psychedelic than Psychedelicat, isn't it?

 

You can use your own photo.

You can hard coding the path of your photo image file or you can give command line parameter like this.

/your_processing_installed_path/processing-java --force --sketch=/your_sketch_path/ --run /your_photo_file_path

This code does not display any images on the screen but generates image files in frames directory.







 

'Processing' code example.

Please feel free to use this example code under the terms of the GPL. To see other works based on my code is my pleasure. And my honor.

// Gleameow.
// @author @deconbatch
// @version 0.2
// Processing 3.2.1
// 0.1 2017.10.07
// 0.2 2018.12.23

/* ---------------------------------------------------------------------- */
abstract class PshapeElement {

  PShape anElement;
  float elementColor, elementSaturation, elementBright, elementAlpha;
  
  PshapeElement() {
    anElement = pscreateElement();
    elementColor = 0;
    elementSaturation = 0;
    elementBright = 0;
    elementAlpha = 0;
  }

  abstract PShape pscreateElement();

  void setElementFill(float pcolor, float psaturation, float pbright, float palpha) {
    elementColor = pcolor;
    elementSaturation = psaturation;
    elementBright = pbright;
    elementAlpha = palpha;
    resetColor();
  }

  void resetColor() {
    anElement.setFill(color(elementColor, elementSaturation, elementBright, elementAlpha));
  }

  void changeColor(float scolor) {
    elementColor = scolor;
    resetColor();
  }

  void changeBright(float sbright) {
    elementBright = sbright;
    resetColor();
  }

  void resetSize() {
    anElement.resetMatrix();
  }

  void changeSize(float scaleX, float scaleY) {
    anElement.scale(scaleX, scaleY);
  }

  void rotate(float radX) {
    anElement.rotate(radX);
  }

  void show() {
    shape(anElement);
  }

}

/* ---------------------------------------------------------------------- */
class BoxBrush extends PshapeElement {

  
  BoxBrush() {
    super();
  }

  PShape pscreateElement() {

    PShape psDp = createShape(ELLIPSE, 0.0, 0.0, 1.0, 1.0);
    return psDp;

  }

}

/* ---------------------------------------------------------------------- */

PImage img;
PshapeElement brush;

float canvasW, canvasH;
float rateSize;

void setup() {
  size(1080, 1080);
  float baseWH = 980;
  
  colorMode(HSB, 360, 100, 100, 100);
  noStroke();
  smooth(8);
  noLoop();
  blendMode(BLEND);

  brush = new BoxBrush();

  if (args == null) {
    // you can use your photo in ./data/your_image.jpg
    img = loadImage("your_image.jpg");
  } else {
    // args[0] must be image path
    img = loadImage(args[0]);
  }

  // fit to canvas size
  rateSize = baseWH / max(img.width, img.height);
  canvasW = img.width * rateSize;
  canvasH = img.height * rateSize;

  img.resize(int(canvasW), int(canvasH));
  img.loadPixels();

}

void draw() {

  float maxBrightness = 90;
  
  background(0.0, 0.0, maxBrightness, 100.0);
  translate((width - canvasW) / 2, (height - canvasH) / 2);
  pushMatrix();
  translate(0.0, 0.0);
  fill(0.0, 0.0, 0.0, 100.0);
  rect(0.0, 0.0, img.width, img.height);
  popMatrix();
  
  float nzWStart = random(10.0);
  float nzHStart = random(10.0);

  blendMode(SCREEN);

  for (int dotSiz = 1; dotSiz <= 6; ++dotSiz) {

    float nzW = nzWStart;
    for (int idxW = 0; idxW < img.width; idxW += 1) {  

      float nzH = nzHStart;
      for (int idxH = 0; idxH < img.height; idxH += 1) {

        int idxPoint = idxH * img.width + idxW;
        color cPoint = img.pixels[idxPoint];

        float valSiz = 1.0 * dotSiz * dotSiz;
        float valHue = (hue(cPoint) + map(noise(nzW, nzH), 0.0, 1.0, -45.0, 45.0)) % 360.0;
        float valSat = map(saturation(cPoint), 0.0, 100.0, 300.0, 600.0) / dotSiz;
        float valBri = map(brightness(cPoint), 0.0, 100.0, 100.0 / 95.0, 100.0 / 35.0);
        float valAlp = map(brightness(cPoint) + saturation(cPoint), 0.0, 200.0, 300.0, 100.0) / dotSiz;

        pushMatrix();
        translate(idxW, idxH);
        brush.resetSize();
        brush.changeSize(valSiz, valSiz);
        brush.setElementFill(valHue, valSat, valBri, valAlp);
        brush.show();
        popMatrix();

        nzH += 0.008;

      }

      nzW += 0.008;

    }
  }  

  saveFrame("frames/####.png");
  exit();

}

/*
Copyright (C) 2017- deconbatch

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>
*/


 

Next Post Previous Post
No Comment
Add Comment
comment url