# Sabattier effect in processing

**URL:** https://discourse.processing.org/t/sabattier-effect-in-processing/21553
**Category:** Coding Questions
**Tags:** homework
**Created:** [June 4, 2020, 11:55am UTC](https://discourse.processing.org/t/sabattier-effect-in-processing/21553 "2020-06-04T11:55:02Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![gatz\_gaz](https://avatars.discourse-cdn.com/v4/letter/g/bb73d2/32.png) [@gatz\_gaz](https://discourse.processing.org/u/gatz_gaz)
#### Post date: [June 4, 2020, 11:55am UTC](https://discourse.processing.org/t/sabattier-effect-in-processing/21553/1 "2020-06-04T11:55:02Z")

</div>

> please format code with \</\> button \* [homework policy](https://discourse.processing.org/faq/#homework) \* [asking questions](https://discourse.processing.org/t/2147)

Hi, does anyone know how to do the Sabattier effect in processing?

Example:  
 ![2300869305_73b69bf475](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/9/900770107bffbb1096fb57663bf2584149c3b4cc.jpeg)

---

<div class="post-metadata">

### Author: ![uheinema](https://avatars.discourse-cdn.com/v4/letter/u/e99b99/32.png) [@uheinema](https://discourse.processing.org/u/uheinema)
#### Post date: [June 4, 2020, 1:16pm UTC](https://discourse.processing.org/t/sabattier-effect-in-processing/21553/2 "2020-06-04T13:16:29Z")

</div>

1. Find out what the effect is. Hint: Gradients
2. Get the pixels
3. Apply your sabbatier() function
4. Update the pixels
5. Display

If you need speed, do it in a GLSL shader.

---

<div class="post-metadata">

### Author: ![josephh](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/josephh/32/210_2.png) [@josephh](https://discourse.processing.org/u/josephh)
#### Post date: [June 4, 2020, 1:27pm UTC](https://discourse.processing.org/t/sabattier-effect-in-processing/21553/3 "2020-06-04T13:27:35Z")

</div>

Try to look at how it’s actually implemented in image editing softwares for example :

- [https://digital-photography-school.com/the-sabattier-effect/](https://digital-photography-school.com/the-sabattier-effect/)

- [https://en.wikipedia.org/wiki/Sabattier\_effect#In\_digital\_media](https://en.wikipedia.org/wiki/Sabattier_effect#In_digital_media)

- [https://photography.tutsplus.com/tutorials/solarized-like-zayn-the-digital-sabattier-effect-for-surreal-portraits--cms-26309](https://photography.tutsplus.com/tutorials/solarized-like-zayn-the-digital-sabattier-effect-for-surreal-portraits--cms-26309)

---

<div class="post-metadata">

### Author: ![uheinema](https://avatars.discourse-cdn.com/v4/letter/u/e99b99/32.png) [@uheinema](https://discourse.processing.org/u/uheinema)
#### Post date: [June 4, 2020, 2:43pm UTC](https://discourse.processing.org/t/sabattier-effect-in-processing/21553/4 "2020-06-04T14:43:44Z")

</div>

Of course Man Ray did a little selective overexposure…the bluish brightening is my weak attempt of mimicing that.  
Sketch i just wrote shows  
 ![Screenshot_20200604_163748_com.calsignlabs.apde.sketchpreview](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/7/789afd0d55aa00929749d313960bccf61e50e3e9.jpeg)  
.  
Source on request, but try yuor own first

---

<div class="post-metadata">

### Author: ![gatz\_gaz](https://avatars.discourse-cdn.com/v4/letter/g/bb73d2/32.png) [@gatz\_gaz](https://discourse.processing.org/u/gatz_gaz)
#### Post date: [June 4, 2020, 2:51pm UTC](https://discourse.processing.org/t/sabattier-effect-in-processing/21553/5 "2020-06-04T14:51:25Z")

</div>

That’s what I’m talking about, could I have the code to rehearse, please?

---

<div class="post-metadata">

### Author: ![uheinema](https://avatars.discourse-cdn.com/v4/letter/u/e99b99/32.png) [@uheinema](https://discourse.processing.org/u/uheinema)
#### Post date: [June 4, 2020, 2:58pm UTC](https://discourse.processing.org/t/sabattier-effect-in-processing/21553/6 "2020-06-04T14:58:28Z")

</div>

Ah well…make it better, and share.

```auto

PImage pic, sab;

float aspect;
float piwi;

void setup() {
  fullScreen();
  pic=loadImage(
    "manray.png"
    // "face.png"
    //"athene.jpg"
    );
  piwi=width;
  aspect=1.0*pic.height/pic.width;
  if (aspect>1) piwi/=aspect;
  sab=pic.get();
  sab.loadPixels();
  sabbatier(sab.pixels);
  sab.updatePixels();
}

void sabbatier(int[] pixels) {
  for (int i=0; i<pixels.length; i++) {
    int c=pixels[i];
    float blue=(c&0xff)/255.0f;
    pixels[i]=color(255*sabbatier(blue));
  }
}

float sabbatier(float u) {
  final float lim=0.2f;
  float r;
  if (u<lim)
    r=map(u, 0, lim, 1, 0);
  else
    r=map(u, lim, 1, 0, 1);
  return r;
}

void draw() {
  background(frameCount);
  image(pic, 0, 10, piwi, piwi*aspect);
  image(sab, 0, 20+piwi*aspect, piwi, piwi*aspect);
}

```

---

<div class="post-metadata">

### Author: ![gatz\_gaz](https://avatars.discourse-cdn.com/v4/letter/g/bb73d2/32.png) [@gatz\_gaz](https://discourse.processing.org/u/gatz_gaz)
#### Post date: [June 4, 2020, 3:04pm UTC](https://discourse.processing.org/t/sabattier-effect-in-processing/21553/7 "2020-06-04T15:04:30Z")

</div>

> [@uheinema](#):
>
> ```auto
> PImage pic, sab;
> 
> float aspect;
> float piwi;
> 
> void setup() {
> fullScreen();
> pic=loadImage(
> "manray.png"
> // "face.png"
> //"athene.jpg"
> );
> piwi=width;
> aspect=1.0*pic.height/pic.width;
> if (aspect>1) piwi/=aspect;
> sab=pic.get();
> sab.loadPixels();
> sabbatier(sab.pixels);
> sab.updatePixels();
> }
> 
> void sabbatier(int[] pixels) {
> for (int i=0; i<pixels.length; i++) {
> int c=pixels[i];
> float blue=(c&0xff)/255.0f;
> pixels[i]=color(255*sabbatier(blue));
> }
> }
> 
> float sabbatier(float u) {
> final float lim=0.2f;
> float r;
> if (u<lim)
> r=map(u, 0, lim, 1, 0);
> else
> r=map(u, lim, 1, 0, 1);
> return r;
> }
> 
> void draw() {
> background(frameCount);
> image(pic, 0, 10, piwi, piwi*aspect);
> image(sab, 0, 20+piwi*aspect, piwi, piwi*aspect);
> }
> 
> ```

of course, thank you very much!!

---

<div class="post-metadata">

### Author: ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)
#### Post date: [June 5, 2020, 2:57am UTC](https://discourse.processing.org/t/sabattier-effect-in-processing/21553/8 "2020-06-05T02:57:13Z")

</div>

If the Sabattier effect is worth encapsulating as a configurable effect, it might be worth proposing to @Milchreis as an addition for this library:

> **[Milchreis/processing-imageprocessing](https://github.com/Milchreis/processing-imageprocessing)**
>
> Collection of basic image processing algorithms for processing - Milchreis/processing-imageprocessing

---

<div class="post-metadata">

### Author: ![Milchreis](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/milchreis/32/7058_2.png) [@Milchreis](https://discourse.processing.org/u/Milchreis)
#### Post date: [June 5, 2020, 6:43am UTC](https://discourse.processing.org/t/sabattier-effect-in-processing/21553/9 "2020-06-05T06:43:49Z")

</div>

Very good idea Jeremy. I created a ticket for that 🙂

---

<div class="post-metadata">

### Author: ![uheinema](https://avatars.discourse-cdn.com/v4/letter/u/e99b99/32.png) [@uheinema](https://discourse.processing.org/u/uheinema)
#### Post date: [June 9, 2020, 5:05pm UTC](https://discourse.processing.org/t/sabattier-effect-in-processing/21553/10 "2020-06-09T17:05:43Z")

</div>

And in case you really want to know, in depth explanations are at

> **[Print Solarization - Controlling the Sabatier Effect](https://unblinkingeye.com/Articles/Solarization/solarization.html)**
>
> Print solarization, the Sabatier Effect in printing.

> **[The Sabbatier Effect - Hands-on Workshop - February 28, 2017 - 7:30-10:00pm -...](https://latow.com/2017/02/the-sabbatier-effect-hands-on-workshop-february-28-2017-730-1000pm/)**
>
> The Darkroom group will be moving back into a Tuesday time slot this month and presenting a hands-on workshop on producing prints using the Sabbatier effect. This process was identified by Armand Sabbatier in 1860, involving partial solarization of...

Somewhat contradictory:

> This process was identified by Armand Sabbatier in 1860, involving partial solarization of high contrast prints, during the development process.

> Sabatier (often misspelled Sabattier) was a doctor of medicine in the small French village of Saint-Mammers. He has been regularly confused with Armand Sabatier, a marine zoologist of the era, who published nothing on photography.

And also wiith Paul, Sabatier, Nobel Pricre for Chemistry 1912…but he wss born in 1857

> **[The Nobel Prize in Chemistry 1912](https://www.nobelprize.org/prizes/chemistry/1912/sabatier/lecture/)**
>
> The Nobel Prize in Chemistry 1912 was divided equally between Victor Grignard "for the discovery of the so-called Grignard reagent, which in recent years has greatly advanced the progress of organic chemistry" and Paul Sabatier "for his method of...

> The effect was first described in print by H. de la Blanchere in 1859 in L’Art du Photographe. It was described again in 1860 by L.M. Rutherford and C.A. Seely, separately, in successive issues of The American Journal of Photography, and in the same year by Count Schouwaloff in the French publication Cosmos. By rights the phenomenon should have been christened the Blanchere Effect, for it was not described by Sabatier until later in 1860 in Cosmos. Sabatier must have been aware of Schouwaloff’s earlier paper in the same publication, but he makes no mention of it.

So now we know…
