converting text data to an image file
I want to convert a (large) table of data e.g a 100x1000 matrix into a 100x1000pix grayscale image. I can then analyse the data as an image and perform various image processing tricks on it.
Does anyone have any ideas/converters/links?? |
Why go into an image format? Image processing is REALLY simple. Why not use something simple like this and just code it up? That way, you can do any sort of processing you want instead of relying on some 3rd party app to have the flexibility you need (but it probably doesn't have).
#include <stdio.h> void ReadMyData(double *pData, int *pWidth, int *pHeight) { // insert code to read data here *pWidth = 1000; *pHeight = 100; pData = malloc(sizeof(double) * (*pWidth) * (*pHeight)); } // Example image proc code here void PerformBlur(double *pData, int width, int height) { // insert blur code here } int main() { double *data; int width, height; ReadMyData(data, &width, &height); PerformBlur(); // or whatever code you want // insert code to write out data } |
The GD libraries can create pngs from data. I've used it in perl to make graphs of data. Theres probably some way to just start setting pixel values.
|
Quote:
Thanks for the replies. Unfortunately the code is double dutch to me. I am programmatically challenged. Any tips in English? :) |
I'll hack up some java on the train on the way in - there's a canvas demo that should be easy to convert.
What's the data - comma seperated values or fixed length fields? |
Quote:
Cheers |
Just going to draw it onscreen - you can capture it using Alt-Prtscn or your OS equiv.
No error handling, so if you have 999 rows on one row, I neatly Seg-V. :D PM me an email addy for java class and src files. |
1 Attachment(s)
Well, who knows if this will work. But at least it compiles and you have src.
It parses tab delimited files of numbers and spits out a PNG file. |
All times are GMT -5. The time now is 09:15 AM. |
Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
(C) 2005 ProCooling.com If we in some way offend you, insult you or your people, screw your mom, beat up your dad, or poop on your porch... we're sorry... we were probably really drunk... Oh and dont steal our content bitches! Don't give us a reason to pee in your open car window this summer...