Loading...
Logo
Processing Forum
I have a sketch that spans 2 screens with the size of 3286 x 1080 pixels with following break-outs:
1. Screen 1 : 1920 x 1080 px
2. Screen 2 : 1366 x 768 px

When the app runs, it will display a background that is the same size as the sketch. The sketch would then save a portion of the image into a file. My problem is in the output file, there's a visible blue line which seems to come out of nowhere. Here's my sketch with unrelated code removed:

import processing.opengl.*;
PImage bg;

Copy code
  1. void setup() {
  2.     size(3286, 1080, OPENGL);
  3.     frameRate(30);
  4.     bg                  = loadImage("bg.png");
  5. }

  6. void draw() {
  7.     background(bg);

  8.     PImage noteImg      = get(2309, 138, 589, 538);
  9.     String filename     = "test.png";
  10.     noteImg.save(savePath("data/" + filename));
  11.     noLoop();
  12. }
Here's the bg image:


And here's the output image:


When I change the rendering mode to other than OPENGL, the blue line is gone. But on my first screen, where images rotates (25 in total), they become laggy. 
And also, when using OPENGL mode, the get(x, y, height, width) seems to be off, it gets the area of much lower part of the background which doesn't happen when I use JAVA2D, P2D and P3D.
Any thought or advice?

Replies(1)

Not entirely clear why the blue line appears, but in my case I fixed it by replacing each pixels of blue line with yellow:

Copy code
  1.     //fix the nasty blue line which appears in the middle of the image
  2.     //the blue line is the result of using OPENGL with get() function
  3.     //OPENGL speeds and smooth up the rendering but doesn't get along with get()
  4.     color clrBlue = color(172, 252, 253);
  5.     color clrYellow = color(253, 252, 172);
  6.     noteImg.loadPixels();
  7.     //for (int i = 1; i <= (noteImg.width * noteImg.height) - 1; i++) {
  8.     //since we know where the blue line is, we run through the range to speed up sketch
  9.     for (int i = 158120; i <= 158708; i++) { 
  10.         if (noteImg.pixels[i] == clrBlue) {
  11.             noteImg.pixels[i] = clrYellow;
  12.         }
  13.     }
  14.     noteImg.updatePixels();