Find the answer to your Linux question:
Results 1 to 3 of 3
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Red face Drawing RAW image to X-Window

    I want to draw image on an X-Window. This will be so simple than reading a Jpeg file and drawing it I guess. Here is what I need:

    I have completely RAW images. Think of it as a matrix of any size, for example size=4x4 and the image is like this:

    10 125 43 157
    99 45 182 84
    59 168 39 65
    16 67 154 27

    That is, the values are from 0 to 255, so they represent graylevels. (No color is involved.) Of course, the above is a simple example; I'll work on images of larger sizes.

    I have compiled the simple programs at this address. I want to modify them according to my needs and I know that, I need to work with XImage, XCreateImage and related functions but I don't know how to do it.

    For example, one program uses the function

    int rc = XReadBitmapFile(display, win,
    &bitmap_width, &bitmap_height,
    &hotspot_x, &hotspot_y);

    and reads and displays a BMP image BUT I only want to display the values of a matrix MyImage[i][j], where i=j= 1 to 4 for above matrix.

    Would any one help me on how to use the X library functions with examples if possible?
    Thanks a lot!!

  2. #2
    Linux Engineer Javasnob's Avatar
    Join Date
    Jul 2005
    If you don't mind using a third-party library, I highly recommend Imlib2. It's fast and efficient, plus it's easy to use. It's alot better than dealing with Xlib's image manipulation routines, in my opinion.
    Flies of a particular kind, i.e. time-flies, are fond of an arrow.

    Registered Linux User #408794

  3. #3

    Wink How to use the functions to display?

    Well, thanks for the valuable ideas.
    Would anyone give me some idea how to go with either Xlib or Imlib2?

    Like, read the file like this, using this function and display it using this function.


  4. $spacer_open

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts