Editing User talk:GuiRitter

Jump to: navigation, search
Ambox notice.png Please sign your posts with ~~~~

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 358: Line 358:
 
|}
 
|}
  
{| class="wikitable collapsible collapsed"
+
The Java code to treat the image was probably deleted after use, and was too simple anyway to post here. I just used it to separate the red lines from the black lines.
! Here's the Java code to treat the image
 
|-
 
|
 
  package main;
 
 
 
  import java.awt.image.BufferedImage;
 
  import java.awt.image.WritableRaster;
 
  import java.io.File;
 
  import java.io.IOException;
 
  import javax.imageio.ImageIO;
 
 
 
  @SuppressWarnings("Convert2Lambda")
 
  public final class Main {
 
 
 
      private static int color[] = null;
 
 
 
      public static void main(String args[]) throws IOException {
 
          BufferedImage input = ImageIO.read(new File("C:\\Users\\GuiR\\Desktop\\worst_hurricane_large.png"));
 
          WritableRaster raster = input.getRaster();
 
          for (int y = 0; y < input.getHeight(); y++) {
 
              for (int x = 0; x < input.getWidth(); x++) {
 
                  color = raster.getPixel(x, y, (int[]) null);
 
                  //if ((color[0] != color[1]) || (color[1] != color[2]) || (color[0] != color[2])) {// it's red
 
                  if ((color[0] == color[1]) && (color[1] == color[2])) {// it's not red
 
                      color[0] = 255;
 
                      color[1] = 255;
 
                      color[2] = 255;
 
                  }
 
                  raster.setPixel(x, y, color);
 
              }
 
          }
 
          //ImageIO.write(input, "png", new File("C:\\Users\\GuiR\\Desktop\\worst_hurricane_large_black.png"));
 
          ImageIO.write(input, "png", new File("C:\\Users\\GuiR\\Desktop\\worst_hurricane_large_red.png"));
 
      }
 
  }
 
|}
 
 
 
I just used it to separate the red lines from the black lines.
 
  
 
{| class="wikitable collapsible collapsed"
 
{| class="wikitable collapsible collapsed"

Please note that all contributions to explain xkcd may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see explain xkcd:Copyrights for details). Do not submit copyrighted work without permission!

To protect the wiki against automated edit spam, we kindly ask you to solve the following CAPTCHA:

Cancel | Editing help (opens in new window)

Template used on this page: