Display image file using C programming - c

I want to read and display a png image using c programming. Please suggest some ways. Is it possible to use libPng library for displaying image ?

libPng will only decode the image into an RGBA-array for you. To then display the image you could use OpenGL or an OS-dependendent graphics-library.
EDIT: Since you say you are using windows:
On Windows you have many library choices: I suggest you start with SDL, you can start by showing your image like this: http://www.sdltutorials.com/Data/Posts/105/ss1.jpg and then continue building your application from there. There are many tutorials on SDL (see here: http://www.sdltutorials.com/tutorials). The JPG was from this one: http://www.sdltutorials.com/sdl-coordinates-and-blitting

Related

cairographics glade gtk3 c programming

I'm trying to develop an app using GTK3 + Glade and following examples and suggestions on internet I can obtain a first prototype of the application.
Now I want to add some plots in the app. I found that, in this contest, the Cairo library is the right solution. For the Cairo library I found this tutorial http://zetcode.com/gfx/cairo/
I tried to merge GTK3, Glade and Cairo using the C language but I'm not sure to use this tools in the right way.
Could you suggest me an example where using these tools is built an app that, e.g. pushing a button appear the plot of a curve?
Thank you
In Glade, you just need to add a GtkDrawingArea and you draw in it using cairo. Give a look at my gtk3-graph sample application that uses GTK+ 3 and cairo to plot a curve.

Taking a screenshot of a window in C using only the X11 lib

I am coding a raytracer engine in C using X11 on a Linux. I would like to add a screenshot feature but I can't use any other lib than the standard X11.
Is there a "simple" way to do that, or do I have to create a bmp file myself from the pixels I have?
You will manually have to get color values of all the pixels and then convert it to a format of your choice.
AFAIK, there is no "simple" way to do it.
You can check with this question here: How do take a screenshot correctly with xlib?

Capturing images from a webcam and displaying on a monitor

I want to periodically capture images through a webcam, modify the captured image and display it on a monitor. I can of course use OpenCV for that purpose, but OpenCV is big and complex. I want to have some code which can be easily ported from one system to another and therefore not depend on a big library. So my question is, is there any sample code for what I'm trying to do without using OpenCV or any other library?

Using libvlc on android with NDK

I am currently messing around a bit with libvlc on android using the NDK.
Well, I understand how to use native C code in an android app.
Now I would like to use the libvlc library to make a simple player which would read data from a socket.
Is it possible to use libvlc at that level? The problem I see is when it comes to set a window handler for libvlc to draw the image on.
Has anyone experienced with this that could give me some feedback?
Thank you.
You might be interested in this - https://bitbucket.org/tewilove/nyan.tv-jni/src
Edit: Looks like the nyan.tv link doesn't exist anymore. A possibly more 'official' sample is here -> https://bitbucket.org/edwardcw/libvlc-android-sample

How to rotate image in android using android ndk

i want to rotate bitmap in android . i don't want to use android api but want to use c code for image processing and fast response. can u tell me how to achieve this in c??
Thank you in advance
You could use OpenCV for Android by processing a rotation matrix in native code. But if you really just want to rotate an image, using native code for this would be over the top, unless you plan adding more complex transformations. A single transformation supposedly won't be processed faster in comparison to just rotating it in Java.
There is a nice solution for your needs: ImageMagick. You can compile C version of ImageMagick with NDK. There is also ImageMagick-Android project on github, but it doesn't look like a ready-to-use solution.

Resources