Welcome to the most active Linux Forum on the web.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 05-04-2005, 12:17 PM   #1
Registered: Apr 2005
Posts: 50

Rep: Reputation: 15
Question how to write an image from a data array

I am using c++ on linux and need to write to an image file from a data array (RGB values) that was dynamically created. I am having trouble trying to track down a library or sample code that would help (almost any format that can do 32 bit would be fine -- i.e. jpg).

Thanks for any help. I am trying to find something easy to implement (nothing fancy needed).


Old 05-04-2005, 01:21 PM   #2
Senior Member
Registered: Feb 2004
Location: Somerset, England
Distribution: Slackware 10.2, Slackware 10.0, Ubuntu 9.10
Posts: 1,938

Rep: Reputation: 55
I think SDL or SDL_image can do what you want. I also seem to remember that a gdk pixbuf can do similar.
Old 05-04-2005, 03:15 PM   #3
Registered: Apr 2005
Posts: 50

Original Poster
Rep: Reputation: 15
Thanks. I guess that I should have mentioned that I am programming in a 'console' environment, meaning that I do not want to use gnome or gnome libraries.

Do you know if it is possible to use any of your suggestions without going through gnome or similiar windowing system?


Old 05-04-2005, 04:38 PM   #4
Registered: Jun 2003
Location: Long Island, NY
Distribution: Gentoo Unstable (what a misnomer)
Posts: 380

Rep: Reputation: 30
You could use rawtoppm and ppmtojpeg commands to
convert the data. It's not a pretty like a library call, but
it's quick.
Old 05-05-2005, 06:53 PM   #5
LQ Guru
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 677Reputation: 677Reputation: 677Reputation: 677Reputation: 677Reputation: 677
Programs like convert are console programs. You might want to examine the ImageMagick source package. The list of required libraries ( perhaps libjpeg ) may provide an answer.

Or simply use the ldd command to find which shared libraries that the convert program uses. Since the program converts between different types of graphics images, the internal representation of the image may be similar to what you are using. So the source code may provide answers.

Also, check the ImageMagick homepage. They have a C++
Magick++ library. Also, the license is a free license, so you may not have any restrictions on the use of the library or its code. Of course read their license thoroughly through first.

Last edited by jschiwal; 05-05-2005 at 07:05 PM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Should I enable write caching on my raid array? abefroman Linux - Hardware 1 09-26-2005 05:38 PM
Linux installation media has no write permission to Ultra-Wide SCSI2 array?? halo14 Linux - Hardware 3 04-04-2005 04:29 PM
Help!!! How write own boot image SDE Linux - Networking 1 02-21-2005 04:46 AM
Help accessing data on NTFS raid array Qwindelzorf Linux - Hardware 2 01-15-2005 03:34 PM
dd image write accident dwg22guitar Linux - General 1 07-03-2003 02:46 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:30 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration