C: minimalist displaying an image file to pixels ?
Hi,
I have been trying to convert a jpg to various format (gimp), then to import them into C program, but those formats are likely difficult to process. (without using libs of imagemagick) mbm is quite simple but actually ... not so much. Would you know how to convert a bitmap (whatever format) to a RESIZABLE pixel array? I wish direction shall I start? (without using libs of imagemagick) int row, cols; //for my screen/image max size Cheers, Thanks |
NetPBM
Here is an example that uses NetPBM [1] to make an easily readable ASCII version of the image.
Code:
anytopnm foobar.jpg 2>/dev/null | pnmnoraw >foobar.ppm http://en.wikipedia.org/wiki/Netpbm_format |
Quote:
|
actually, I might find a way... somehow to get the array on int filled
a question, to resize my array, which method might be advised? ex: I have a bitmap for a screen of 800 x 600 pixels int pixely[600] ; int pixelx[800] ; and would like to move to 300x 200 int pixely_new[200] ; int pixelx_new[300] ; Luckily it is not so complicated due to colors. My pixels are either 0 or 1. So it is black and white bitmap/array. So this resizing might be occuring with less difficulties, but still, which method would you preferably recommend? I had such a problem in visual basic before, but never got it really solved, and in C, it is much different ( and much better). Thanks in advance |
|
1 Attachment(s)
Quote:
http://s4.hubimg.com/u/562531_f260.jpg Would be nice if we could get the array of pixels with simply stdio ;) kidding |
Actually for windows, why not ?
libjpeg.dll I dont like so much since it is not minimalist any longer |
|
for use in a c based program
convert the images to ppm also have a look as G'Mic and CImg.h http://gmic.sourceforge.net/ http://cimg.sourceforge.net/download.shtml is what gmic is built on |
oh yeah,
a fantastic thing is gimp !! gimp can export to .h or .c and you can reload it. Is there already a simple code that can display the .c one? nothing to say... wikipedia is really clear and useful to understadn http://en.wikipedia.org/wiki/Resampling_(bitmap) they explain well |
Quote:
Quote:
Kevin Barry |
Quote:
well the question is whether this pixmap *.c image file shall be converted either to X11 or ncurses? |
All times are GMT -5. The time now is 04:03 AM. |