Warning: session_start(): open(/var/lib/php/sessions/sess_e46pigbdh27pa3c8jl42srhdto, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
// same brightness level count for each channel for now
srecord noeq PosterizeBufferedImage(int brightnessLevels, BufferedImage img) is PixelPreservingImageOpResult {
BufferedImage result;
run {
if (brightnessLevels >= 256 || img == null) ret with result = img;
GrabbableIntPixels gp = grabbableIntPixels_fastOrSlow(img);
int w = img.getWidth(), h = img.getHeight(), n = w*h;
int[] pixels2 = new[n];
SinglePixelPosterizer posterizer = new(brightnessLevels);
int iOut = 0, iIn = gp.offset;
for y to h: {
for x to w: {
int rgb = pixels[iIn+x];
pixels2[iOut++] = rgbInt(
posterizer.get(rgbRed(rgb)),
posterizer.get(rgbGreen(rgb)),
posterizer.get(rgbBlue(rgb)));
}
iIn += gp.scanlineStride;
}
result = bufferedImageWithoutAlpha(w, h, pixels2);
}
public BufferedImage pixelPreservingSrcImage() { ret img; }
}