I have a problem. It is to generate a C code Please tell me how to display a image file on the screen in C? If u r kind to me, send the code

It's more difficult than that. There are lots of different image formats, and every one of them has strictly different requirements.

Google for an image library for the language of your choice. Several are free. We don't take code requests - we help YOU with YOUR code that you bring.

C is great for low level coding. You are talking about a high level task and could switch to a higher level language to make your life more productive.

''' ps_image_viewer101.py
view an image with Python using the PySide GUI toolkit
PySide is the official LGPL-licensed version of PyQT (QT)

Python and PySide are available for Windows, Linux and Apple OS X.
If you have Windows, download and execute the Windows self-extracting
installers in this order.
For Python33 (get the 32 bit version):
python-3.3.0.msi
free from:
http://python.org/download/

For PySide:
PySide-1.1.2.win32-py3.3.exe (based on QT483)
free from:
http://developer.qt.nokia.com/wiki/PySide_Binaries_Windows

'''

from PySide.QtCore import *
from PySide.QtGui import *

app = QApplication([])

# create the window/frame
win = QWidget()
# set location and size
win.setGeometry(100, 50, 500, 688)
# set the title
win.setWindowTitle("PySide Image Viewer")

# get an imagefile you have in the working folder
# or give full file path
fname = "cogtrain-500x688.jpg"

# load the picture in a form PySide can process
image = QPixmap(fname)

# use a label to display the image in
label = QLabel(win)
label.setPixmap(image)

win.show()

app.exec_()

Edited 3 Years Ago by Ene Uran

This article has been dead for over six months. Start a new discussion instead.