hey /g/, how would i go about writing every single rgb value in pic related in a text file automatically? is there some format that stores data like this?
array obv
You can write a program to do it very easily.
Well that's a JPEG so you're already fucked.
But if you had it as a lossless file, convert it to a BMP and open the image in a hex editor - pic related.
It's relatively easy to suck the pixel data out of a lossless file. BMP is the easiest imo.
>>52486492
Computers are magic, fucking magic.
>>52486466
>>52486490
>>52486492
This was my first thought, but I cannot code. I might do the BMP thing because I do have the losless file, but then is there a way to convert that hex data into plaintext numbers for RGB automatically?
>>52486555
literally copy and paste and some basic math bro
Convert the original to a BMP and upload it, I'll check it out and hold your hand
>>52486626
dont have it on this pc, but dont worry. you can bet if i have more technical trouble i will be back on /g/ the very next day.
thanks all
>>52486671
well i'll teach you anyway. i made a BMP but i can't upload it so here's a PNG representation of it
>>52486555import java.awt.image.BufferedImage;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import javax.imageio.ImageIO;
public class Main {
public static void main(String[] args) {
BufferedImage img = null;
try {
img = ImageIO.read(new File("input.jpg"));
for (int y = 0; y < img.getHeight(); y++) {
for (int x = 0; x < img.getWidth(); x++) {
int rgb = img.getRGB(x, y);
String outputFile = "output.txt";
FileWriter fw = new FileWriter(outputFile,true);
BufferedWriter bw = new BufferedWriter(fw);
bw.write("#"+Integer.toHexString(rgb).substring(2).toUpperCase()+"\n");
bw.close();
}
}
} catch (IOException e) {
}
}
}
prints in this format#B8ABB5
#B8ABB5
#B7AAB4
#B7AAB4
#B7AAB4
#B7AAB4
#B7AAB4
>>52486671
>>52486770
next up, open it in a hex editor and find where the pixel data is
In this image it's at 0x36
>>52486786
lastly copy that shit to a text editor and run a script/record a macro where you separate the AB CD EF AB CD EF to:
#ABCDEF
#ABCDEF
etc
>>52486828
Can confirm it is literally this easy, OP. Just in case you though you were somehow being /g/entoo'd on
>>52486422
I wrote pic related program to do that
Here's the code#include <stdio.h>
int main(int * argc, char * argv[])
{
FILE *in;
in = fopen("out.ppm", "wb");
int r = 0, g = 0,b=0;
fprintf(in, "P6\n5527 3000\n255");
while(r < 256)
{
while(g < 256)
{
while(b < 256)
{
b++;
fputc(r,in);
fputc(g,in);
fputc(b,in);
}
b = 0;
g++;
}
r++;
g = 0;
}
fclose(in);
return 0;
}
Also you should read up on this file format, it is far easy to implement as compared to even BMP
>https://en.wikipedia.org/wiki/Netpbm_format