Images (jpeg) in C programming

J

jock

Hello,

Is it possible to perform basic image manipulation through C? I'd like
to upload images through a web interface and resize them so they are
limited to a max height/width restriction.

My hosting company has gcc v2.95.4 installed, also runs Apache on
Debian.

Thanks
Jock
 
J

Joona I Palaste

jock said:
Is it possible to perform basic image manipulation through C? I'd like
to upload images through a web interface and resize them so they are
limited to a max height/width restriction.
My hosting company has gcc v2.95.4 installed, also runs Apache on
Debian.

As long as you only *manipulate* the jpeg files, and do not display,
uploard or download them, it's very well possible. Knock yourself out,
as they say.
The downside is that you must implement all the manipulation algorithms
yourself, or use a third-party library. Standard C offers no ready-made
functions.

--
/-- Joona Palaste ([email protected]) ---------------------------\
| Kingpriest of "The Flying Lemon Tree" G++ FR FW+ M- #108 D+ ADA N+++|
| http://www.helsinki.fi/~palaste W++ B OP+ |
\----------------------------------------- Finland rules! ------------/
"Holy Banana of this, Sacred Coconut of that, Magic Axolotl of the other."
- Guardian in "Jinxter"
 
T

Tristan Miller

Greetings.

Is it possible to perform basic image manipulation through C? I'd like
to upload images through a web interface and resize them so they are
limited to a max height/width restriction.

You certainly can, except for the uploading part. Since C contains no
built-in support for manipulating JPEGs, though, you'll probably find it
more convenient to find a third-party graphics library. Otherwise you'll
need to read up on graphics algorithms and the JPEG specification. Simply
open each JPEG as a binary file, read in the data into the appropriate data
structures, do whatever matrix operations you need to resize the image, and
write the data back out. If you're also writing the web interface, there's
a more-or-less standard C library out there by the name of cgic.
 
E

Eric Sosman

jock said:
Hello,

Is it possible to perform basic image manipulation through C?

Yes, but there are no built-in capabilities to do so. You'll
need to find them elsewhere, or write your own.
I'd like
to upload images through a web interface and resize them so they are
limited to a max height/width restriction.

Note that C also lacks any notion of "upload" or "web." For
these, you'll need "C plus extensions" of some kind.
My hosting company has gcc v2.95.4 installed, also runs Apache on
Debian.

If such details make a difference to your question, your
question is almost certainly not about C but about the
"C plus
extensions" provided by the environment.
 
M

Mike Wahler

jock said:
Hello,

Is it possible to perform basic image manipulation through C?

Not with the C language alone. It can be done using a
combination of C and a few tools.
I'd like
to upload images through a web interface

Internet functionality will again, need special tools.
and resize them so they are
limited to a max height/width restriction.

My hosting company has gcc v2.95.4 installed, also runs Apache on
Debian.

See www.jpeg.org for free libraries for manipulating JPEG
files. Find an imaging library for actual image rendering
for your system. Find a networking library for your networking
needs. www.google.com

Note that your search terms will need to also describe
your platform, since all this is very platform dependent.

-Mike
 
M

Malcolm

jock said:
Is it possible to perform basic image manipulation through C? I'd like
to upload images through a web interface and resize them so they are
limited to a max height/width restriction.
Yes and no. You can write a JPEG codec in C, it it would be an enormous
task. However there will be code written for you that does this.If you get
the right library, it should be easy to decompress an image, crop it, and
then recode it.

You also need a non-standard library to access the web.
 
O

one2001boy

jock said:
Hello,

Is it possible to perform basic image manipulation through C?

You can do image manipulation via OpenCV and Tag Image File Format (TIFF).

http://sourceforge.net/projects/opencvlibrary/
http://chtiff.sourceforge.net/

I'd like
to upload images through a web interface and resize them so they are
limited to a max height/width restriction.

There are sample files to demonstrate image handling over the web.

http://www.softintegration.com/products/thirdparty/opencv/demos/

To handle upload images in C, you can try C/C++ interpreter Ch
with its free CGI toolkit. The Ch CGI APIs works similar to ASP or JSP,
easy to use. The latest release contains samples for how to
handle uploading files.

http://www.softintegration.com/products/toolkit/cgi/

of course, you can also try other C CGI library if you want to compile.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top