void setup() { rect = new Draw(0, 0, 0, 0, new PImage()); size (900,600); //rect.display(); }
PImage img; void setup () { colorMode(HSB, 100); img = loadImage ("img.png"); size(img.width,img.height); color sat = color (0,0,0); img.loadPixels(); for (int i = 0; i < width * height; i++) { img.pixels[i]=color (hue(img.pixels[i]), sat, brightness(img.pixels[i])); } img.updatePixels(); image(img,0,0); }
static public int blendColor(int c1, int c2, int mode) { return PImage.blendColor(c1, c2, mode); }
void keyPressed() { if (key == 's' || key == 'S') { PImage img = createImage(posX, specSize, RGB); for(int i = 0; i < notes.size(); i++){ int x = notes.get(i).getX(); int y = notes.get(i).getY(); int loc = x + y*posX; img.pixels[loc] = color(notes.get(i).getR(), notes.get(i).getG(), notes.get(i).getB()); } img.updatePixels(); img.save("outputImage.png"); } }
/** * Set alpha channel for an image using another image as the source. */ public void mask(PImage alpha) { if (alpha.pixels == null) { // if pixels haven't been loaded by the user, then only load them // temporarily to save memory when finished. alpha.loadPixels(); mask(alpha.pixels); alpha.pixels = null; } else { mask(alpha.pixels); } }
int dy2 = dy + dh; loadPixels(); if (src == this) { if (intersect(sx, sy, sx2, sy2, dx, dy, dx2, dy2)) { blit_resize(get(sx, sy, sx2 - sx, sy2 - sy), 0, 0, sx2 - sx - 1, sy2 - sy - 1, pixels, width, height, dx, dy, dx2, dy2, mode); } else { blit_resize(src, sx, sy, sx2, sy2, pixels, width, height, dx, dy, dx2, dy2, mode); src.loadPixels(); blit_resize(src, sx, sy, sx2, sy2, pixels, width, height, dx, dy, dx2, dy2, mode); updatePixels();
public void filter(int kind) { loadPixels(); filter(BLUR, 1); break; filter(THRESHOLD, 0.5f); break; erode(); // former dilate(true); break; dilate(); // former dilate(false); break; updatePixels(); // mark as modified
loadPixels(); blurAlpha(param); else if (format == ARGB) blurARGB(param); else blurRGB(param); break; "filter(DILATE, param)"); updatePixels(); // mark as modified
shrinkImage((BufferedImage) getNative(), w*pixelDensity, h*pixelDensity); PImage temp = new PImage(img); this.pixelWidth = temp.width; this.pixelHeight = temp.height; updatePixels();
for(int i = 0 ; i < erodeAmt ; i++) mask.filter(ERODE); for(int i = 0 ; i < dilateAmt; i++) mask.filter(DILATE); mask.filter(BLUR,blurAmt); mask.updatePixels(); rgb.mask(mask); image(rgb, context.depthWidth() + 10, 0);
int[] userMap = context.userMap(); background(0, 0, 0); mask.loadPixels(); for (int i = 0; i < numPixels; i++) { mask.pixels[i] = userMap[i] > 0 ? color(255) : color(0); mask.updatePixels(); opencv.loadImage(mask); opencv.gray(); image(mask, 0, 0); PImage rgb = context.rgbImage(); rgb.mask(mask); image(mov, context.depthWidth() + 10, 0); image(rgb, context.depthWidth() + 10, 0);
PImage sample; void setup() { size(300,300); sample = loadImage("sample.jpg"); sample.loadPixels(); image(sample,0,0,300,300); } void draw() { //Loop to scan the image pixel by pixel for (int x=0; x < sample.width; x++){ for (int y=0; y < sample.height; y++){ int location = x + (y * sample.width); // Whit the location you can get the current color color currentColor = sample.pixels[loc]; //Do something } } }
who.updatePixels(); // mark the whole thing for update who.setModified(); (!tint && cash.tinted)) { who.updatePixels(); if (who.isModified()) { if (who.pixels == null) { who.setModified(false);
public void updatePixels() { // ignore updatePixels(0, 0, pixelWidth, pixelHeight); }
loadPixels(); success = saveTGA(output); //, pixels, width, height, format); success = saveTIFF(output);
protected Object initCache(PImage img) { if (!checkGLThread()) { return null; } Texture tex = (Texture)getCache(img); if (tex == null || tex.contextIsOutdated()) { tex = addTexture(img); if (tex != null) { img.loadPixels(); tex.set(img.pixels, img.format); img.setModified(); } } return tex; }
PImage image = (bytes == null) ? null : PImage.loadTIFF(bytes); PImage image = new PImage(awtImage); if (image.width == -1) { System.err.println("The file " + filename + image.checkAlpha();
/** * This is really inefficient and not a good idea in OpenGL. Use get() and * set() with a smaller image area, or call the filter on an image instead, * and then draw that. */ @Override public void filter(int kind) { PImage temp = get(); temp.filter(kind); set(0, 0, temp); }
PImage outgoing = new PImage(bi.getWidth(), bi.getHeight()); outgoing.parent = this; outgoing.checkAlpha();