Difference between revisions of "User talk:GuiRitter"

Explain xkcd: It's 'cause you're dumb.
Jump to: navigation, search
m (added template image)
(found the Java code to treat the image)
 
Line 358: Line 358:
 
|}
 
|}
  
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.
+
{| class="wikitable collapsible collapsed"
 +
! 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"

Latest revision as of 13:57, 3 December 2015

I've been nerdsniped. I've colored the map from 1407 in two different ways. First, by using the index of the hurricane in the table, from 0 to 73. Second, by finding out in what day the hurricane happened (actually used dissipation day), then by converting this date to the number of milliseconds since 1970/01/01, then by normalizing that to a 0–1 range. Both ranges where converted to a color with HSL (x, 100, 50), where x varies from red to blue, going through green. Some areas of the map remained blank because it's not stated which hurricane was most remembered there, and I'm not that interested in US geography/meteorology to find out. I used Java to parse the data and Java/GIMP to make the images.

Here's the map colored by each hurricane's dissipation date: xkcd 1407 colored millis.png

Here's the map colored by each hurricane's index: xkcd 1407 colored index.png

I just used it to separate the red lines from the black lines.

I was going to add the GIMP xcf image, but this wiki doesn't allow it.

GuiRitter (talk) 12:45, 30 November 2015 (UTC)